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

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  *
  37.  * Filename:
  38.  * ---------
  39.  * mmi_imps_ui.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  * MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  * This file implements all UI related functions for IMPS application.
  48.  *
  49.  * Author:
  50.  * -------
  51.  * -------
  52.  *
  53.  *============================================================================
  54.  *             HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  56.  *------------------------------------------------------------------------------
  57.  * removed!
  58.  *
  59.  * removed!
  60.  * removed!
  61.  * removed!
  62.  *
  63.  * removed!
  64.  * removed!
  65.  * removed!
  66.  *
  67.  * removed!
  68.  * removed!
  69.  * removed!
  70.  *
  71.  * removed!
  72.  * removed!
  73.  * removed!
  74.  *
  75.  * removed!
  76.  * removed!
  77.  * removed!
  78.  *
  79.  * removed!
  80.  * removed!
  81.  * removed!
  82.  *
  83.  * removed!
  84.  * removed!
  85.  * removed!
  86.  *
  87.  * removed!
  88.  * removed!
  89.  * removed!
  90.  *
  91.  * removed!
  92.  * removed!
  93.  * removed!
  94.  *
  95.  * removed!
  96.  * removed!
  97.  * removed!
  98.  *
  99.  * removed!
  100.  * removed!
  101.  * removed!
  102.  *
  103.  * removed!
  104.  * removed!
  105.  * removed!
  106.  *
  107.  * removed!
  108.  * removed!
  109.  * removed!
  110.  *
  111.  * removed!
  112.  * removed!
  113.  * removed!
  114.  *
  115.  * removed!
  116.  * removed!
  117.  * removed!
  118.  *
  119.  * removed!
  120.  * removed!
  121.  * removed!
  122.  *
  123.  *------------------------------------------------------------------------------
  124.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  125.  *============================================================================
  126.  ****************************************************************************/
  127. #ifndef _MMI_IMPS_UI_C
  128. #define _MMI_IMPS_UI_C
  129. #include "MMI_features.h"
  130. #ifdef __MMI_IMPS__
  131. /*  Include: MMI header file */
  132. #include "PixtelDataTypes.h"
  133. #include "stdC.h"
  134. #include "Stdlib.h"
  135. #include "L4Dr1.h"
  136. #include "L4Dr.h"
  137. #include "QueueGprot.h"
  138. #include "ProtocolEvents.h"
  139. #include "GlobalDefs.h"
  140. #include "CommonScreens.h"
  141. #include "DebugInitDef.h"
  142. #include "GlobalConstants.h"
  143. #include "GlobalScrEnum.h"
  144. #include "FrameworkStruct.h"
  145. #include "EventsGprot.h"
  146. #include "HistoryGprot.h"
  147. #include "wgui_categories.h"
  148. #include "wgui_categories_inputs.h"
  149. #include "wgui_inline_edit.h"
  150. #include "wgui_categories_popup.h"
  151. #include "wgui_categories_multimedia.h"
  152. #include "Wgui_tab_bars.h"
  153. #include "Wgui_asyncdynamic_menuitems.h"
  154. #include "wgui_categories_imps.h"
  155. #include "mmi_imps_enum.h"
  156. #include "mmi_imps_prot.h"
  157. #include "PhoneBookGprot.h"
  158. #include "AlarmFrameworkProt.h"
  159. #include "nvram_user_defs.h"
  160. #include "NVRAMProt.h"
  161. #include "FileManagerGProt.h"
  162. #include "Gdi_include.h"
  163. #include "Fmt_struct.h"
  164. #include "Gui_tab_bars.h"
  165. #include "PhoneBookGprot.h"
  166. #include "PhoneSetupGprots.h"
  167. #include "Conversions.h"
  168. /*  Include: PS header file */
  169. /* ... Add More PS header */
  170. /***************************************************************************** 
  171. * Define
  172. *****************************************************************************/
  173. /***************************************************************************** 
  174. * Typedef 
  175. *****************************************************************************/
  176. /***************************************************************************** 
  177. * Local Variable
  178. *****************************************************************************/
  179. const S8 g_imps_zero_ip[] = { '0', '', '0', '', '0', '', '', '' };    /* 000 */
  180. const S8 g_imps_left_bracket[] = { '<', '', '', '' }; /* { */
  181. const S8 g_imps_right_bracket[] = { '<', '', '', '' };    /* } */
  182. const S8 g_imps_wv[] = { 'w', '', 'v', '', ':', '', '', '' }; /* wv: */
  183. const S8 g_imps_proxy_port[] = { '8', '', '0', '', '8', '', '0', '', '', '' };      /* 8080 */
  184. const S8 g_imps_server_prefix[] = { 'h', '', 't', '', 't', '', 'p', '', ':', '', '/', '', '/', '', '', '' };  /* http:// */
  185. /* string of mood */
  186. const S8 *const g_imps_mood_str[IMPS_NUM_MOOD] = 
  187. {
  188.     (S8 *) L":)",
  189.     (S8 *) L":(",
  190.     (S8 *) L":@",
  191.     (S8 *) L"^ol",
  192.     (S8 *) L":$",
  193.     (S8 *) L";)",
  194.     (S8 *) L"(L)",
  195.     (S8 *) L"|-)",
  196.     (S8 *) L"+o(",
  197.     (S8 *) L":|",
  198.     (S8 *) L":s"
  199. };
  200. /* mapping table of mood and icons */
  201. static wgui_multiline_icon_struct g_imps_mood_icon_list[IMPS_NUM_MOOD] = 
  202. {
  203.     {NULL, 0, 0, ":)"},
  204.     {NULL, 0, 0, ":("},
  205.     {NULL, 0, 0, ":@"},
  206.     {NULL, 0, 0, "^ol"},
  207.     {NULL, 0, 0, ":$"},
  208.     {NULL, 0, 0, ";)"},
  209.     {NULL, 0, 0, "(L)"},
  210.     {NULL, 0, 0, "|-)"},
  211.     {NULL, 0, 0, "+o("},
  212.     {NULL, 0, 0, ":|"},
  213.     {NULL, 0, 0, ":s"}
  214. };
  215. #define IMPS_NUM_INVITE 3
  216. /* give some string at will to replaced by a specific icon */
  217. static wgui_multiline_icon_struct g_imps_invite_icon_list[IMPS_NUM_INVITE] = 
  218. {
  219.     {NULL, 0, 0, "#$#"},        /* owner */
  220.     {NULL, 0, 0, "$#$"},        /* group */
  221.     {NULL, 0, 0, "##$"} /* note */
  222. };
  223. /* indexing icons for inline editor */
  224. const U16 g_imps_inline_icons[14] = 
  225. {
  226.     IMG_GLOBAL_L1, 0,
  227.     IMG_GLOBAL_L2, 0,
  228.     IMG_GLOBAL_L3, 0,
  229.     IMG_GLOBAL_L4, 0,
  230.     IMG_GLOBAL_L5, 0,
  231.     IMG_GLOBAL_L6, 0,
  232.     IMG_GLOBAL_L7, 0
  233. };
  234. /* prefix of UCS2 file */
  235. const U8 g_imps_ucs2_file_prefix[2] = {0xFF, 0xFE};
  236. /***************************************************************************** 
  237. * Local Function
  238. *****************************************************************************/
  239. /***************************************************************************** 
  240. * Global Variable
  241. *****************************************************************************/
  242. extern wgui_inline_item wgui_inline_items[];
  243. /***************************************************************************** 
  244. * Global Function
  245. *****************************************************************************/
  246. extern void set_leading_zero(U8);
  247. #ifdef IMPS_TEST_CODE
  248. /*****************************************************************************
  249.  * FUNCTION
  250.  *  mmi_imps_test_login_complete
  251.  * DESCRIPTION
  252.  *  
  253.  * PARAMETERS
  254.  *  void
  255.  * RETURNS
  256.  *  void
  257.  *****************************************************************************/
  258. void mmi_imps_test_login_complete(void)
  259. {
  260.     /*----------------------------------------------------------------*/
  261.     /* Local Variables                                                */
  262.     /*----------------------------------------------------------------*/
  263.     /*----------------------------------------------------------------*/
  264.     /* Code Body                                                      */
  265.     /*----------------------------------------------------------------*/
  266.     imps_p->gen_info.is_login = TRUE;
  267.     imps_p->gen_info.no_tab = 1;
  268.     mmi_imps_pre_entry_cont();
  269.     DeleteScreenIfPresent(SCR_ID_IMPS_PROGRESS);
  270.     DeleteScreenIfPresent(SCR_ID_IMPS_MAIN);
  271. }
  272. /*****************************************************************************
  273.  * FUNCTION
  274.  *  mmi_imps_test_cont_key_hdlr
  275.  * DESCRIPTION
  276.  *  
  277.  * PARAMETERS
  278.  *  void
  279.  * RETURNS
  280.  *  void
  281.  *****************************************************************************/
  282. void mmi_imps_test_cont_key_hdlr(void)
  283. {
  284.     /*----------------------------------------------------------------*/
  285.     /* Local Variables                                                */
  286.     /*----------------------------------------------------------------*/
  287.     imps_entity_struct entity;
  288.     mmi_imps_room_struct *room = &imps_p->room_info.room_list[0];
  289.     /*----------------------------------------------------------------*/
  290.     /* Code Body                                                      */
  291.     /*----------------------------------------------------------------*/
  292.     AnsiiToUnicodeString((S8*) entity.sname, (S8*) "Joooo");
  293.     mmi_imps_chat_recv_msg((U16*) L"I am Max!!!", 0, &entity);
  294.     Category425BlinkTab(1);
  295. }
  296. /*****************************************************************************
  297.  * FUNCTION
  298.  *  mmi_imps_test_search_complete
  299.  * DESCRIPTION
  300.  *  
  301.  * PARAMETERS
  302.  *  void
  303.  * RETURNS
  304.  *  void
  305.  *****************************************************************************/
  306. void mmi_imps_test_search_complete(void)
  307. {
  308.     /*----------------------------------------------------------------*/
  309.     /* Local Variables                                                */
  310.     /*----------------------------------------------------------------*/
  311.     /*----------------------------------------------------------------*/
  312.     /* Code Body                                                      */
  313.     /*----------------------------------------------------------------*/
  314.     mmi_imps_entry_search_result();
  315.     DeleteUptoScrID(SCR_ID_IMPS_CONT_OPT);
  316. }
  317. /*****************************************************************************
  318.  * FUNCTION
  319.  *  mmi_imps_test_get_watch_list_complete
  320.  * DESCRIPTION
  321.  *  
  322.  * PARAMETERS
  323.  *  void
  324.  * RETURNS
  325.  *  void
  326.  *****************************************************************************/
  327. void mmi_imps_test_get_watch_list_complete(void)
  328. {
  329.     /*----------------------------------------------------------------*/
  330.     /* Local Variables                                                */
  331.     /*----------------------------------------------------------------*/
  332.     /*----------------------------------------------------------------*/
  333.     /* Code Body                                                      */
  334.     /*----------------------------------------------------------------*/
  335.     mmi_imps_pre_entry_watch_list(NULL);
  336.     mmi_imps_entry_watch_list();
  337.     DeleteScreenIfPresent(SCR_ID_IMPS_PROGRESS);
  338. }
  339. /*****************************************************************************
  340.  * FUNCTION
  341.  *  mmi_imps_test_invite_success
  342.  * DESCRIPTION
  343.  *  
  344.  * PARAMETERS
  345.  *  void
  346.  * RETURNS
  347.  *  void
  348.  *****************************************************************************/
  349. void mmi_imps_test_invite_success(void)
  350. {
  351.     /*----------------------------------------------------------------*/
  352.     /* Local Variables                                                */
  353.     /*----------------------------------------------------------------*/
  354.     /*----------------------------------------------------------------*/
  355.     /* Code Body                                                      */
  356.     /*----------------------------------------------------------------*/
  357.     mmi_imps_invite_start(0, 1);
  358. }
  359. /*****************************************************************************
  360.  * FUNCTION
  361.  *  mmi_imps_test_invite_failed
  362.  * DESCRIPTION
  363.  *  
  364.  * PARAMETERS
  365.  *  void
  366.  * RETURNS
  367.  *  void
  368.  *****************************************************************************/
  369. void mmi_imps_test_invite_failed(void)
  370. {
  371.     /*----------------------------------------------------------------*/
  372.     /* Local Variables                                                */
  373.     /*----------------------------------------------------------------*/
  374.     /*----------------------------------------------------------------*/
  375.     /* Code Body                                                      */
  376.     /*----------------------------------------------------------------*/
  377.     mmi_imps_invite_start(-1, 1);
  378. }
  379. /*****************************************************************************
  380.  * FUNCTION
  381.  *  mmi_imps_test_chat_key_hdlr
  382.  * DESCRIPTION
  383.  *  
  384.  * PARAMETERS
  385.  *  void
  386.  * RETURNS
  387.  *  void
  388.  *****************************************************************************/
  389. void mmi_imps_test_chat_key_hdlr(void)
  390. {
  391.     /*----------------------------------------------------------------*/
  392.     /* Local Variables                                                */
  393.     /*----------------------------------------------------------------*/
  394.     imps_entity_struct entity;
  395.     mmi_imps_room_struct *room = &imps_p->room_info.room_list[imps_p->chat_info.curr_room];
  396.     /*----------------------------------------------------------------*/
  397.     /* Code Body                                                      */
  398.     /*----------------------------------------------------------------*/
  399.     AnsiiToUnicodeString((S8*) entity.sname, (S8*) "Joooo");
  400.     mmi_imps_chat_recv_msg((U16*) L"I am Max!!!", imps_p->chat_info.curr_room, &entity);
  401.     UpdateCategory435LogText((U8*) room->chat_buff, pfnUnicodeStrlen((S8*) room->chat_buff));
  402. }
  403. /*****************************************************************************
  404.  * FUNCTION
  405.  *  mmi_imps_test_server_disconn
  406.  * DESCRIPTION
  407.  *  
  408.  * PARAMETERS
  409.  *  void
  410.  * RETURNS
  411.  *  void
  412.  *****************************************************************************/
  413. void mmi_imps_test_server_disconn(void)
  414. {
  415.     /*----------------------------------------------------------------*/
  416.     /* Local Variables                                                */
  417.     /*----------------------------------------------------------------*/
  418.     U16 scr_id = GetActiveScreenId();
  419.     BOOL cont_scr = IsScreenPresent(SCR_ID_IMPS_CONT);
  420.     BOOL chat_scr = IsScreenPresent(SCR_ID_IMPS_CHAT);
  421.     /*----------------------------------------------------------------*/
  422.     /* Code Body                                                      */
  423.     /*----------------------------------------------------------------*/
  424.     if (imps_p->gen_info.is_login == TRUE)
  425.     {
  426.         mmi_imps_util_disp_warning_popup(STR_ID_IMPS_SERVER_DISCONNECT);
  427.         /* check if the user is currently in IMPS application */
  428.         /* it's currently in IMPS application */
  429.         if (cont_scr || chat_scr || scr_id == SCR_ID_IMPS_CONT || scr_id == SCR_ID_IMPS_CHAT)
  430.         {
  431.             if (cont_scr)   /* in contact list screen */
  432.             {
  433.                 HistoryReplace(SCR_ID_IMPS_CONT, SCR_ID_IMPS_MAIN, mmi_imps_entry_main);
  434.             }
  435.             else    /* chat screen */
  436.             {
  437.                 DeleteUptoScrID(SCR_ID_IMPS_CHAT);
  438.                 HistoryReplace(SCR_ID_IMPS_CHAT, SCR_ID_IMPS_MAIN, mmi_imps_entry_main);
  439.             }
  440.             DeleteUptoScrID(SCR_ID_IMPS_MAIN);
  441.         }
  442.     }
  443.     mmi_imps_util_free_buff_when_logout();
  444.     mmi_imps_reset_cntx();
  445. }
  446. #endif /* IMPS_TEST_CODE */ 
  447. #define MAIN_IMPS
  448. /*****************************************************************************
  449.  * FUNCTION
  450.  *  mmi_imps_init_hilite_hdlr
  451.  * DESCRIPTION
  452.  *  Initialize all highlight handlers
  453.  * PARAMETERS
  454.  *  void
  455.  * RETURNS
  456.  *  void
  457.  *****************************************************************************/
  458. void mmi_imps_init_hilite_hdlr(void)
  459. {
  460.     /*----------------------------------------------------------------*/
  461.     /* Local Variables                                                */
  462.     /*----------------------------------------------------------------*/
  463.     /*----------------------------------------------------------------*/
  464.     /* Code Body                                                      */
  465.     /*----------------------------------------------------------------*/
  466.     SetHiliteHandler(MENU_ID_IMPS_LOGIN, mmi_imps_hilite_login);
  467.     /* about me */
  468.     SetHiliteHandler(MENU_ID_IMPS_CONT_ABOUT_ME, mmi_imps_hilite_about_me);
  469.     SetHiliteHandler(MENU_ID_IMPS_ABOUT_ME_FILE_OPT_SEL, mmi_imps_hilite_about_pic_sel);
  470.     SetHiliteHandler(MENU_ID_IMPS_ABOUT_ME_FILE_OPT_VIEW, mmi_imps_hilite_about_pic_view);
  471.     SetHiliteHandler(MENU_ID_IMPS_ABOUT_ME_FILE_OPT_DEL, mmi_imps_hilite_about_pic_del);
  472.     SetHiliteHandler(MENU_ID_IMPS_CONT_WATCHER_LIST, mmi_imps_hilite_get_watch_list);
  473.     SetHiliteHandler(MENU_ID_IMPS_CONT_SEND_MSG, mmi_imps_hilite_cont_send_msg);
  474.     SetHiliteHandler(MENU_ID_IMPS_CONT_DEL, mmi_imps_hilite_del_cont);
  475.     /* about friend */
  476.     SetHiliteHandler(MENU_ID_IMPS_CONT_ABOUT_FRIEND, mmi_imps_hilite_about_friend);
  477.     SetHiliteHandler(MENU_ID_IMPS_ABOUT_FRIEND_EDIT, mmi_imps_hilite_about_friend_edit);
  478.     SetHiliteHandler(MENU_ID_IMPS_ABOUT_FRIEND_REFRESH, mmi_imps_hilite_about_friend_refresh);
  479.     /* add contact */
  480.     SetHiliteHandler(MENU_ID_IMPS_CONT_ADD, mmi_imps_hilite_add_cont);
  481.     SetHiliteHandler(MENU_ID_IMPS_CONT_ADD_DIRECT, mmi_imps_hilite_add_direct);
  482.     SetHiliteHandler(MENU_ID_IMPS_SEARCH_DIRECT, mmi_imps_hilite_direct_search);
  483.     SetHiliteHandler(MENU_ID_IMPS_SEARCH_PHB, mmi_imps_hilite_search_from_phb);
  484.     SetHiliteHandler(MENU_ID_IMPS_CONT_ADD_NAME_OPT_DONE, mmi_imps_hilite_input_name_opt_done);
  485.     SetHiliteHandler(MENU_ID_IMPS_CONT_ADD_NAME_OPT_INPUT_METH, mmi_imps_hilite_comm_input_meth);
  486.     /* sort */
  487.     SetHiliteHandler(MENU_ID_IMPS_CONT_SORT, mmi_imps_hilite_sort);
  488.     SetHiliteHandler(MENU_ID_IMPS_SORT_BY_NAME, mmi_imps_hilite_sort_by_name);
  489.     SetHiliteHandler(MENU_ID_IMPS_SORT_BY_GROUP, mmi_imps_hilite_sort_by_group);
  490.     SetHiliteHandler(MENU_ID_IMPS_SORT_BY_STATUS, mmi_imps_hilite_sort_by_status);
  491.     SetHiliteHandler(MENU_ID_IMPS_CONT_MANAGE_GROUP, mmi_imps_hilite_manage_group);
  492.     SetHiliteHandler(MENU_ID_IMPS_CONT_BLOCK_GRANT, mmi_imps_hilite_block_grant);
  493.     SetHiliteHandler(MENU_ID_IMPS_CONT_CHAT_ROOMS, mmi_imps_hilite_chat_room);
  494.     SetHiliteHandler(MENU_ID_IMPS_CONT_LOGOUT, mmi_imps_hilite_logout);
  495.     /* chat */
  496.     SetHiliteHandler(MENU_ID_IMPS_CHAT_OPT_WRITE, mmi_imps_hilite_chat_write);
  497.     SetHiliteHandler(MENU_ID_IMPS_CHAT_OPT_SEND, mmi_imps_hilite_chat_send);
  498.     SetHiliteHandler(MENU_ID_IMPS_CHAT_OPT_INVITE, mmi_imps_hilite_chat_invite);
  499.     SetHiliteHandler(MENU_ID_IMPS_CHAT_OPT_INSERT_SYMBOL, mmi_imps_hilite_chat_insert_symbol);
  500.     SetHiliteHandler(MENU_ID_IMPS_CHAT_OPT_LIST_MEMBER, mmi_imps_hilite_chat_member);
  501.     SetHiliteHandler(MENU_ID_IMPS_CHAT_OPT_SAVE_TEXT, mmi_imps_hilite_chat_save);
  502.     SetHiliteHandler(MENU_ID_IMPS_CHAT_OPT_CLOSE, mmi_imps_hilite_chat_close);
  503.     SetHiliteHandler(MENU_ID_IMPS_CHAT_OPT_INPUT_METH, mmi_imps_hilite_comm_input_meth);
  504.     SetHiliteHandler(MENU_ID_IMPS_CHAT_OPT_SEND_DONE, mmi_imps_hilite_chat_send_done);
  505.     SetHiliteHandler(MENU_ID_IMPS_CHAT_SAVE_OPT_DONE, mmi_imps_hilite_chat_save_opt_done);
  506.     SetHiliteHandler(MENU_ID_IMPS_CHAT_SAVE_OPT_INPUT_METH, mmi_imps_hilite_comm_input_meth);
  507.     /* group */
  508.     SetHiliteHandler(MENU_ID_IMPS_GROUP_OPT_CREATE, mmi_imps_hilite_group_create);
  509.     SetHiliteHandler(MENU_ID_IMPS_GROUP_OPT_LIST_MEMBER, mmi_imps_hilite_group_list_member);
  510.     SetHiliteHandler(MENU_ID_IMPS_GROUP_OPT_EDIT, mmi_imps_hilite_group_edit);
  511.     SetHiliteHandler(MENU_ID_IMPS_GROUP_OPT_DELETE, mmi_imps_hilite_group_del);
  512.     /* chat room */
  513.     SetHiliteHandler(MENU_ID_IMPS_ROOM_OPT_JUMP_TO, mmi_imps_hilite_room_jump_to);
  514.     SetHiliteHandler(MENU_ID_IMPS_ROOM_OPT_CREATE, mmi_imps_hilite_room_open);
  515.     SetHiliteHandler(MENU_ID_IMPS_ROOM_OPT_SEARCH, mmi_imps_hilite_room_search);
  516.     SetHiliteHandler(MENU_ID_IMPS_ROOM_OPT_CLOSE, mmi_imps_hilite_room_close);
  517.     SetHiliteHandler(MENU_ID_IMPS_ROOM_OPT_JOIN, mmi_imps_hilite_room_join);
  518.     SetHiliteHandler(MENU_ID_IMPS_ROOM_INVITE_OPT_DONE, mmi_imps_hilite_invite_note_opt_done);
  519.     SetHiliteHandler(MENU_ID_IMPS_ROOM_INVITE_OPT_INPUT_METH, mmi_imps_hilite_comm_input_meth);
  520.     /* profile */
  521.     SetHiliteHandler(MENU_ID_IMPS_PROF, mmi_imps_hilite_prof);
  522.     SetHiliteHandler(MENU_ID_IMPS_PROF_ACTIVATE, mmi_imps_hilite_prof_activate);
  523.     SetHiliteHandler(MENU_ID_IMPS_PROF_EDIT, mmi_imps_hilite_prof_edit);
  524.     SetHiliteHandler(MENU_ID_IMPS_PROF_SETTING, mmi_imps_hilite_prof_setting);
  525.     SetHiliteHandler(MENU_ID_IMPS_PROF_CONN, mmi_imps_hilite_prof_conn);
  526.     SetHiliteHandler(MENU_ID_IMPS_PROF_EDITOR_OPT_DONE, mmi_imps_hilite_prof_done);
  527.     SetHiliteHandler(MENU_ID_IMPS_PROF_EDITOR_OPT_INPUT_METH, mmi_imps_hilite_comm_input_meth);
  528. #ifdef IMPS_FOR_OMA_ONLY
  529.     /* sbuscribe presence */
  530.     SetHiliteHandler(MENU_ID_IMPS_GROUP_OPT_BROADCAST, mmi_imps_hilite_group_broadcast);
  531.     SetHiliteHandler(MENU_ID_IMPS_CONT_SUBSCRIBE, mmi_imps_hilite_subscribe);
  532.     SetHiliteHandler(MENU_ID_IMPS_CONT_UNSUBSCRIBE, mmi_imps_hilite_unsubscribe);
  533. #endif /* IMPS_FOR_OMA_ONLY */ 
  534. }
  535. /*****************************************************************************
  536.  * FUNCTION
  537.  *  mmi_imps_init_icon_list
  538.  * DESCRIPTION
  539.  *  Initialize mood and invication icon mapping table
  540.  * PARAMETERS
  541.  *  void
  542.  * RETURNS
  543.  *  void
  544.  *****************************************************************************/
  545. void mmi_imps_init_icon_list(void)
  546. {
  547.     /*----------------------------------------------------------------*/
  548.     /* Local Variables                                                */
  549.     /*----------------------------------------------------------------*/
  550.     S32 i;
  551.     S32 width, height;
  552.     /*----------------------------------------------------------------*/
  553.     /* Code Body                                                      */
  554.     /*----------------------------------------------------------------*/
  555.     /* initialize mood table */
  556.     for (i = 0; i < IMPS_NUM_MOOD; i++)
  557.     {
  558.         /* file icons */
  559.         g_imps_mood_icon_list[i].icon = (PU8) GetImage((U16) (IMG_ID_IMPS_HAPPY + i));
  560.         /* measure height and width */
  561.         gui_measure_image(g_imps_mood_icon_list[i].icon, &width, &height);
  562.         g_imps_mood_icon_list[i].icon_height = (U8) height;
  563.         g_imps_mood_icon_list[i].icon_width = (U8) width;
  564.     }
  565.     /* initialize invite table */
  566.     for (i = 0; i < IMPS_NUM_INVITE; i++)
  567.     {
  568.         /* file icons */
  569.         g_imps_invite_icon_list[i].icon = (PU8) GetImage((U16) (IMG_ID_IMPS_CONT_LIST + i));
  570.         /* measure height and width */
  571.         gui_measure_image(g_imps_invite_icon_list[i].icon, &width, &height);
  572.         g_imps_invite_icon_list[i].icon_height = (U8) height;
  573.         g_imps_invite_icon_list[i].icon_width = (U8) width;
  574.     }
  575. }
  576. /*****************************************************************************
  577.  * FUNCTION
  578.  *  mmi_imps_hilite_main
  579.  * DESCRIPTION
  580.  *  Highlight handler of IMPS menu in Message screen
  581.  * PARAMETERS
  582.  *  void
  583.  * RETURNS
  584.  *  void
  585.  *****************************************************************************/
  586. void mmi_imps_hilite_main(void)
  587. {
  588.     /*----------------------------------------------------------------*/
  589.     /* Local Variables                                                */
  590.     /*----------------------------------------------------------------*/
  591.     /*----------------------------------------------------------------*/
  592.     /* Code Body                                                      */
  593.     /*----------------------------------------------------------------*/
  594.     SetLeftSoftkeyFunction(mmi_imps_pre_entry_main, KEY_EVENT_UP);
  595.     SetKeyHandler(mmi_imps_pre_entry_main, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  596. }
  597. /*****************************************************************************
  598.  * FUNCTION
  599.  *  mmi_imps_pre_entry_main
  600.  * DESCRIPTION
  601.  *  Pre-Entry function of Message -> Instant Message menu
  602.  * PARAMETERS
  603.  *  void
  604.  * RETURNS
  605.  *  void
  606.  *****************************************************************************/
  607. void mmi_imps_pre_entry_main(void)
  608. {
  609.     /*----------------------------------------------------------------*/
  610.     /* Local Variables                                                */
  611.     /*----------------------------------------------------------------*/
  612.     /*----------------------------------------------------------------*/
  613.     /* Code Body                                                      */
  614.     /*----------------------------------------------------------------*/
  615.     /* some action that is not finished */
  616.     if (imps_p->gen_info.curr_action == MSG_ID_MMI_IMPS_LOGIN_REQ)      /* login can be aborted */
  617.     {
  618.         mmi_imps_login_progress();
  619.         imps_p->gen_info.is_reentry = TRUE;
  620.     }
  621.     else if (imps_p->gen_info.curr_action != 0)
  622.     {
  623.         mmi_imps_display_progressing();
  624.         imps_p->gen_info.is_reentry = TRUE;
  625.     }
  626.     else if (imps_p->gen_info.is_login == TRUE)
  627.     {
  628.         mmi_imps_pre_entry_cont();
  629.     }
  630.     else
  631.     {
  632.         mmi_imps_entry_main();
  633.     }
  634. }
  635. /*****************************************************************************
  636.  * FUNCTION
  637.  *  mmi_imps_entry_main
  638.  * DESCRIPTION
  639.  *  Entry first screen of IMPS (login/profile setting)
  640.  * PARAMETERS
  641.  *  void
  642.  * RETURNS
  643.  *  void
  644.  *****************************************************************************/
  645. void mmi_imps_entry_main(void)
  646. {
  647.     /*----------------------------------------------------------------*/
  648.     /* Local Variables                                                */
  649.     /*----------------------------------------------------------------*/
  650.     U16 numItems;
  651.     U16 nStrItemList[2];    /* only Login and Profile Setting */
  652.     U8 *guiBuffer;
  653.     /*----------------------------------------------------------------*/
  654.     /* Code Body                                                      */
  655.     /*----------------------------------------------------------------*/
  656.     EntryNewScreen(SCR_ID_IMPS_MAIN, NULL, mmi_imps_entry_main, NULL);
  657.     guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_MAIN);
  658.     SetParentHandler(MENU_ID_IMPS_MAIN);
  659.     numItems = GetNumOfChild(MENU_ID_IMPS_MAIN);
  660.     GetSequenceStringIds(MENU_ID_IMPS_MAIN, nStrItemList);
  661.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  662.     ShowCategory52Screen(
  663.         STR_ID_IMPS,
  664.         GetRootTitleIcon(MENU_ID_IMPS_MAIN),
  665.         STR_GLOBAL_OK,
  666.         IMG_GLOBAL_OK,
  667.         STR_GLOBAL_BACK,
  668.         IMG_GLOBAL_BACK,
  669.         numItems,
  670.         nStrItemList,
  671.         (U16*) gIndexIconsImageList,
  672.         NULL,
  673.         0,
  674.         0,
  675.         guiBuffer);
  676.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  677.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  678. }
  679. /*****************************************************************************
  680.  * FUNCTION
  681.  *  mmi_imps_hilite_login
  682.  * DESCRIPTION
  683.  *  Highlight handler of IMPS -> Login
  684.  * PARAMETERS
  685.  *  void
  686.  * RETURNS
  687.  *  void
  688.  *****************************************************************************/
  689. void mmi_imps_hilite_login(void)
  690. {
  691.     /*----------------------------------------------------------------*/
  692.     /* Local Variables                                                */
  693.     /*----------------------------------------------------------------*/
  694.     /*----------------------------------------------------------------*/
  695.     /* Code Body                                                      */
  696.     /*----------------------------------------------------------------*/
  697.     SetLeftSoftkeyFunction(mmi_imps_entry_login, KEY_EVENT_UP);
  698. }
  699. /*****************************************************************************
  700.  * FUNCTION
  701.  *  mmi_imps_login_progress
  702.  * DESCRIPTION
  703.  *  Entry progressing screen for login
  704.  * PARAMETERS
  705.  *  void
  706.  * RETURNS
  707.  *  void
  708.  *****************************************************************************/
  709. void mmi_imps_login_progress(void)
  710. {
  711.     /*----------------------------------------------------------------*/
  712.     /* Local Variables                                                */
  713.     /*----------------------------------------------------------------*/
  714.     /*----------------------------------------------------------------*/
  715.     /* Code Body                                                      */
  716.     /*----------------------------------------------------------------*/
  717.     mmi_imps_pre_entry_progressing(
  718.         STR_ID_IMPS,
  719.         GetRootTitleIcon(MENU_ID_IMPS_MAIN),
  720.         0,
  721.         0,
  722.         STR_GLOBAL_ABORT,
  723.         0,
  724.         (U8*) GetString(STR_ID_IMPS_LOGIN),
  725.         NULL,
  726.         IMG_GLOBAL_PROGRESS,
  727.         NULL,
  728.         mmi_imps_login_abort,
  729.         mmi_imps_login_abort);
  730. }
  731. /*****************************************************************************
  732.  * FUNCTION
  733.  *  mmi_imps_auto_login
  734.  * DESCRIPTION
  735.  *  Auto login IMPS application
  736.  * PARAMETERS
  737.  *  void
  738.  * RETURNS
  739.  *  void
  740.  *****************************************************************************/
  741. void mmi_imps_auto_login(void)
  742. {
  743.     /*----------------------------------------------------------------*/
  744.     /* Local Variables                                                */
  745.     /*----------------------------------------------------------------*/
  746.     mmi_imps_prof_struct *act_prof = &imps_p->act_prof;
  747.     /*----------------------------------------------------------------*/
  748.     /* Code Body                                                      */
  749.     /*----------------------------------------------------------------*/
  750.     /* something still not ready */
  751.     if (imps_p->gen_info.ps_ready_state != IMPS_LOGIN_READY)
  752.     {
  753.         return;
  754.     }
  755.     if (pfnUnicodeStrlen((S8*) act_prof->prof_name) != 0)
  756.     {
  757.         if (act_prof->auto_login && act_prof->dt_acct >= mmi_dtcnt_get_first_account_id(DATA_ACCOUNT_BEARER_GPRS | DATA_ACCOUNT_BEARER_WIFI))
  758.         {
  759.             /* currently in IMPS related menus */
  760.             if (GetActiveScreenId() == SCR_ID_IMPS_MAIN || IsScreenPresent(SCR_ID_IMPS_MAIN))
  761.             {
  762.                 mmi_imps_entry_auto_login_confirm();
  763.             }
  764.             else    /* in other application menu */
  765.             {
  766.                 /* display auto-login screen and send request to PS */
  767.                 mmi_imps_entry_auto_login();
  768.                 mmi_imps_ps_login_req();
  769.             }
  770.         }
  771.         imps_p->gen_info.ps_ready_state |= IMPS_LOGIN_ALREADY;  /* set this value to prevent lots of auto-login */
  772.     }
  773. }
  774. /*****************************************************************************
  775.  * FUNCTION
  776.  *  mmi_imps_entry_auto_login
  777.  * DESCRIPTION
  778.  *  Display auto-login screen
  779.  * PARAMETERS
  780.  *  void
  781.  * RETURNS
  782.  *  void
  783.  *****************************************************************************/
  784. void mmi_imps_entry_auto_login(void)
  785. {
  786.     /*----------------------------------------------------------------*/
  787.     /* Local Variables                                                */
  788.     /*----------------------------------------------------------------*/
  789.     /*----------------------------------------------------------------*/
  790.     /* Code Body                                                      */
  791.     /*----------------------------------------------------------------*/
  792.     /* currently in IMPS main menu */
  793.     if (GetActiveScreenId() == SCR_ID_IMPS_MAIN)
  794.     {
  795.         mmi_imps_login_progress();
  796.     }
  797.     else    /* main menu is in history */
  798.     {
  799.         HistoryReplace(SCR_ID_IMPS_MAIN, SCR_ID_IMPS_PROGRESS, mmi_imps_login_progress);
  800.     }
  801. }
  802. /*****************************************************************************
  803.  * FUNCTION
  804.  *  mmi_imps_entry_auto_login_confirm
  805.  * DESCRIPTION
  806.  *  Display confirmation screen to auto-login
  807.  * PARAMETERS
  808.  *  void
  809.  * RETURNS
  810.  *  void
  811.  *****************************************************************************/
  812. void mmi_imps_entry_auto_login_confirm(void)
  813. {
  814.     /*----------------------------------------------------------------*/
  815.     /* Local Variables                                                */
  816.     /*----------------------------------------------------------------*/
  817.     /*----------------------------------------------------------------*/
  818.     /* Code Body                                                      */
  819.     /*----------------------------------------------------------------*/
  820.     mmi_imps_entry_confirm(STR_ID_IMPS_LOGIN, mmi_imps_auto_login_yes, GoBackHistory);
  821. }
  822. /*****************************************************************************
  823.  * FUNCTION
  824.  *  mmi_imps_auto_login_yes
  825.  * DESCRIPTION
  826.  *  Confirm to proceed login process
  827.  * PARAMETERS
  828.  *  void
  829.  * RETURNS
  830.  *  void
  831.  *****************************************************************************/
  832. void mmi_imps_auto_login_yes(void)
  833. {
  834.     /*----------------------------------------------------------------*/
  835.     /* Local Variables                                                */
  836.     /*----------------------------------------------------------------*/
  837.     /*----------------------------------------------------------------*/
  838.     /* Code Body                                                      */
  839.     /*----------------------------------------------------------------*/
  840.     /* display auto-login screen and send request to PS */
  841.     mmi_imps_login_progress();
  842.     mmi_imps_ps_login_req();
  843.     DeleteUptoScrID(SCR_ID_IMPS_MAIN);
  844. }
  845. /*****************************************************************************
  846.  * FUNCTION
  847.  *  mmi_imps_entry_login
  848.  * DESCRIPTION
  849.  *  Pre-Entry function of Login
  850.  * PARAMETERS
  851.  *  void
  852.  * RETURNS
  853.  *  void
  854.  *****************************************************************************/
  855. void mmi_imps_entry_login(void)
  856. {
  857.     /*----------------------------------------------------------------*/
  858.     /* Local Variables                                                */
  859.     /*----------------------------------------------------------------*/
  860.     /*----------------------------------------------------------------*/
  861.     /* Code Body                                                      */
  862.     /*----------------------------------------------------------------*/
  863.     if (pfnUnicodeStrlen((S8*) imps_p->act_prof.prof_name) == 0)
  864.     {
  865.         mmi_imps_util_disp_err_popup(STR_ID_IMPS_PROF_NO_CONFIG);
  866.     }
  867. #ifdef IMPS_TEST_CODE
  868.     else
  869.     {
  870.         mmi_imps_login_progress();
  871.         SetKeyHandler(mmi_imps_test_login_complete, KEY_SEND, KEY_EVENT_UP);
  872.     }
  873. #else /* IMPS_TEST_CODE */ 
  874.     else if (imps_p->gen_info.ps_ready_state >= IMPS_LOGIN_READY)
  875.     {
  876.         /* send request to login */
  877.         mmi_imps_login_progress();
  878.         mmi_imps_ps_login_req();
  879.         imps_p->gen_info.ps_ready_state |= IMPS_LOGIN_ALREADY;  /* set this value to prevent lots of auto-login */
  880.     }
  881.     else
  882.     {
  883.         mmi_imps_util_disp_warning_popup(STR_ID_IMPS_NOT_READY);
  884.     }
  885. #endif /* IMPS_TEST_CODE */ 
  886. }
  887. /*****************************************************************************
  888.  * FUNCTION
  889.  *  mmi_imps_login_abort
  890.  * DESCRIPTION
  891.  *  Abort login process
  892.  * PARAMETERS
  893.  *  void
  894.  * RETURNS
  895.  *  void
  896.  *****************************************************************************/
  897. void mmi_imps_login_abort(void)
  898. {
  899.     /*----------------------------------------------------------------*/
  900.     /* Local Variables                                                */
  901.     /*----------------------------------------------------------------*/
  902.     /*----------------------------------------------------------------*/
  903.     /* Code Body                                                      */
  904.     /*----------------------------------------------------------------*/
  905.     mmi_imps_entry_abort();
  906. #ifdef IMPS_TEST_CODE
  907.     SetKeyHandler(mmi_imps_login_abort_finish, KEY_SEND, KEY_EVENT_DOWN);
  908. #else /* IMPS_TEST_CODE */ 
  909.     /* send abort request to PS */
  910.     mmi_imps_ps_abort_login_req();
  911. #endif /* IMPS_TEST_CODE */ 
  912. }
  913. /*****************************************************************************
  914.  * FUNCTION
  915.  *  mmi_imps_login_abort_finish
  916.  * DESCRIPTION
  917.  *  Finish aborting process
  918.  * PARAMETERS
  919.  *  void
  920.  *  result(?)       [IN]        Result of aborting
  921.  * RETURNS
  922.  *  void
  923.  *****************************************************************************/
  924. void mmi_imps_login_abort_finish(void)
  925. {
  926.     /*----------------------------------------------------------------*/
  927.     /* Local Variables                                                */
  928.     /*----------------------------------------------------------------*/
  929.     /*----------------------------------------------------------------*/
  930.     /* Code Body                                                      */
  931.     /*----------------------------------------------------------------*/
  932.     if (IsScreenPresent(SCR_ID_IMPS_MAIN))
  933.     {
  934.         if (GetActiveScreenId() == SCR_ID_IMPS_PROGRESS)
  935.         {
  936.             GoBackToHistory(SCR_ID_IMPS_MAIN);
  937.         }
  938.         else
  939.         {
  940.             DeleteScreenIfPresent(SCR_ID_IMPS_PROGRESS);
  941.         }
  942.     }
  943.     else    /* auto-update case */
  944.     {
  945.         if (GetActiveScreenId() == SCR_ID_IMPS_PROGRESS)
  946.         {
  947.             mmi_imps_entry_main();
  948.             DeleteScreenIfPresent(SCR_ID_IMPS_PROGRESS);
  949.         }
  950.     }
  951. }
  952. /*****************************************************************************
  953.  * FUNCTION
  954.  *  mmi_imps_re_entry_app
  955.  * DESCRIPTION
  956.  *  Re-Entry IMPS application after progressing finished
  957.  * PARAMETERS
  958.  *  void
  959.  *  result(?)       [IN]        Result of aborting
  960.  * RETURNS
  961.  *  void
  962.  *****************************************************************************/
  963. void mmi_imps_re_entry_app(void)
  964. {
  965.     /*----------------------------------------------------------------*/
  966.     /* Local Variables                                                */
  967.     /*----------------------------------------------------------------*/
  968.     /*----------------------------------------------------------------*/
  969.     /* Code Body                                                      */
  970.     /*----------------------------------------------------------------*/
  971.     if (GetActiveScreenId() == SCR_ID_IMPS_PROGRESS)
  972.     {
  973.         if (imps_p->gen_info.is_login)
  974.         {
  975.             mmi_imps_pre_entry_cont();
  976.         }
  977.         else
  978.         {
  979.             mmi_imps_entry_main();
  980.         }
  981.         DeleteScreenIfPresent(SCR_ID_IMPS_PROGRESS);
  982.     }
  983.     else    /* some interrupt came */
  984.     {
  985.         if (imps_p->gen_info.is_login)
  986.         {
  987.             HistoryReplace(SCR_ID_IMPS_PROGRESS, SCR_ID_IMPS_CONT, mmi_imps_pre_entry_cont);
  988.         }
  989.         else
  990.         {
  991.             HistoryReplace(SCR_ID_IMPS_PROGRESS, SCR_ID_IMPS_MAIN, mmi_imps_entry_main);
  992.         }
  993.     }
  994.     imps_p->gen_info.is_reentry = FALSE;
  995. }
  996. #define CONT_IMPS
  997. /*****************************************************************************
  998.  * FUNCTION
  999.  *  mmi_imps_pre_entry_cont
  1000.  * DESCRIPTION
  1001.  *  Pre-Entry function of contact list
  1002.  * PARAMETERS
  1003.  *  void
  1004.  * RETURNS
  1005.  *  void
  1006.  *****************************************************************************/
  1007. void mmi_imps_pre_entry_cont(void)
  1008. {
  1009.     /*----------------------------------------------------------------*/
  1010.     /* Local Variables                                                */
  1011.     /*----------------------------------------------------------------*/
  1012.     /*----------------------------------------------------------------*/
  1013.     /* Code Body                                                      */
  1014.     /*----------------------------------------------------------------*/
  1015.     memset((void*)subMenuData[0], 0, MAX_SUB_MENU_SIZE);
  1016.     AnsiiNToUnicodeString((S8*) subMenuData[0], (S8*) imps_p->cont_info.cont_list[0].id, MAX_SUBMENU_CHARACTERS);
  1017.     strcpy((S8*) imps_p->cont_info.cont_list[0].group_id, (S8*) "MySelf");
  1018.     mmi_imps_sort_list();
  1019.     imps_p->gen_info.curr_tab = 0;
  1020.     mmi_imps_entry_cont();
  1021.     DeleteScreenIfPresent(SCR_ID_IMPS_CHAT);
  1022.     mmi_imps_check_pending_invite();
  1023. }
  1024. /*****************************************************************************
  1025.  * FUNCTION
  1026.  *  mmi_imps_cont_get_items
  1027.  * DESCRIPTION
  1028.  *  Fill items of contact list into UI buffers
  1029.  * PARAMETERS
  1030.  *  start_index     [IN]        Start index of item to be retrieved
  1031.  *  menu_data       [IN]        Address of menu data
  1032.  *  data_size       [IN]        Maximal number of menu items can be put in the buffer
  1033.  * RETURNS
  1034.  *  void
  1035.  *****************************************************************************/
  1036. S32 mmi_imps_cont_get_items(S32 start_index, gui_iconlist_menu_item *menu_data, S32 data_size)
  1037. {
  1038.     /*----------------------------------------------------------------*/
  1039.     /* Local Variables                                                */
  1040.     /*----------------------------------------------------------------*/
  1041.     S32 i, j;
  1042.     S32 count = (S32) imps_p->cont_info.no_cont;
  1043.     mmi_imps_cont_struct *cont;
  1044.     gui_iconlist_menu_item *item = menu_data;
  1045.     mmi_imps_group_struct *group;
  1046.     /*----------------------------------------------------------------*/
  1047.     /* Code Body                                                      */
  1048.     /*----------------------------------------------------------------*/
  1049.     for (i = 0, j = (i + start_index); i < data_size && j < count; i++, j++)
  1050.     {
  1051.         cont = &imps_p->cont_info.cont_list[j];
  1052.         if (cont->availability == IMPS_PA_USER_UNKNOWN)
  1053.         {
  1054.             item->image_list[0] = (PU8) GetImage(IMG_ID_IMPS_REFRESH);
  1055.         }
  1056.         else
  1057.         {
  1058.             item->image_list[0] = (PU8) GetImage((U16) (cont->availability + IMG_ID_IMPS_ONLINE));
  1059.         }
  1060.         if (cont->comm_state & IMPS_CONT_NEW_MSG)
  1061.         {
  1062.             item->image_list[1] = (PU8) GetImage(IMG_ID_IMPS_MESSAGE);
  1063.         }
  1064.         else
  1065.         {
  1066.             item->image_list[1] = NULL;
  1067.         }
  1068.         if (cont->comm_state & IMPS_CONT_BLOCK)
  1069.         {
  1070.             item->image_list[2] = (PU8) GetImage(IMG_ID_IMPS_BLOCK);
  1071.         }
  1072.         else
  1073.         {
  1074.             item->image_list[2] = NULL;
  1075.         }
  1076.         if (pfnUnicodeStrlen((S8*) cont->nick_name) == 0)
  1077.         {
  1078.             mmi_imps_util_ansi_2_ucs2_menu((S8*) cont->id, (S8*) item->item_list[0], MAX_SUBMENU_CHARACTERS);
  1079.         }
  1080.         else
  1081.         {
  1082.             mmi_imps_util_copy_with_dot((S8*) cont->nick_name, (S8*) item->item_list[0], MAX_SUBMENU_CHARACTERS);
  1083.         }
  1084.         if (j == 0)
  1085.         {
  1086.             pfnUnicodeStrcpy((S8*) item->item_list[1], (S8*) GetString(STR_ID_IMPS_MYSELF));
  1087.         }
  1088.         else
  1089.         {
  1090.             S32 k;
  1091.             /* find the group that contact belongs to */
  1092.             for (k = 0; k < IMPS_MAX_NO_GROUP; k++)
  1093.             {
  1094.                 group = &imps_p->group_info.group_list[k];
  1095.                 if (strcmp((S8*) group->group_id, (S8*) cont->group_id) == 0)
  1096.                 {
  1097.                     if (pfnUnicodeStrlen((S8*) group->group_name))
  1098.                     {
  1099.                         mmi_imps_util_copy_with_dot(
  1100.                             (S8*) group->group_name,
  1101.                             (S8*) item->item_list[1],
  1102.                             MAX_SUBMENU_CHARACTERS);
  1103.                     }
  1104.                     else
  1105.                     {
  1106.                         mmi_imps_util_ansi_2_ucs2_menu(
  1107.                             (S8*) cont->group_id,
  1108.                             (S8*) item->item_list[1],
  1109.                             MAX_SUBMENU_CHARACTERS);
  1110.                     }
  1111.                 }
  1112.             }
  1113.         }
  1114.         item++;
  1115.     }
  1116.     return i;
  1117. }
  1118. /*****************************************************************************
  1119.  * FUNCTION
  1120.  *  mmi_imps_cont_get_hints
  1121.  * DESCRIPTION
  1122.  *  Fill items of hint list into UI buffers. Currently, it's no use.
  1123.  * PARAMETERS
  1124.  *  start_index     [IN]        Start index of item to be retrieved
  1125.  *  hint_array      [IN]        Buffer to strore list of hints
  1126.  * RETURNS
  1127.  *  void
  1128.  *****************************************************************************/
  1129. S32 mmi_imps_cont_get_hints(S32 start_index, UI_string_type *hint_array)
  1130. {
  1131.     /*----------------------------------------------------------------*/
  1132.     /* Local Variables                                                */
  1133.     /*----------------------------------------------------------------*/
  1134.     /*----------------------------------------------------------------*/
  1135.     /* Code Body                                                      */
  1136.     /*----------------------------------------------------------------*/
  1137.     return 0;
  1138. }
  1139. /*****************************************************************************
  1140.  * FUNCTION
  1141.  *  mmi_imps_entry_cont
  1142.  * DESCRIPTION
  1143.  *  Entry main screen of IMPS (contact list and chatting screen)
  1144.  * PARAMETERS
  1145.  *  void
  1146.  * RETURNS
  1147.  *  void
  1148.  *****************************************************************************/
  1149. void mmi_imps_entry_cont(void)
  1150. {
  1151.     /*----------------------------------------------------------------*/
  1152.     /* Local Variables                                                */
  1153.     /*----------------------------------------------------------------*/
  1154.     U8 *guiBuffer;
  1155.     BOOL list_is_ready_p;
  1156.     /*----------------------------------------------------------------*/
  1157.     /* Code Body                                                      */
  1158.     /*----------------------------------------------------------------*/
  1159.     EntryNewScreen(SCR_ID_IMPS_CONT, NULL, mmi_imps_pre_entry_cont, NULL);
  1160.     guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_CONT);
  1161.     if (imps_p->cont_info.clear_gui_buff)
  1162.     {
  1163.         guiBuffer = NULL;
  1164.         imps_p->cont_info.clear_gui_buff = FALSE;
  1165.     }
  1166.     SetParentHandler(0);
  1167.     RegisterHighlightHandler(mmi_imps_hilite_contact);
  1168.     mmi_imps_tab_init();
  1169.     ShowCategory425Screen(
  1170.         (UI_string_type) GetString(STR_ID_IMPS_CONT_LIST),
  1171.         STR_GLOBAL_OPTIONS,
  1172.         IMG_GLOBAL_OPTIONS,
  1173.         STR_GLOBAL_BACK,
  1174.         IMG_GLOBAL_BACK,
  1175.         (S8) imps_p->gen_info.no_tab,
  1176.         (S8) imps_p->gen_info.curr_tab,
  1177.         MMI_tab_bar_items,
  1178.         (S32) imps_p->cont_info.no_cont,
  1179.         mmi_imps_cont_get_items,
  1180.         mmi_imps_cont_get_hints,
  1181.         (PU8) GetImage(IMG_ID_IMPS_ONLINE),
  1182.         (PU8) GetImage(IMG_ID_IMPS_MESSAGE),
  1183.         0,
  1184.         guiBuffer,
  1185.         &list_is_ready_p);
  1186.     SetCategory425TabSelectCallback(mmi_imps_tab_jump);
  1187.     /* set/reset all blinking/unblinking status */
  1188.     mmi_imps_util_blink_tab();
  1189.     SetLeftSoftkeyFunction(mmi_imps_entry_cont_opt, KEY_EVENT_UP);
  1190.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1191.     SetKeyHandler(mmi_imps_tab_prev, KEY_LEFT_ARROW, KEY_EVENT_DOWN);   /* move to previous tab */
  1192.     SetKeyHandler(mmi_imps_tab_next, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);  /* move to next tab */
  1193. }
  1194. /*****************************************************************************
  1195.  * FUNCTION
  1196.  *  mmi_imps_cont_reset_msg_icon
  1197.  * DESCRIPTION
  1198.  *  Reset status icon of current highlighted chat room.
  1199.  * PARAMETERS
  1200.  *  void
  1201.  * RETURNS
  1202.  *  void
  1203.  *****************************************************************************/
  1204. void mmi_imps_cont_reset_msg_icon(void)
  1205. {
  1206.     /*----------------------------------------------------------------*/
  1207.     /* Local Variables                                                */
  1208.     /*----------------------------------------------------------------*/
  1209.     S32 i;
  1210.     mmi_imps_room_struct *room = &imps_p->room_info.room_list[imps_p->chat_info.curr_room];
  1211.     /*----------------------------------------------------------------*/
  1212.     /* Code Body                                                      */
  1213.     /*----------------------------------------------------------------*/
  1214.     /* only apply to single talk, for group chat, the status of contact list does not affect */
  1215.     if (room->type == IMPS_ROOM_TYPE_SINGLE)
  1216.     {
  1217.         /* start from the first contact except myself */
  1218.         for (i = 1; i < imps_p->cont_info.no_cont; i++)
  1219.         {
  1220.             if (mmi_imps_util_is_id_same((S8*) room->member[0].id, (S8*) imps_p->cont_info.cont_list[i].id))
  1221.             {
  1222.                 /* contact list found, unset new message state */
  1223.                 imps_p->cont_info.cont_list[i].comm_state &= ~IMPS_CONT_NEW_MSG;
  1224.                 mmi_imps_cont_redraw_list();
  1225.                 break;
  1226.             }
  1227.         }
  1228.     }
  1229. }
  1230. /*****************************************************************************
  1231.  * FUNCTION
  1232.  *  mmi_imps_hilite_contact
  1233.  * DESCRIPTION
  1234.  *  Highlight handler of contact list
  1235.  * PARAMETERS
  1236.  *  index       [IN]        
  1237.  * RETURNS
  1238.  *  void
  1239.  *****************************************************************************/
  1240. void mmi_imps_hilite_contact(S32 index)
  1241. {
  1242.     /*----------------------------------------------------------------*/
  1243.     /* Local Variables                                                */
  1244.     /*----------------------------------------------------------------*/
  1245.     /*----------------------------------------------------------------*/
  1246.     /* Code Body                                                      */
  1247.     /*----------------------------------------------------------------*/
  1248.     imps_p->cont_info.curr_cont = (U8) index;
  1249.     if (index > 0)
  1250.     {
  1251.         SetKeyHandler(mmi_imps_pre_entry_chat, KEY_SEND, KEY_EVENT_DOWN);
  1252.     }
  1253.     else
  1254.     {
  1255.         ClearKeyHandler(KEY_SEND, KEY_EVENT_DOWN);
  1256.     }
  1257. }
  1258. /*****************************************************************************
  1259.  * FUNCTION
  1260.  *  mmi_imps_entry_cont_opt
  1261.  * DESCRIPTION
  1262.  *  Display option screen for contact list
  1263.  * PARAMETERS
  1264.  *  void
  1265.  * RETURNS
  1266.  *  void
  1267.  *****************************************************************************/
  1268. void mmi_imps_entry_cont_opt(void)
  1269. {
  1270.     /*----------------------------------------------------------------*/
  1271.     /* Local Variables                                                */
  1272.     /*----------------------------------------------------------------*/
  1273.     U16 numItems;
  1274.     U16 nStrItemList[16];   /* Activate and Edit */
  1275.     U8 *guiBuffer;
  1276.     U16 menu_id;
  1277.     U8 is_cont_blocked = FALSE;
  1278.     S32 i;
  1279.     /*----------------------------------------------------------------*/
  1280.     /* Code Body                                                      */
  1281.     /*----------------------------------------------------------------*/
  1282.     if (imps_p->cont_info.curr_cont == 0)
  1283.     {
  1284.         menu_id = MENU_ID_IMPS_CONT_MY_OPT;
  1285.     }
  1286.     else
  1287.     {
  1288.         menu_id = MENU_ID_IMPS_CONT_USER_OPT;   /* MENU_ID_IMPS_CONT_CHAT_OPT */
  1289.         if (imps_p->cont_info.cont_list[imps_p->cont_info.curr_cont].comm_state & IMPS_CONT_BLOCK)
  1290.         {
  1291.             is_cont_blocked = TRUE;
  1292.         }
  1293.     }
  1294.     EntryNewScreen(SCR_ID_IMPS_CONT_OPT, NULL, mmi_imps_entry_cont_opt, NULL);
  1295.     guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_CONT_OPT);
  1296.     SetParentHandler(menu_id);
  1297.     numItems = GetNumOfChild(menu_id);
  1298.     GetSequenceStringIds(menu_id, nStrItemList);
  1299.     /* switch between Block and Grant */
  1300.     if (is_cont_blocked)
  1301.     {
  1302.         for (i = 0; i < numItems; i++)
  1303.         {
  1304.             if (nStrItemList[i] == STR_ID_IMPS_BLOCK_CONTACT)
  1305.             {
  1306.                 nStrItemList[i] = STR_ID_IMPS_GRANT_CONTACT;
  1307.                 break;
  1308.             }
  1309.         }
  1310.     }
  1311.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  1312.     ShowCategory52Screen(
  1313.         STR_GLOBAL_OPTIONS,
  1314.         GetRootTitleIcon(MENU_ID_IMPS_MAIN),
  1315.         STR_GLOBAL_OK,
  1316.         IMG_GLOBAL_OK,
  1317.         STR_GLOBAL_BACK,
  1318.         IMG_GLOBAL_BACK,
  1319.         numItems,
  1320.         nStrItemList,
  1321.         (U16*) gIndexIconsImageList,
  1322.         NULL,
  1323.         0,
  1324.         0,
  1325.         guiBuffer);
  1326.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1327.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1328. }
  1329. /*****************************************************************************
  1330.  * FUNCTION
  1331.  *  mmi_imps_cont_redraw_list
  1332.  * DESCRIPTION
  1333.  *  Redraw contact list when changed.
  1334.  * PARAMETERS
  1335.  *  void
  1336.  * RETURNS
  1337.  *  void
  1338.  *****************************************************************************/
  1339. void mmi_imps_cont_redraw_list(void)
  1340. {
  1341.     /*----------------------------------------------------------------*/
  1342.     /* Local Variables                                                */
  1343.     /*----------------------------------------------------------------*/
  1344.     /*----------------------------------------------------------------*/
  1345.     /* Code Body                                                      */
  1346.     /*----------------------------------------------------------------*/
  1347.     /* force to redraw contact list */
  1348.     if (GetActiveScreenId() == SCR_ID_IMPS_CONT)
  1349.     {
  1350.         RefreshCategory425Screen(imps_p->cont_info.no_cont, imps_p->cont_info.curr_cont);
  1351.     }
  1352.     else
  1353.     {
  1354.         imps_p->cont_info.clear_gui_buff = TRUE;
  1355.     }
  1356. }
  1357. /*****************************************************************************
  1358.  * FUNCTION
  1359.  *  mmi_imps_cont_update_when_msg_come
  1360.  * DESCRIPTION
  1361.  *  Update status of contact when new message comes
  1362.  * PARAMETERS
  1363.  *  entity      [IN]        Entity to be redraw
  1364.  * RETURNS
  1365.  *  void
  1366.  *****************************************************************************/
  1367. void mmi_imps_cont_update_when_msg_come(imps_entity_struct *entity)
  1368. {
  1369.     /*----------------------------------------------------------------*/
  1370.     /* Local Variables                                                */
  1371.     /*----------------------------------------------------------------*/
  1372.     S32 i;
  1373.     S32 count = (S32) imps_p->cont_info.no_cont;
  1374.     /*----------------------------------------------------------------*/
  1375.     /* Code Body                                                      */
  1376.     /*----------------------------------------------------------------*/
  1377.     if (entity == NULL)
  1378.     {
  1379.         return;
  1380.     }
  1381.     for (i = 1; i < count; i++)
  1382.     {
  1383.         mmi_imps_cont_struct *cont = &imps_p->cont_info.cont_list[i];
  1384.         if (mmi_imps_util_is_id_same((S8*) cont->id, (S8*) entity->id))       /* found contact */
  1385.         {
  1386.             cont->comm_state |= IMPS_CONT_NEW_MSG;
  1387.             mmi_imps_cont_redraw_list();
  1388.             break;
  1389.         }
  1390.     }
  1391. }
  1392. #define DEL_CONT_IMPS
  1393. /*****************************************************************************
  1394.  * FUNCTION
  1395.  *  mmi_imps_hilite_del_cont
  1396.  * DESCRIPTION
  1397.  *  Highlight handler of Delete Contact option
  1398.  * PARAMETERS
  1399.  *  void
  1400.  * RETURNS
  1401.  *  void
  1402.  *****************************************************************************/
  1403. void mmi_imps_hilite_del_cont(void)
  1404. {
  1405.     /*----------------------------------------------------------------*/
  1406.     /* Local Variables                                                */
  1407.     /*----------------------------------------------------------------*/
  1408.     /*----------------------------------------------------------------*/
  1409.     /* Code Body                                                      */
  1410.     /*----------------------------------------------------------------*/
  1411.     SetLeftSoftkeyFunction(mmi_imps_entry_del_cont_confirm, KEY_EVENT_UP);
  1412. }
  1413. /*****************************************************************************
  1414.  * FUNCTION
  1415.  *  mmi_imps_entry_del_cont_confirm
  1416.  * DESCRIPTION
  1417.  *  Display confirmation screen for deleting a contact
  1418.  * PARAMETERS
  1419.  *  void
  1420.  * RETURNS
  1421.  *  void
  1422.  *****************************************************************************/
  1423. void mmi_imps_entry_del_cont_confirm(void)
  1424. {
  1425.     /*----------------------------------------------------------------*/
  1426.     /* Local Variables                                                */
  1427.     /*----------------------------------------------------------------*/
  1428.     /*----------------------------------------------------------------*/
  1429.     /* Code Body                                                      */
  1430.     /*----------------------------------------------------------------*/
  1431.     if (!imps_p->gen_info.auto_update_done)
  1432.     {
  1433.         mmi_imps_util_disp_warning_popup(STR_ID_IMPS_ERR_CONT_NOT_READY);
  1434.         return;
  1435.     }
  1436.     mmi_imps_entry_confirm(STR_GLOBAL_DELETE, mmi_imps_del_cont, GoBackHistory);
  1437. }
  1438. /*****************************************************************************
  1439.  * FUNCTION
  1440.  *  mmi_imps_del_cont
  1441.  * DESCRIPTION
  1442.  *  Proceed deleting a contact
  1443.  * PARAMETERS
  1444.  *  void
  1445.  * RETURNS
  1446.  *  void
  1447.  *****************************************************************************/
  1448. void mmi_imps_del_cont(void)
  1449. {
  1450.     /*----------------------------------------------------------------*/
  1451.     /* Local Variables                                                */
  1452.     /*----------------------------------------------------------------*/
  1453.     /*----------------------------------------------------------------*/
  1454.     /* Code Body                                                      */
  1455.     /*----------------------------------------------------------------*/
  1456.     /* display progressing screen */
  1457.     mmi_imps_display_progressing();
  1458.     /* delete remote part */
  1459. #ifdef IMPS_TEST_CODE
  1460.     mmi_imps_del_cont_finished(0);
  1461. #else 
  1462.     mmi_imps_ps_del_cont_req();
  1463. #endif 
  1464. }
  1465. /*****************************************************************************
  1466.  * FUNCTION
  1467.  *  mmi_imps_del_cont_finished
  1468.  * DESCRIPTION
  1469.  *  Callback function when protocol finishes deleting process.
  1470.  * PARAMETERS
  1471.  *  result      [IN]        
  1472.  * RETURNS
  1473.  *  void
  1474.  *****************************************************************************/
  1475. void mmi_imps_del_cont_finished(S32 result)
  1476. {
  1477.     /*----------------------------------------------------------------*/
  1478.     /* Local Variables                                                */
  1479.     /*----------------------------------------------------------------*/
  1480.     /*----------------------------------------------------------------*/
  1481.     /* Code Body                                                      */
  1482.     /*----------------------------------------------------------------*/
  1483.     if (result == 0 /* IMPS_OK */ )
  1484.     {
  1485.         S32 i = (S32) imps_p->cont_info.curr_cont;
  1486.         S32 count = (S32) imps_p->cont_info.no_cont;
  1487.         S32 j;
  1488.         /* decrease counter in group by 1 */
  1489.         for (j = 0; j < IMPS_MAX_NO_GROUP; j++)
  1490.         {
  1491.             if (mmi_imps_util_is_id_same
  1492.                 ((S8*) imps_p->group_info.group_list[j].group_id, (S8*) imps_p->cont_info.cont_list[i].group_id))
  1493.             {
  1494.                 imps_p->group_info.group_list[j].no_users--;
  1495.             }
  1496.         }
  1497.         /* remove contact list from file and context */
  1498.         if (i < (IMPS_MAX_NO_CONT - 1))
  1499.         {
  1500.             memcpy(
  1501.                 &imps_p->cont_info.cont_list[i],
  1502.                 &imps_p->cont_info.cont_list[i + 1],
  1503.                 (count - i - 1) * sizeof(mmi_imps_cont_struct));
  1504.             memset(&imps_p->cont_info.cont_list[count - 1], 0, sizeof(mmi_imps_cont_struct));
  1505.         }
  1506.         else
  1507.         {
  1508.             memset(&imps_p->cont_info.cont_list[i], 0, sizeof(mmi_imps_cont_struct));
  1509.         }
  1510.         imps_p->cont_info.no_cont--;
  1511.         mmi_imps_util_write_cont();
  1512.         mmi_imps_util_disp_popup_done();
  1513.         if (imps_p->gen_info.is_reentry)
  1514.         {
  1515.             mmi_imps_re_entry_app();
  1516.         }
  1517.         else
  1518.         {
  1519.             mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_CONT);     /* delete screen between contact list and progressing screen */
  1520.         }
  1521.         /* clear GUI buffer to make the list refreshed */
  1522.         imps_p->cont_info.clear_gui_buff = TRUE;
  1523.     }
  1524.     else
  1525.     {
  1526.         mmi_imps_util_disp_err_popup(mmi_imps_util_get_err_str(result));
  1527.         if (imps_p->gen_info.is_reentry)
  1528.         {
  1529.             mmi_imps_re_entry_app();
  1530.         }
  1531.         else
  1532.         {
  1533.             mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_CONT_OPT); /* delete screen between opiion screen and progressing screen */
  1534.         }
  1535.     }
  1536. }
  1537. #define LOGOUT_IMPS
  1538. /*****************************************************************************
  1539.  * FUNCTION
  1540.  *  mmi_imps_hilite_logout
  1541.  * DESCRIPTION
  1542.  *  Hilite handler of Contact List -> Logout option
  1543.  * PARAMETERS
  1544.  *  void
  1545.  * RETURNS
  1546.  *  void
  1547.  *****************************************************************************/
  1548. void mmi_imps_hilite_logout(void)
  1549. {
  1550.     /*----------------------------------------------------------------*/
  1551.     /* Local Variables                                                */
  1552.     /*----------------------------------------------------------------*/
  1553.     /*----------------------------------------------------------------*/
  1554.     /* Code Body                                                      */
  1555.     /*----------------------------------------------------------------*/
  1556.     SetLeftSoftkeyFunction(mmi_imps_entry_logout, KEY_EVENT_UP);
  1557. }
  1558. /*****************************************************************************
  1559.  * FUNCTION
  1560.  *  mmi_imps_entry_logout
  1561.  * DESCRIPTION
  1562.  *  Entry function of Logout menu
  1563.  * PARAMETERS
  1564.  *  void
  1565.  * RETURNS
  1566.  *  void
  1567.  *****************************************************************************/
  1568. void mmi_imps_entry_logout(void)
  1569. {
  1570.     /*----------------------------------------------------------------*/
  1571.     /* Local Variables                                                */
  1572.     /*----------------------------------------------------------------*/
  1573.     /*----------------------------------------------------------------*/
  1574.     /* Code Body                                                      */
  1575.     /*----------------------------------------------------------------*/
  1576.     mmi_imps_display_progressing();
  1577. #ifdef IMPS_TEST_CODE
  1578.     mmi_imps_logout_complete();
  1579. #else 
  1580.     mmi_imps_ps_logout_req();
  1581. #endif 
  1582. }
  1583. /*****************************************************************************
  1584.  * FUNCTION
  1585.  *  mmi_imps_logout_complete
  1586.  * DESCRIPTION
  1587.  *  Entry function after logout response comes.
  1588.  * PARAMETERS
  1589.  *  void
  1590.  * RETURNS
  1591.  *  void
  1592.  *****************************************************************************/
  1593. void mmi_imps_logout_complete(void)
  1594. {
  1595.     /*----------------------------------------------------------------*/
  1596.     /* Local Variables                                                */
  1597.     /*----------------------------------------------------------------*/
  1598.     /*----------------------------------------------------------------*/
  1599.     /* Code Body                                                      */
  1600.     /*----------------------------------------------------------------*/
  1601.     if (GetActiveScreenId() == SCR_ID_IMPS_PROGRESS)
  1602.     {
  1603.         if (IsScreenPresent(SCR_ID_IMPS_MAIN))
  1604.         {
  1605.             GoBackToHistory(SCR_ID_IMPS_MAIN);
  1606.             return;
  1607.         }
  1608.         else
  1609.         {
  1610.             mmi_imps_entry_main();
  1611.         }
  1612.         DeleteBetweenScreen(SCR_ID_IMPS_CONT, SCR_ID_IMPS_PROGRESS);
  1613.     }
  1614.     else
  1615.     {
  1616.         mmi_imps_util_del_scr_after_progress(SCR_ID_IMPS_CONT);
  1617.         HistoryReplace(SCR_ID_IMPS_CONT, SCR_ID_IMPS_MAIN, mmi_imps_entry_main);
  1618.     }
  1619.     mmi_imps_util_free_buff_when_logout();
  1620.     mmi_imps_reset_cntx();
  1621. }
  1622. #define PROF_IMPS
  1623. /*****************************************************************************
  1624.  * FUNCTION
  1625.  *  mmi_imps_hilite_prof
  1626.  * DESCRIPTION
  1627.  *  Highlight handler for IMPS -> Profile menu item
  1628.  * PARAMETERS
  1629.  *  void
  1630.  * RETURNS
  1631.  *  void
  1632.  *****************************************************************************/
  1633. void mmi_imps_hilite_prof(void)
  1634. {
  1635.     /*----------------------------------------------------------------*/
  1636.     /* Local Variables                                                */
  1637.     /*----------------------------------------------------------------*/
  1638.     /*----------------------------------------------------------------*/
  1639.     /* Code Body                                                      */
  1640.     /*----------------------------------------------------------------*/
  1641.     SetLeftSoftkeyFunction(mmi_imps_pre_entry_prof, KEY_EVENT_UP);
  1642.     SetKeyHandler(mmi_imps_pre_entry_prof, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1643. }
  1644. /*****************************************************************************
  1645.  * FUNCTION
  1646.  *  mmi_imps_pre_entry_prof
  1647.  * DESCRIPTION
  1648.  *  Pre-entry function of profile
  1649.  *  1. allocate memory for profile data
  1650.  *  2. read profile from NVRAM.
  1651.  *  3. entry profile
  1652.  * PARAMETERS
  1653.  *  void
  1654.  * RETURNS
  1655.  *  void
  1656.  *****************************************************************************/
  1657. void mmi_imps_pre_entry_prof(void)
  1658. {
  1659.     /*----------------------------------------------------------------*/
  1660.     /* Local Variables                                                */
  1661.     /*----------------------------------------------------------------*/
  1662.     /*----------------------------------------------------------------*/
  1663.     /* Code Body                                                      */
  1664.     /*----------------------------------------------------------------*/
  1665.     if (imps_p->prof_misc == NULL)
  1666.     {
  1667.         imps_p->prof_misc = (mmi_imps_prof_misc_struct*) OslMalloc(sizeof(mmi_imps_prof_misc_struct));
  1668.         memset(imps_p->prof_misc, 0, sizeof(mmi_imps_prof_misc_struct));
  1669.     }
  1670.     /* read profile from NVRAM */
  1671.     mmi_imps_prof_read_nvram(IMPS_NVRAM_PROF_LIST);
  1672.     mmi_imps_entry_prof();
  1673. }
  1674. /*****************************************************************************
  1675.  * FUNCTION
  1676.  *  mmi_imps_entry_prof
  1677.  * DESCRIPTION
  1678.  *  List of profiles
  1679.  * PARAMETERS
  1680.  *  void
  1681.  * RETURNS
  1682.  *  void
  1683.  *****************************************************************************/
  1684. void mmi_imps_entry_prof(void)
  1685. {
  1686.     /*----------------------------------------------------------------*/
  1687.     /* Local Variables                                                */
  1688.     /*----------------------------------------------------------------*/
  1689.     S32 i;
  1690.     U8 *nStrItemList[IMPS_PROF_COUNT];
  1691.     U16 nIconItemList[IMPS_PROF_COUNT] = {0, 0, 0};
  1692.     U8 *guiBuffer;
  1693.     S32 curr_hilite = 0;
  1694.     /*----------------------------------------------------------------*/
  1695.     /* Code Body                                                      */
  1696.     /*----------------------------------------------------------------*/
  1697.     EntryNewScreen(SCR_ID_IMPS_PROF, NULL, mmi_imps_entry_prof, NULL);
  1698.     guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_PROF);
  1699.     for (i = 0; i < IMPS_PROF_COUNT; i++)
  1700.     {
  1701.         if (pfnUnicodeStrlen((S8*) imps_p->prof_misc->prof_name_list[i]) == 0)
  1702.         {
  1703.             S8 str_tmp[IMPS_PROF_NAME_LEN];
  1704.             sprintf(str_tmp, "Profile%d", (i + 1));
  1705.             AnsiiToUnicodeString((S8*) imps_p->prof_misc->prof_name_list[i], str_tmp);
  1706.         }
  1707.         nStrItemList[i] = (U8*) imps_p->prof_misc->prof_name_list[i];
  1708.     }
  1709.     if (imps_p->prof_misc->act_prof_indx <= IMPS_PROF_COUNT && imps_p->prof_misc->act_prof_indx > 0)
  1710.     {
  1711.         nIconItemList[imps_p->prof_misc->act_prof_indx - 1] = IMG_VICON;
  1712.         curr_hilite = (S32) (imps_p->prof_misc->act_prof_indx - 1);
  1713.     }
  1714.     RegisterHighlightHandler(mmi_imps_hilite_prof_list);
  1715.     ShowCategory73Screen(
  1716.         STR_ID_IMPS_PROF,
  1717.         GetRootTitleIcon(MENU_ID_IMPS_MAIN),
  1718.         STR_GLOBAL_OPTIONS,
  1719.         IMG_GLOBAL_OPTIONS,
  1720.         STR_GLOBAL_BACK,
  1721.         IMG_GLOBAL_BACK,
  1722.         IMPS_PROF_COUNT,
  1723.         nStrItemList,
  1724.         (U16*) nIconItemList,
  1725.         (U16*) gIndexIconsImageList,
  1726.         curr_hilite,
  1727.         guiBuffer,
  1728.         ICON_ICON_TEXT);
  1729.     SetLeftSoftkeyFunction(mmi_imps_entry_prof_opt, KEY_EVENT_UP);
  1730.     SetKeyHandler(mmi_imps_entry_prof_opt, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1731.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1732.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1733.     SetDelScrnIDCallbackHandler(SCR_ID_IMPS_PROF, (HistoryDelCBPtr) mmi_imps_prof_del_callback);
  1734. }
  1735. /*****************************************************************************
  1736.  * FUNCTION
  1737.  *  mmi_imps_prof_del_callback
  1738.  * DESCRIPTION
  1739.  *  Callback function when profile list is deleted.
  1740.  * PARAMETERS
  1741.  *  param       [IN]        Parameter from framework
  1742.  * RETURNS
  1743.  *  void
  1744.  *****************************************************************************/
  1745. U8 mmi_imps_prof_del_callback(void *param)
  1746. {
  1747.     /*----------------------------------------------------------------*/
  1748.     /* Local Variables                                                */
  1749.     /*----------------------------------------------------------------*/
  1750.     /*----------------------------------------------------------------*/
  1751.     /* Code Body                                                      */
  1752.     /*----------------------------------------------------------------*/
  1753.     mmi_imps_prof_free_mem();
  1754.     return FALSE;
  1755. }
  1756. /*****************************************************************************
  1757.  * FUNCTION
  1758.  *  mmi_imps_prof_free_mem_n_back
  1759.  * DESCRIPTION
  1760.  *  Free dynamic memory for Profile and go back to previous screen.
  1761.  * PARAMETERS
  1762.  *  void
  1763.  *  param(?)        [IN]        Parameter from framework
  1764.  * RETURNS
  1765.  *  void
  1766.  *****************************************************************************/
  1767. void mmi_imps_prof_free_mem_n_back(void)
  1768. {
  1769.     /*----------------------------------------------------------------*/
  1770.     /* Local Variables                                                */
  1771.     /*----------------------------------------------------------------*/
  1772.     /*----------------------------------------------------------------*/
  1773.     /* Code Body                                                      */
  1774.     /*----------------------------------------------------------------*/
  1775.     mmi_imps_prof_free_mem();
  1776.     GoBackHistory();
  1777. }
  1778. /*****************************************************************************
  1779.  * FUNCTION
  1780.  *  mmi_imps_prof_free_mem
  1781.  * DESCRIPTION
  1782.  *  Free dynamic memory for Profile.
  1783.  * PARAMETERS
  1784.  *  void
  1785.  * RETURNS
  1786.  *  void
  1787.  *****************************************************************************/
  1788. void mmi_imps_prof_free_mem(void)
  1789. {
  1790.     /*----------------------------------------------------------------*/
  1791.     /* Local Variables                                                */
  1792.     /*----------------------------------------------------------------*/
  1793.     /*----------------------------------------------------------------*/
  1794.     /* Code Body                                                      */
  1795.     /*----------------------------------------------------------------*/
  1796.     if (imps_p->prof_misc != NULL)
  1797.     {
  1798.         OslMfree(imps_p->prof_misc);
  1799.         imps_p->prof_misc = NULL;
  1800.     }
  1801. }
  1802. /*****************************************************************************
  1803.  * FUNCTION
  1804.  *  mmi_imps_hilite_prof_list
  1805.  * DESCRIPTION
  1806.  *  Hilite handler for profile list.
  1807.  * PARAMETERS
  1808.  *  index       [IN]        Index of profile
  1809.  * RETURNS
  1810.  *  void
  1811.  *****************************************************************************/
  1812. void mmi_imps_hilite_prof_list(S32 index)
  1813. {
  1814.     /*----------------------------------------------------------------*/
  1815.     /* Local Variables                                                */
  1816.     /*----------------------------------------------------------------*/
  1817.     /*----------------------------------------------------------------*/
  1818.     /* Code Body                                                      */
  1819.     /*----------------------------------------------------------------*/
  1820.     imps_p->prof_misc->hilte_prof = (U8) index;
  1821. }
  1822. /*****************************************************************************
  1823.  * FUNCTION
  1824.  *  mmi_imps_entry_prof_opt
  1825.  * DESCRIPTION
  1826.  *  Entry function of Profile->Option
  1827.  * PARAMETERS
  1828.  *  void
  1829.  * RETURNS
  1830.  *  void
  1831.  *****************************************************************************/
  1832. void mmi_imps_entry_prof_opt(void)
  1833. {
  1834.     /*----------------------------------------------------------------*/
  1835.     /* Local Variables                                                */
  1836.     /*----------------------------------------------------------------*/
  1837.     U16 numItems;
  1838.     U16 nStrItemList[2];    /* Activate and Edit */
  1839.     U8 *guiBuffer;
  1840.     /*----------------------------------------------------------------*/
  1841.     /* Code Body                                                      */
  1842.     /*----------------------------------------------------------------*/
  1843.     EntryNewScreen(SCR_ID_IMPS_PROF_OPT, NULL, mmi_imps_entry_prof_opt, NULL);
  1844.     guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_PROF_OPT);
  1845.     SetParentHandler(MENU_ID_IMPS_PROF_OPT);
  1846.     numItems = GetNumOfChild(MENU_ID_IMPS_PROF_OPT);
  1847.     GetSequenceStringIds(MENU_ID_IMPS_PROF_OPT, nStrItemList);
  1848.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  1849.     ShowCategory52Screen(
  1850.         STR_GLOBAL_OPTIONS,
  1851.         GetRootTitleIcon(MENU_ID_IMPS_MAIN),
  1852.         STR_GLOBAL_OK,
  1853.         IMG_GLOBAL_OK,
  1854.         STR_GLOBAL_BACK,
  1855.         IMG_GLOBAL_BACK,
  1856.         numItems,
  1857.         nStrItemList,
  1858.         (U16*) gIndexIconsImageList,
  1859.         NULL,
  1860.         0,
  1861.         0,
  1862.         guiBuffer);
  1863.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1864.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1865. }
  1866. /*****************************************************************************
  1867.  * FUNCTION
  1868.  *  mmi_imps_hilite_prof_activate
  1869.  * DESCRIPTION
  1870.  *  Highlight handler of Profile -> Activate menu
  1871.  * PARAMETERS
  1872.  *  void
  1873.  * RETURNS
  1874.  *  void
  1875.  *****************************************************************************/
  1876. void mmi_imps_hilite_prof_activate(void)
  1877. {
  1878.     /*----------------------------------------------------------------*/
  1879.     /* Local Variables                                                */
  1880.     /*----------------------------------------------------------------*/
  1881.     /*----------------------------------------------------------------*/
  1882.     /* Code Body                                                      */
  1883.     /*----------------------------------------------------------------*/
  1884.     SetLeftSoftkeyFunction(mmi_imps_entry_prof_activate, KEY_EVENT_UP);
  1885. }
  1886. /*****************************************************************************
  1887.  * FUNCTION
  1888.  *  mmi_imps_entry_prof_activate
  1889.  * DESCRIPTION
  1890.  *  Pre-Entry function for Profile -> Activate menu
  1891.  * PARAMETERS
  1892.  *  void
  1893.  * RETURNS
  1894.  *  void
  1895.  *****************************************************************************/
  1896. void mmi_imps_entry_prof_activate(void)
  1897. {
  1898.     /*----------------------------------------------------------------*/
  1899.     /* Local Variables                                                */
  1900.     /*----------------------------------------------------------------*/
  1901.     U8 i;
  1902.     mmi_imps_nvram_struct *prof_buff;
  1903.     /*----------------------------------------------------------------*/
  1904.     /* Code Body                                                      */
  1905.     /*----------------------------------------------------------------*/
  1906.     i = imps_p->prof_misc->hilte_prof;
  1907.     if (imps_p->prof_misc->act_prof_indx != (i + 1))
  1908.     {
  1909.         prof_buff = (mmi_imps_nvram_struct*) OslMalloc(NVRAM_EF_IMPS_SIZE);
  1910.         mmi_imps_util_read_nvram((void*)prof_buff);
  1911.         /* check server */
  1912.         if (pfnUnicodeStrlen((S8*) prof_buff->prof[i].server) == 0)
  1913.         {
  1914.             mmi_imps_util_disp_err_popup(STR_ID_IMPS_PROF_NO_CONFIG);
  1915.             OslMfree(prof_buff);
  1916.             return;
  1917.         }
  1918.         prof_buff->act_prof_indx = (i + 1);
  1919.         /* update activate profile info */
  1920.         imps_p->prof_misc->act_prof_indx = (i + 1);
  1921.         memcpy(&imps_p->act_prof, &prof_buff->prof[i], sizeof(mmi_imps_prof_struct));
  1922.         mmi_imps_util_reset_cont_list();
  1923.         mmi_imps_util_reset_about_me((void*)prof_buff);
  1924.         mmi_imps_util_write_nvram((void*)prof_buff);
  1925.         OslMfree(prof_buff);
  1926.     }
  1927.     /* update act profile info and write to NVRAM */
  1928.     mmi_imps_util_disp_popup_done();
  1929.     DeleteUptoScrID(SCR_ID_IMPS_PROF);
  1930. }
  1931. /*****************************************************************************
  1932.  * FUNCTION
  1933.  *  mmi_imps_hilite_prof_edit
  1934.  * DESCRIPTION
  1935.  *  Highlight handler of Profile -> Edit menu
  1936.  * PARAMETERS
  1937.  *  void
  1938.  * RETURNS
  1939.  *  void
  1940.  *****************************************************************************/
  1941. void mmi_imps_hilite_prof_edit(void)
  1942. {
  1943.     /*----------------------------------------------------------------*/
  1944.     /* Local Variables                                                */
  1945.     /*----------------------------------------------------------------*/
  1946.     /*----------------------------------------------------------------*/
  1947.     /* Code Body                                                      */
  1948.     /*----------------------------------------------------------------*/
  1949.     SetLeftSoftkeyFunction(mmi_imps_pre_entry_prof_edit, KEY_EVENT_UP);
  1950.     SetKeyHandler(mmi_imps_pre_entry_prof_edit, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1951. }
  1952. /*****************************************************************************
  1953.  * FUNCTION
  1954.  *  mmi_imps_pre_entry_prof_edit
  1955.  * DESCRIPTION
  1956.  *  Pre-entry function inline editor screen of profile.
  1957.  *  Retrieve all data account information before entering editor screen.
  1958.  * PARAMETERS
  1959.  *  void
  1960.  * RETURNS
  1961.  *  void
  1962.  *****************************************************************************/
  1963. void mmi_imps_pre_entry_prof_edit(void)
  1964. {
  1965.     /*----------------------------------------------------------------*/
  1966.     /* Local Variables                                                */
  1967.     /*----------------------------------------------------------------*/
  1968.     /*----------------------------------------------------------------*/
  1969.     /* Code Body                                                      */
  1970.     /*----------------------------------------------------------------*/
  1971.     mmi_imps_display_progressing();
  1972. #ifdef MMI_ON_HARDWARE_P
  1973.     DataAccountReadyCheck(mmi_imps_dt_acct_callback);
  1974. #else 
  1975.     mmi_imps_dt_acct_callback();
  1976. #endif 
  1977. }
  1978. /*****************************************************************************
  1979.  * FUNCTION
  1980.  *  mmi_imps_dt_acct_callback
  1981.  * DESCRIPTION
  1982.  *  Callback function for Data Account
  1983.  * PARAMETERS
  1984.  *  void
  1985.  * RETURNS
  1986.  *  void
  1987.  *****************************************************************************/
  1988. void mmi_imps_dt_acct_callback(void)
  1989. {
  1990.     /*----------------------------------------------------------------*/
  1991.     /* Local Variables                                                */
  1992.     /*----------------------------------------------------------------*/
  1993.     /*----------------------------------------------------------------*/
  1994.     /* Code Body                                                      */
  1995.     /*----------------------------------------------------------------*/
  1996.     if (GetExitScrnID() == SCR_ID_IMPS_PROGRESS)
  1997.     {
  1998.         mmi_imps_entry_prof_edit();
  1999.     }
  2000.     DeleteScreenIfPresent(SCR_ID_IMPS_PROGRESS);
  2001. }
  2002. /*****************************************************************************
  2003.  * FUNCTION
  2004.  *  mmi_imps_prof_read_nvram
  2005.  * DESCRIPTION
  2006.  *  1. Read profile setting from NVRAM
  2007.  *  2. After read complete, entry profile edit screen.
  2008.  * PARAMETERS
  2009.  *  type        [IN]        Cause of reading NVRAM
  2010.  * RETURNS
  2011.  *  void
  2012.  *****************************************************************************/
  2013. void mmi_imps_prof_read_nvram(mmi_imps_nvram_cause type)
  2014. {
  2015.     /*----------------------------------------------------------------*/
  2016.     /* Local Variables                                                */
  2017.     /*----------------------------------------------------------------*/
  2018.     S32 i;
  2019.     mmi_imps_nvram_struct *prof_buff = (mmi_imps_nvram_struct*) OslMalloc(NVRAM_EF_IMPS_SIZE);
  2020.     /*----------------------------------------------------------------*/
  2021.     /* Code Body                                                      */
  2022.     /*----------------------------------------------------------------*/
  2023.     mmi_imps_util_read_nvram((void*)prof_buff);
  2024.     if (type == IMPS_NVRAM_INIT)    /* for initialization, load to active profile */
  2025.     {
  2026.         if (prof_buff->act_prof_indx > 0 && prof_buff->act_prof_indx <= IMPS_PROF_COUNT)
  2027.         {
  2028.             memcpy(&imps_p->act_prof, &prof_buff->prof[(prof_buff->act_prof_indx - 1)], sizeof(mmi_imps_prof_struct));
  2029.             /* initialize myself in contact list */
  2030.             strcpy((S8*) imps_p->cont_info.cont_list[0].id, (S8*) imps_p->act_prof.username);
  2031.             imps_p->cont_info.no_cont = 1;
  2032.         }
  2033.         else
  2034.         {
  2035.             /* set profile name to NULL to indicate no profile activeated */
  2036.             imps_p->act_prof.prof_name[0] = 0;
  2037.         }
  2038.         /* piggyback sort type */
  2039.         imps_p->cont_info.sort_type = prof_buff->sort_type;
  2040.     }
  2041.     else if (type == IMPS_NVRAM_PROF_LIST)
  2042.     {
  2043.         for (i = 0; i < IMPS_PROF_COUNT; i++)
  2044.             if (pfnUnicodeStrlen((S8*) prof_buff->prof[i].prof_name) > 0)
  2045.             {
  2046.                 pfnUnicodeStrcpy((S8*) imps_p->prof_misc->prof_name_list[i], (S8*) prof_buff->prof[i].prof_name);
  2047.             }
  2048.         imps_p->prof_misc->act_prof_indx = prof_buff->act_prof_indx;
  2049.     }
  2050.     else    /* if(type == IMPS_NVRAM_PROF_EDIT)  for profile editing, load to current profile */
  2051.     {
  2052.         mmi_imps_prof_edit_struct *edit_prof = &imps_p->prof_misc->edit_prof;
  2053.         /* store date to current editing buffer */
  2054.         i = (S32) imps_p->prof_misc->hilte_prof;
  2055.         if (pfnUnicodeStrlen((S8*) prof_buff->prof[i].prof_name) > 0)  /* non-empty profile */
  2056.         {
  2057.             pfnUnicodeStrcpy((S8*) edit_prof->prof_name, (S8*) prof_buff->prof[i].prof_name);
  2058.             AnsiiToUnicodeString((S8*) edit_prof->server, (S8*) prof_buff->prof[i].server);
  2059.             AnsiiToUnicodeString((S8*) edit_prof->username, (S8*) prof_buff->prof[i].username);
  2060.             AnsiiToUnicodeString((S8*) edit_prof->passwd, (S8*) prof_buff->prof[i].passwd);
  2061.             AnsiiToUnicodeString((S8*) edit_prof->proxy_username, (S8*) prof_buff->prof[i].proxy_username);
  2062.             AnsiiToUnicodeString((S8*) edit_prof->proxy_passwd, (S8*) prof_buff->prof[i].proxy_passwd);
  2063.             edit_prof->conn_type = (S32) prof_buff->prof[i].conn_type;
  2064.             edit_prof->curr_dt_acct = prof_buff->prof[i].dt_acct;
  2065.             edit_prof->use_proxy = (S32) prof_buff->prof[i].use_proxy;
  2066.             edit_prof->auto_login = (S32) prof_buff->prof[i].auto_login;
  2067.             edit_prof->auto_update = (S32) prof_buff->prof[i].auto_update;
  2068.         }
  2069.         else
  2070.         {
  2071.             S8 str_tmp[IMPS_PROF_NAME_LEN];
  2072.             memset(edit_prof, 0, sizeof(mmi_imps_prof_edit_struct));
  2073.             sprintf(str_tmp, "Profile%d", (i + 1));
  2074.             AnsiiToUnicodeString((S8*) edit_prof->prof_name, str_tmp);
  2075.         }
  2076.         /* port number */
  2077.         if (prof_buff->prof[i].proxy_port == 0) /* no setting before */
  2078.         {
  2079.             pfnUnicodeStrcpy((S8*) edit_prof->proxy_port, (S8*) g_imps_proxy_port);
  2080.         }
  2081.         else
  2082.         {
  2083.             gui_itoa(prof_buff->prof[i].proxy_port, (UI_string_type) edit_prof->proxy_port, 10);
  2084.         }
  2085.         /* IP address */
  2086.         if (prof_buff->prof[i].proxy_ip[0] == 0)
  2087.         {
  2088.             pfnUnicodeStrcpy((S8*) edit_prof->proxy_ip[0], (S8*) g_imps_zero_ip);
  2089.             pfnUnicodeStrcpy((S8*) edit_prof->proxy_ip[1], (S8*) g_imps_zero_ip);
  2090.             pfnUnicodeStrcpy((S8*) edit_prof->proxy_ip[2], (S8*) g_imps_zero_ip);
  2091.             pfnUnicodeStrcpy((S8*) edit_prof->proxy_ip[3], (S8*) g_imps_zero_ip);
  2092.         }
  2093.         else
  2094.         {
  2095.             gui_itoa((S32) prof_buff->prof[i].proxy_ip[0], (UI_string_type) edit_prof->proxy_ip[0], 10);
  2096.             gui_itoa((S32) prof_buff->prof[i].proxy_ip[1], (UI_string_type) edit_prof->proxy_ip[1], 10);
  2097.             gui_itoa((S32) prof_buff->prof[i].proxy_ip[2], (UI_string_type) edit_prof->proxy_ip[2], 10);
  2098.             gui_itoa((S32) prof_buff->prof[i].proxy_ip[3], (UI_string_type) edit_prof->proxy_ip[3], 10);
  2099.         }
  2100.         if (edit_prof->curr_dt_acct == 0)
  2101.         {
  2102.             edit_prof->curr_dt_acct = mmi_dtcnt_get_first_account_id(DATA_ACCOUNT_BEARER_GPRS | DATA_ACCOUNT_BEARER_WIFI);
  2103.         }
  2104.         mmi_dtcnt_get_account_name(edit_prof->curr_dt_acct, (S8*)imps_p->prof_misc->dt_acct_name, MAX_DATA_ACCOUNT_NAME_LEN);
  2105.     }
  2106.     OslMfree(prof_buff);
  2107. }
  2108. /*****************************************************************************
  2109.  * FUNCTION
  2110.  *  mmi_imps_entry_prof_edit
  2111.  * DESCRIPTION
  2112.  *  Entry Profie->Edit screen
  2113.  * PARAMETERS
  2114.  *  void
  2115.  * RETURNS
  2116.  *  void
  2117.  *****************************************************************************/
  2118. void mmi_imps_entry_prof_edit(void)
  2119. {
  2120.     /*----------------------------------------------------------------*/
  2121.     /* Local Variables                                                */
  2122.     /*----------------------------------------------------------------*/
  2123.     U16 numItems;
  2124.     U16 nStrItemList[2];    /* Activate and Edit */
  2125.     U8 *guiBuffer;
  2126.     /*----------------------------------------------------------------*/
  2127.     /* Code Body                                                      */
  2128.     /*----------------------------------------------------------------*/
  2129.     EntryNewScreen(SCR_ID_IMPS_PROF_EDIT, NULL, mmi_imps_entry_prof_edit, NULL);
  2130.     guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_PROF_EDIT);
  2131.     SetParentHandler(MENU_ID_IMPS_PROF_EDIT);
  2132.     numItems = GetNumOfChild(MENU_ID_IMPS_PROF_EDIT);
  2133.     GetSequenceStringIds(MENU_ID_IMPS_PROF_EDIT, nStrItemList);
  2134.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  2135.     ShowCategory52Screen(
  2136.         STR_GLOBAL_EDIT,
  2137.         GetRootTitleIcon(MENU_ID_IMPS_MAIN),
  2138.         STR_GLOBAL_OK,
  2139.         IMG_GLOBAL_OK,
  2140.         STR_GLOBAL_BACK,
  2141.         IMG_GLOBAL_BACK,
  2142.         numItems,
  2143.         nStrItemList,
  2144.         (U16*) gIndexIconsImageList,
  2145.         NULL,
  2146.         0,
  2147.         0,
  2148.         guiBuffer);
  2149.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2150.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2151. }
  2152. /*****************************************************************************
  2153.  * FUNCTION
  2154.  *  mmi_imps_hilite_prof_setting
  2155.  * DESCRIPTION
  2156.  *  Highlight handler of Profile -> Edit -> Profile Setting menu
  2157.  * PARAMETERS
  2158.  *  void
  2159.  * RETURNS
  2160.  *  void
  2161.  *****************************************************************************/
  2162. void mmi_imps_hilite_prof_setting(void)
  2163. {
  2164.     /*----------------------------------------------------------------*/
  2165.     /* Local Variables                                                */
  2166.     /*----------------------------------------------------------------*/
  2167.     /*----------------------------------------------------------------*/
  2168.     /* Code Body                                                      */
  2169.     /*----------------------------------------------------------------*/
  2170.     imps_p->prof_misc->setting_type = 0;    /* 0 == profile setting */
  2171.     SetLeftSoftkeyFunction(mmi_imps_pre_entry_prof_setting, KEY_EVENT_UP);
  2172.     SetKeyHandler(mmi_imps_pre_entry_prof_setting, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2173. }
  2174. /*****************************************************************************
  2175.  * FUNCTION
  2176.  *  mmi_imps_hilite_prof_conn
  2177.  * DESCRIPTION
  2178.  *  Highlight handler of Profile -> Edit -> Connection Setting menu
  2179.  * PARAMETERS
  2180.  *  void
  2181.  * RETURNS
  2182.  *  void
  2183.  *****************************************************************************/
  2184. void mmi_imps_hilite_prof_conn(void)
  2185. {
  2186.     /*----------------------------------------------------------------*/
  2187.     /* Local Variables                                                */
  2188.     /*----------------------------------------------------------------*/
  2189.     /*----------------------------------------------------------------*/
  2190.     /* Code Body                                                      */
  2191.     /*----------------------------------------------------------------*/
  2192.     imps_p->prof_misc->setting_type = 1;    /* 1 == connection setting */
  2193.     SetLeftSoftkeyFunction(mmi_imps_pre_entry_prof_conn, KEY_EVENT_UP);
  2194.     SetKeyHandler(mmi_imps_pre_entry_prof_conn, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2195. }
  2196. /*****************************************************************************
  2197.  * FUNCTION
  2198.  *  mmi_imps_pre_entry_prof_setting
  2199.  * DESCRIPTION
  2200.  *  
  2201.  * PARAMETERS
  2202.  *  void
  2203.  * RETURNS
  2204.  *  void
  2205.  *****************************************************************************/
  2206. void mmi_imps_pre_entry_prof_setting(void)
  2207. {
  2208.     /*----------------------------------------------------------------*/
  2209.     /* Local Variables                                                */
  2210.     /*----------------------------------------------------------------*/
  2211.     /*----------------------------------------------------------------*/
  2212.     /* Code Body                                                      */
  2213.     /*----------------------------------------------------------------*/
  2214.     mmi_imps_prof_read_nvram(IMPS_NVRAM_PROF_EDIT);
  2215.     mmi_imps_entry_prof_setting();
  2216. }
  2217. /*****************************************************************************
  2218.  * FUNCTION
  2219.  *  mmi_imps_entry_prof_setting
  2220.  * DESCRIPTION
  2221.  *  Entry inline editor screen of Profile Setting
  2222.  * PARAMETERS
  2223.  *  void
  2224.  * RETURNS
  2225.  *  void
  2226.  *****************************************************************************/
  2227. void mmi_imps_entry_prof_setting(void)
  2228. {
  2229.     /*----------------------------------------------------------------*/
  2230.     /* Local Variables                                                */
  2231.     /*----------------------------------------------------------------*/
  2232.     U8 *guiBuffer;
  2233.     U8 *inputBuffer;
  2234.     U16 inputBufferSize;
  2235.     /*----------------------------------------------------------------*/
  2236.     /* Code Body                                                      */
  2237.     /*----------------------------------------------------------------*/
  2238.     EntryNewScreen(SCR_ID_IMPS_PROF_SETTING, mmi_imps_exit_prof_setting, NULL, NULL);
  2239.     InitializeCategory57Screen();
  2240.     mmi_imps_prof_setting_fill_inline_struct();
  2241.     guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_PROF_SETTING);
  2242.     inputBuffer = GetCurrNInputBuffer(SCR_ID_IMPS_PROF_SETTING, &inputBufferSize);
  2243.     if (inputBuffer != NULL)
  2244.     {
  2245.         SetCategory57Data(wgui_inline_items, IMPS_INLINE_PROF_SETTING, inputBuffer);
  2246.     }
  2247.     ShowCategory57Screen(
  2248.         STR_ID_IMPS_PROF_SETTING,
  2249.         GetRootTitleIcon(MENU_ID_IMPS_MAIN),
  2250.         STR_GLOBAL_EDIT,
  2251.         IMG_GLOBAL_BACK,
  2252.         STR_GLOBAL_DONE,
  2253.         IMG_GLOBAL_BACK,
  2254.         IMPS_INLINE_PROF_SETTING,
  2255.         (U16*) g_imps_inline_icons,
  2256.         wgui_inline_items,
  2257.         0,
  2258.         guiBuffer);
  2259.     SetCategory57RightSoftkeyFunctions(mmi_imps_prof_save, GoBackHistory);
  2260. }
  2261. /*****************************************************************************
  2262.  * FUNCTION
  2263.  *  mmi_imps_exit_prof_setting
  2264.  * DESCRIPTION
  2265.  *  Exit function for inlnine editor screen of Profile Setting
  2266.  * PARAMETERS
  2267.  *  void
  2268.  * RETURNS
  2269.  *  void
  2270.  *****************************************************************************/
  2271. void mmi_imps_exit_prof_setting(void)
  2272. {
  2273.     /*----------------------------------------------------------------*/
  2274.     /* Local Variables                                                */
  2275.     /*----------------------------------------------------------------*/
  2276.     /*----------------------------------------------------------------*/
  2277.     /* Code Body                                                      */
  2278.     /*----------------------------------------------------------------*/
  2279.     set_leading_zero(TRUE);
  2280.     GenericExitInlineScreen(SCR_ID_IMPS_PROF_SETTING, mmi_imps_entry_prof_setting);
  2281. }
  2282. /*****************************************************************************
  2283.  * FUNCTION
  2284.  *  mmi_imps_prof_save
  2285.  * DESCRIPTION
  2286.  *  LSK handler for profile editor screen
  2287.  * PARAMETERS
  2288.  *  void
  2289.  * RETURNS
  2290.  *  void
  2291.  *****************************************************************************/
  2292. void mmi_imps_prof_save(void)
  2293. {
  2294.     /*----------------------------------------------------------------*/
  2295.     /* Local Variables                                                */
  2296.     /*----------------------------------------------------------------*/
  2297.     /*----------------------------------------------------------------*/
  2298.     /* Code Body                                                      */
  2299.     /*----------------------------------------------------------------*/
  2300.     mmi_imps_entry_confirm(STR_GLOBAL_SAVE, mmi_imps_prof_save_yes, mmi_imps_prof_save_no);
  2301. }
  2302. /*****************************************************************************
  2303.  * FUNCTION
  2304.  *  mmi_imps_prof_save_no
  2305.  * DESCRIPTION
  2306.  *  Give up saving profile
  2307.  * PARAMETERS
  2308.  *  void
  2309.  * RETURNS
  2310.  *  void
  2311.  *****************************************************************************/
  2312. void mmi_imps_prof_save_no(void)
  2313. {
  2314.     /*----------------------------------------------------------------*/
  2315.     /* Local Variables                                                */
  2316.     /*----------------------------------------------------------------*/
  2317.     /*----------------------------------------------------------------*/
  2318.     /* Code Body                                                      */
  2319.     /*----------------------------------------------------------------*/
  2320.     DeleteUptoScrID(SCR_ID_IMPS_PROF_EDIT);
  2321.     GoBackHistory();
  2322. }
  2323. /*****************************************************************************
  2324.  * FUNCTION
  2325.  *  mmi_imps_prof_save_yes
  2326.  * DESCRIPTION
  2327.  *  Proceed saving profile
  2328.  * PARAMETERS
  2329.  *  void
  2330.  * RETURNS
  2331.  *  void
  2332.  *****************************************************************************/
  2333. void mmi_imps_prof_save_yes(void)
  2334. {
  2335.     /*----------------------------------------------------------------*/
  2336.     /* Local Variables                                                */
  2337.     /*----------------------------------------------------------------*/
  2338.     mmi_imps_nvram_struct *prof_buff;
  2339.     mmi_imps_prof_struct *prof;
  2340.     mmi_imps_prof_edit_struct *edit_prof;
  2341.     S32 i;
  2342.     S32 port;
  2343.     U8 type = imps_p->prof_misc->setting_type;
  2344.     U8 data_acct_start = mmi_dtcnt_get_first_account_id(DATA_ACCOUNT_BEARER_GPRS | DATA_ACCOUNT_BEARER_WIFI);
  2345.     /*----------------------------------------------------------------*/
  2346.     /* Code Body                                                      */
  2347.     /*----------------------------------------------------------------*/
  2348.     edit_prof = &imps_p->prof_misc->edit_prof;
  2349.     /* port */
  2350.     port = (S32) gui_atoi(edit_prof->proxy_port);
  2351.     if (type == 0)  /* 0 == Profie setting */
  2352.     {
  2353.         /* check profile name */
  2354.         if (pfnUnicodeStrlen((S8*) edit_prof->prof_name) == 0)
  2355.         {
  2356.             mmi_imps_util_disp_err_popup(STR_ID_IMPS_ERR_EMPTY_NAME);
  2357.             return;
  2358.         }
  2359.         /* check server */
  2360.         if (pfnUnicodeStrlen((S8*) edit_prof->server) == 0)
  2361.         {
  2362.             mmi_imps_util_disp_err_popup(STR_ID_IMPS_ERR_INVALID_SERVER);
  2363.             return;
  2364.         }
  2365.         /* check user name */
  2366.         if (pfnUnicodeStrlen((S8*) edit_prof->username) == 0)
  2367.         {
  2368.             mmi_imps_util_disp_err_popup(STR_ID_IMPS_ERR_INVALID_USERNAME);
  2369.             return;
  2370.         }
  2371.     #ifndef IMPS_FOR_OMA_ONLY
  2372.         /* check "wv:" and append */
  2373.         mmi_imps_util_append_wv((S8*) edit_prof->username, IMPS_MAX_NAME_LEN);
  2374.         if (mmi_imps_util_is_username_valid((S8*) edit_prof->username) == FALSE)
  2375.         {
  2376.             mmi_imps_util_disp_err_popup(STR_ID_IMPS_ERR_INVALID_USERNAME);
  2377.             return;
  2378.         }
  2379.     #endif /* IMPS_FOR_OMA_ONLY */ 
  2380.     }
  2381.     else
  2382.     {
  2383.         if (port == 0 || port > 65535)
  2384.         {
  2385.             mmi_imps_util_disp_err_popup(STR_ID_IMPS_ERR_INVALID_PORT);
  2386.             return;
  2387.         }
  2388.     }
  2389.     i = (S32) imps_p->prof_misc->hilte_prof;
  2390.     prof_buff = (mmi_imps_nvram_struct*) OslMalloc(NVRAM_EF_IMPS_SIZE);
  2391.     memset(prof_buff, 0, NVRAM_EF_IMPS_SIZE);
  2392.     mmi_imps_util_read_nvram((void*)prof_buff);
  2393.     /* retrieve the address of editing profile */
  2394.     prof = &prof_buff->prof[i];
  2395.     /* profile name */
  2396.     if (pfnUnicodeStrlen((S8*) edit_prof->prof_name) == 0)
  2397.     {
  2398.         /* copy default value of profile name if not exists */
  2399.         S8 str_tmp[IMPS_PROF_NAME_LEN];
  2400.         sprintf(str_tmp, "Profile%d", (i + 1));
  2401.         AnsiiToUnicodeString((S8*) prof->prof_name, str_tmp);
  2402.     }
  2403.     else
  2404.     {
  2405.         pfnUnicodeStrcpy((S8*) prof->prof_name, (S8*) edit_prof->prof_name);
  2406.     }
  2407.     if (type == 0)
  2408.     {
  2409.         /* server */
  2410.         UnicodeToAnsii((S8*) prof->server, (S8*) edit_prof->server);
  2411.         /* user name */
  2412.         UnicodeToAnsii((S8*) prof->username, (S8*) edit_prof->username);
  2413.         /* password */
  2414.         UnicodeToAnsii((S8*) prof->passwd, (S8*) edit_prof->passwd);
  2415.         /* auto login */
  2416.         prof->auto_login = (U8) edit_prof->auto_login;
  2417.         /* auto update */
  2418.         prof->auto_update = (U8) edit_prof->auto_update;
  2419.         /* make sure the data account is updated */
  2420.         if (edit_prof->curr_dt_acct <= data_acct_start)
  2421.         {
  2422.             prof->dt_acct = data_acct_start;
  2423.         }
  2424.     }
  2425.     else
  2426.     {
  2427.         /* connection type */
  2428.         prof->conn_type = (U8) edit_prof->conn_type;
  2429.         /* data account */
  2430.         prof->dt_acct = edit_prof->curr_dt_acct;
  2431.         /* user proxy */
  2432.         prof->use_proxy = (U8) edit_prof->use_proxy;
  2433.         /* proxy server */
  2434.         prof->proxy_ip[0] = (U8) gui_atoi(edit_prof->proxy_ip[0]);
  2435.         prof->proxy_ip[1] = (U8) gui_atoi(edit_prof->proxy_ip[1]);
  2436.         prof->proxy_ip[2] = (U8) gui_atoi(edit_prof->proxy_ip[2]);
  2437.         prof->proxy_ip[3] = (U8) gui_atoi(edit_prof->proxy_ip[3]);
  2438.         /* port */
  2439.         prof->proxy_port = (U16) port;
  2440.         /* proxy user name */
  2441.         UnicodeToAnsii((S8*) prof->proxy_username, (S8*) edit_prof->proxy_username);
  2442.         /* proxy passwd */
  2443.         UnicodeToAnsii((S8*) prof->proxy_passwd, (S8*) edit_prof->proxy_passwd);
  2444.     }
  2445.     /* update data if it's current activate profile */
  2446.     if ((i + 1) == imps_p->prof_misc->act_prof_indx)
  2447.     {
  2448.         U8 critical_changed = 0;
  2449.         /* if the username or server changed, shall not reset the cache */
  2450.         if (pfnUnicodeStrcmp((S8*) prof_buff->prof[i].server, (S8*) imps_p->act_prof.server)
  2451.             || pfnUnicodeStrcmp((S8*) prof_buff->prof[i].username, (S8*) imps_p->act_prof.username))
  2452.         {
  2453.             critical_changed = 1;
  2454.         }
  2455.         memcpy(&imps_p->act_prof, &prof_buff->prof[i], sizeof(mmi_imps_prof_struct));
  2456.         if (critical_changed)
  2457.         {
  2458.             mmi_imps_util_reset_cont_list();
  2459.             mmi_imps_util_reset_about_me((void*)prof_buff);
  2460.         }
  2461.     }
  2462.     mmi_imps_util_write_nvram((void*)prof_buff);
  2463.     /* update profile name in profile list */
  2464.     pfnUnicodeStrcpy((S8*) imps_p->prof_misc->prof_name_list[i], (S8*) prof_buff->prof[i].prof_name);
  2465.     mmi_imps_util_disp_popup_done();
  2466.     DeleteUptoScrID(SCR_ID_IMPS_PROF_EDIT);
  2467.     OslMfree(prof_buff);
  2468. }
  2469. /*****************************************************************************
  2470.  * FUNCTION
  2471.  *  mmi_imps_prof_setting_fill_inline_struct
  2472.  * DESCRIPTION
  2473.  *  Fill inline editor structure of profile.
  2474.  * PARAMETERS
  2475.  *  void
  2476.  * RETURNS
  2477.  *  void
  2478.  *****************************************************************************/
  2479. void mmi_imps_prof_setting_fill_inline_struct(void)
  2480. {
  2481.     /*----------------------------------------------------------------*/
  2482.     /* Local Variables                                                */
  2483.     /*----------------------------------------------------------------*/
  2484.     mmi_imps_prof_edit_struct *edit_prof = &imps_p->prof_misc->edit_prof;
  2485.     /*----------------------------------------------------------------*/
  2486.     /* Code Body                                                      */
  2487.     /*----------------------------------------------------------------*/
  2488.     /* Yes/No */
  2489.     imps_p->prof_misc->yes_no_list[0] = (U8*) GetString(STR_GLOBAL_NO);
  2490.     imps_p->prof_misc->yes_no_list[1] = (U8*) GetString(STR_GLOBAL_YES);
  2491.     set_leading_zero(FALSE);
  2492.     /* Profile Name */
  2493.     SetInlineItemActivation(&wgui_inline_items[0], KEY_LSK, KEY_EVENT_UP);
  2494.     SetInlineItemCaption(&wgui_inline_items[0], (U8*) GetString(STR_ID_IMPS_PROF_NAME));
  2495.     SetInlineItemActivation(&wgui_inline_items[1], KEY_LSK, KEY_EVENT_UP);
  2496.     SetInlineItemFullScreenEdit(
  2497.         &wgui_inline_items[1],
  2498.         STR_ID_IMPS_PROF_NAME,
  2499.         GetRootTitleIcon(MENU_ID_IMPS_MAIN),
  2500.         (U8*) edit_prof->prof_name,
  2501.         IMPS_PROF_NAME_LEN,
  2502.         INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
  2503.     SetInlineFullScreenEditCustomFunction(&wgui_inline_items[1], mmi_imps_hilite_prof_full_edit);
  2504.     /* Server */
  2505. #ifdef IMPS_PROF_TEST_CODE
  2506.     if (pfnUnicodeStrlen((S8*) edit_prof->server) == 0)
  2507.     {
  2508.         AnsiiToUnicodeString((S8*) edit_prof->server, (S8*) "http://210.61.82.71:888");
  2509.     }
  2510. #else /* IMPS_PROF_TEST_CODE */ 
  2511.     if (pfnUnicodeStrlen((S8*) edit_prof->server) == 0)
  2512.     {
  2513.         pfnUnicodeStrcpy((S8*) edit_prof->server, (S8*) g_imps_server_prefix);
  2514.     }
  2515. #endif /* IMPS_PROF_TEST_CODE */ 
  2516.     SetInlineItemActivation(&wgui_inline_items[2], KEY_LSK, KEY_EVENT_UP);
  2517.     SetInlineItemCaption(&wgui_inline_items[2], (U8*) GetString(STR_ID_IMPS_SERVER));
  2518.     SetInlineItemActivation(&wgui_inline_items[3], KEY_LSK, KEY_EVENT_UP);
  2519.     SetInlineItemFullScreenEdit(
  2520.         &wgui_inline_items[3],
  2521.         STR_ID_IMPS_SERVER,
  2522.         GetRootTitleIcon(MENU_ID_IMPS_MAIN),
  2523.         (U8*) edit_prof->server,
  2524.         IMPS_MAX_SERVER_ADDRESS_LEN,
  2525.         INPUT_TYPE_USE_ONLY_ENGLISH_MODES | INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
  2526.     SetInlineFullScreenEditCustomFunction(&wgui_inline_items[3], mmi_imps_hilite_prof_full_edit);
  2527.     /* User Name */
  2528.     if (pfnUnicodeStrlen((S8*) edit_prof->username) == 0)
  2529.     {
  2530.         pfnUnicodeStrcpy((S8*) edit_prof->username, (S8*) g_imps_wv);
  2531.     }
  2532.     SetInlineItemActivation(&wgui_inline_items[4], KEY_LSK, KEY_EVENT_UP);
  2533.     SetInlineItemCaption(&wgui_inline_items[4], (U8*) GetString(STR_ID_IMPS_USERNAME));
  2534.     SetInlineItemActivation(&wgui_inline_items[5], KEY_LSK, KEY_EVENT_UP);
  2535.     SetInlineItemFullScreenEdit(
  2536.         &wgui_inline_items[5],
  2537.         STR_ID_IMPS_USERNAME,
  2538.         GetRootTitleIcon(MENU_ID_IMPS_MAIN),
  2539.         (U8*) edit_prof->username,
  2540.         IMPS_MAX_NAME_LEN,
  2541.         INPUT_TYPE_USE_ONLY_ENGLISH_MODES | INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
  2542.     SetInlineFullScreenEditCustomFunction(&wgui_inline_items[5], mmi_imps_hilite_prof_full_edit);
  2543.     SetInlineItemActivation(&wgui_inline_items[6], KEY_LSK, KEY_EVENT_UP);
  2544.     SetInlineItemCaption(&wgui_inline_items[6], (U8*) GetString(STR_ID_IMPS_PASSWD));
  2545.     SetInlineItemActivation(&wgui_inline_items[7], KEY_LSK, KEY_EVENT_UP);
  2546.     SetInlineItemFullScreenEdit(
  2547.         &wgui_inline_items[7],
  2548.         STR_ID_IMPS_PASSWD,
  2549.         GetRootTitleIcon(MENU_ID_IMPS_MAIN),
  2550.         (U8*) edit_prof->passwd,
  2551.         IMPS_MAX_PASSWORD_LEN,
  2552.         INPUT_TYPE_USE_ONLY_ENGLISH_MODES | INPUT_TYPE_ALPHANUMERIC_PASSWORD);
  2553.     SetInlineFullScreenEditCustomFunction(&wgui_inline_items[7], mmi_imps_hilite_prof_full_edit);
  2554.     /* Auto Login */
  2555.     SetInlineItemActivation(&wgui_inline_items[8], KEY_LSK, KEY_EVENT_UP);
  2556.     SetInlineItemCaption(&wgui_inline_items[8], (U8*) GetString(STR_ID_IMPS_AUTO_LOGIN));
  2557.     SetInlineItemActivation(&wgui_inline_items[9], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  2558.     SetInlineItemSelect(&wgui_inline_items[9], 2, imps_p->prof_misc->yes_no_list, &edit_prof->auto_login);
  2559.     /* Auto Login */
  2560.     SetInlineItemActivation(&wgui_inline_items[10], KEY_LSK, KEY_EVENT_UP);
  2561.     SetInlineItemCaption(&wgui_inline_items[10], (U8*) GetString(STR_ID_IMPS_AUTO_UPDATE));
  2562.     SetInlineItemActivation(&wgui_inline_items[11], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  2563.     SetInlineItemSelect(&wgui_inline_items[11], 2, imps_p->prof_misc->yes_no_list, &edit_prof->auto_update);
  2564. }
  2565. /*****************************************************************************
  2566.  * FUNCTION
  2567.  *  mmi_imps_pre_entry_prof_conn
  2568.  * DESCRIPTION
  2569.  *  Pre-entry function for connection setting
  2570.  * PARAMETERS
  2571.  *  void
  2572.  * RETURNS
  2573.  *  void
  2574.  *****************************************************************************/
  2575. void mmi_imps_pre_entry_prof_conn(void)
  2576. {
  2577.     /*----------------------------------------------------------------*/
  2578.     /* Local Variables                                                */
  2579.     /*----------------------------------------------------------------*/
  2580.     /*----------------------------------------------------------------*/
  2581.     /* Code Body                                                      */
  2582.     /*----------------------------------------------------------------*/
  2583.     mmi_imps_prof_read_nvram(IMPS_NVRAM_PROF_EDIT);
  2584.     mmi_imps_entry_prof_conn();
  2585. }
  2586. /*****************************************************************************
  2587.  * FUNCTION
  2588.  *  mmi_imps_entry_prof_conn
  2589.  * DESCRIPTION
  2590.  *  Entry inline editor screen of Connection Setting
  2591.  * PARAMETERS
  2592.  *  void
  2593.  * RETURNS
  2594.  *  void
  2595.  *****************************************************************************/
  2596. void mmi_imps_entry_prof_conn(void)
  2597. {
  2598.     /*----------------------------------------------------------------*/
  2599.     /* Local Variables                                                */
  2600.     /*----------------------------------------------------------------*/
  2601.     U8 *guiBuffer;
  2602.     U8 *inputBuffer;
  2603.     U16 inputBufferSize;
  2604.     /*----------------------------------------------------------------*/
  2605.     /* Code Body                                                      */
  2606.     /*----------------------------------------------------------------*/
  2607.     EntryNewScreen(SCR_ID_IMPS_PROF_SETTING, mmi_imps_exit_prof_conn, NULL, NULL);
  2608.     InitializeCategory57Screen();
  2609.     mmi_imps_prof_conn_fill_inline_struct();
  2610.     guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_PROF_SETTING);
  2611.     inputBuffer = GetCurrNInputBuffer(SCR_ID_IMPS_PROF_SETTING, &inputBufferSize);
  2612.     if (inputBuffer != NULL)
  2613.     {
  2614.         SetCategory57Data(wgui_inline_items, IMPS_INLINE_PROF_CONN, inputBuffer);
  2615.     }
  2616.     ShowCategory57Screen(
  2617.         STR_ID_IMPS_PROF_CONN,
  2618.         GetRootTitleIcon(MENU_ID_IMPS_MAIN),
  2619.         STR_GLOBAL_EDIT,
  2620.         IMG_GLOBAL_BACK,
  2621.         STR_GLOBAL_DONE,
  2622.         IMG_GLOBAL_BACK,
  2623.         IMPS_INLINE_PROF_CONN,
  2624.         (U16*) g_imps_inline_icons,
  2625.         wgui_inline_items,
  2626.         0,
  2627.         guiBuffer);
  2628.     SetCategory57RightSoftkeyFunctions(mmi_imps_prof_save, GoBackHistory);
  2629. }
  2630. /*****************************************************************************
  2631.  * FUNCTION
  2632.  *  mmi_imps_exit_prof_conn
  2633.  * DESCRIPTION
  2634.  *  Exit function for inlnine editor screen of Connection Setting
  2635.  * PARAMETERS
  2636.  *  void
  2637.  * RETURNS
  2638.  *  void
  2639.  *****************************************************************************/
  2640. void mmi_imps_exit_prof_conn(void)
  2641. {
  2642.     /*----------------------------------------------------------------*/
  2643.     /* Local Variables                                                */
  2644.     /*----------------------------------------------------------------*/
  2645.     /*----------------------------------------------------------------*/
  2646.     /* Code Body                                                      */
  2647.     /*----------------------------------------------------------------*/
  2648.     set_leading_zero(TRUE);
  2649.     GenericExitInlineScreen(SCR_ID_IMPS_PROF_SETTING, mmi_imps_entry_prof_conn);
  2650. }
  2651. /*****************************************************************************
  2652.  * FUNCTION
  2653.  *  mmi_imps_prof_conn_fill_inline_struct
  2654.  * DESCRIPTION
  2655.  *  Fill inline editor structure of profile.
  2656.  * PARAMETERS
  2657.  *  void
  2658.  * RETURNS
  2659.  *  void
  2660.  *****************************************************************************/
  2661. void mmi_imps_prof_conn_fill_inline_struct(void)
  2662. {
  2663.     /*----------------------------------------------------------------*/
  2664.     /* Local Variables                                                */
  2665.     /*----------------------------------------------------------------*/
  2666.     /*----------------------------------------------------------------*/
  2667.     /* Code Body                                                      */
  2668.     /*----------------------------------------------------------------*/
  2669.     /* Yes/No */
  2670.     imps_p->prof_misc->yes_no_list[0] = (U8*) GetString(STR_GLOBAL_NO);
  2671.     imps_p->prof_misc->yes_no_list[1] = (U8*) GetString(STR_GLOBAL_YES);
  2672.     /* WAP/HTTP */
  2673.     imps_p->prof_misc->wap_http_list[0] = (U8*) GetString(STR_ID_IMPS_HTTP);
  2674.     imps_p->prof_misc->wap_http_list[1] = (U8*) GetString(STR_ID_IMPS_WAP);
  2675.     set_leading_zero(FALSE);
  2676.     /* Data Account */
  2677.     SetInlineItemActivation(&wgui_inline_items[0], KEY_LSK, KEY_EVENT_UP);
  2678.     SetInlineItemCaption(&wgui_inline_items[0], (U8*) GetString(STR_ID_IMPS_DATA_ACCT));
  2679.     SetInlineItemActivation(&wgui_inline_items[1], KEY_LSK, KEY_EVENT_UP);
  2680.     SetInlineItemImageText(
  2681.         &wgui_inline_items[1],
  2682.         (U8*) imps_p->prof_misc->dt_acct_name,
  2683.         (PU8) NULL,
  2684.         NULL,
  2685.         NULL,
  2686.         MAX_DATA_ACCOUNT_NAME_LEN,
  2687.         0,
  2688.         0,
  2689.         INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
  2690.     SetInlineFullScreenEditCustomFunctionImageText(&wgui_inline_items[1], mmi_imps_prof_list_data_acct);
  2691.     ShowAsControl(&wgui_inline_items[1]);
  2692.     /* Connection type */
  2693.     SetInlineItemActivation(&wgui_inline_items[2], KEY_LSK, KEY_EVENT_UP);
  2694.     SetInlineItemCaption(&wgui_inline_items[2], (U8*) GetString(STR_ID_IMPS_CONN_TYPE));
  2695.     SetInlineItemActivation(&wgui_inline_items[3], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  2696.     SetInlineItemSelect(
  2697.         &wgui_inline_items[3],
  2698.         2,
  2699.         imps_p->prof_misc->wap_http_list,
  2700.         &imps_p->prof_misc->edit_prof.conn_type);
  2701.     /* Use proxy */
  2702.     SetInlineItemActivation(&wgui_inline_items[4], KEY_LSK, KEY_EVENT_UP);
  2703.     SetInlineItemCaption(&wgui_inline_items[4], (U8*) GetString(STR_ID_IMPS_USE_PROXY));
  2704.     SetInlineItemActivation(&wgui_inline_items[5], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  2705.     SetInlineItemSelect(
  2706.         &wgui_inline_items[5],
  2707.         2,
  2708.         imps_p->prof_misc->yes_no_list,
  2709.         &imps_p->prof_misc->edit_prof.use_proxy);
  2710.     /* Proxy server */
  2711.     SetInlineItemActivation(&wgui_inline_items[6], KEY_LSK, KEY_EVENT_UP);
  2712.     SetInlineItemCaption(&wgui_inline_items[6], (U8*) GetString(STR_ID_IMPS_PROXY_SERVER));
  2713.     SetInlineItemActivation(&wgui_inline_items[7], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  2714.     SetInlineItemIP4(
  2715.         &wgui_inline_items[7],
  2716.         (U8*) imps_p->prof_misc->edit_prof.proxy_ip[0],
  2717.         (U8*) imps_p->prof_misc->edit_prof.proxy_ip[1],
  2718.         (U8*) imps_p->prof_misc->edit_prof.proxy_ip[2],
  2719.         (U8*) imps_p->prof_misc->edit_prof.proxy_ip[3],
  2720.         mmi_imps_prof_ip_addr_callback);
  2721.     SetInlineItemActivation(&wgui_inline_items[8], KEY_LSK, KEY_EVENT_UP);
  2722.     SetInlineItemCaption(&wgui_inline_items[8], (U8*) GetString(STR_ID_IMPS_PROXY_PORT));
  2723.     SetInlineItemActivation(&wgui_inline_items[9], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  2724.     SetInlineItemTextEdit(
  2725.         &wgui_inline_items[9],
  2726.         (U8*) imps_p->prof_misc->edit_prof.proxy_port,
  2727.         IMPS_PROF_PORT_LEN,
  2728.         INPUT_TYPE_NUMERIC);
  2729.     RightJustifyInlineItem(&wgui_inline_items[9]);
  2730.     EnableInlineItemBoundary(&wgui_inline_items[9]);
  2731.     DisableInlineItemHighlight(&wgui_inline_items[9]);
  2732.     /* Proxy User Name */
  2733.     SetInlineItemActivation(&wgui_inline_items[10], KEY_LSK, KEY_EVENT_UP);
  2734.     SetInlineItemCaption(&wgui_inline_items[10], (U8*) GetString(STR_ID_IMPS_PROXY_USERNAME));
  2735.     SetInlineItemActivation(&wgui_inline_items[11], KEY_LSK, KEY_EVENT_UP);
  2736.     SetInlineItemFullScreenEdit(
  2737.         &wgui_inline_items[11],
  2738.         STR_ID_IMPS_USERNAME,
  2739.         GetRootTitleIcon(MENU_ID_IMPS_MAIN),
  2740.         (U8*) imps_p->prof_misc->edit_prof.proxy_username,
  2741.         IMPS_MAX_NAME_LEN,
  2742.         INPUT_TYPE_USE_ONLY_ENGLISH_MODES | INPUT_TYPE_ALPHANUMERIC_SENTENCECASE);
  2743.     SetInlineFullScreenEditCustomFunction(&wgui_inline_items[11], mmi_imps_hilite_prof_full_edit);
  2744.     /* Proxy Password */
  2745.     SetInlineItemActivation(&wgui_inline_items[12], KEY_LSK, KEY_EVENT_UP);
  2746.     SetInlineItemCaption(&wgui_inline_items[12], (U8*) GetString(STR_ID_IMPS_PROXY_PASSWD));
  2747.     SetInlineItemActivation(&wgui_inline_items[13], KEY_LSK, KEY_EVENT_UP);
  2748.     SetInlineItemFullScreenEdit(
  2749.         &wgui_inline_items[13],
  2750.         STR_ID_IMPS_PASSWD,
  2751.         GetRootTitleIcon(MENU_ID_IMPS_MAIN),
  2752.         (U8*) imps_p->prof_misc->edit_prof.proxy_passwd,
  2753.         IMPS_MAX_PASSWORD_LEN,
  2754.         INPUT_TYPE_USE_ONLY_ENGLISH_MODES | INPUT_TYPE_ALPHANUMERIC_PASSWORD);
  2755.     SetInlineFullScreenEditCustomFunction(&wgui_inline_items[13], mmi_imps_hilite_prof_full_edit);
  2756. }
  2757. /*****************************************************************************
  2758.  * FUNCTION
  2759.  *  mmi_imps_prof_ip_addr_callback
  2760.  * DESCRIPTION
  2761.  *  Callback function for IP address editor in inline editor screen
  2762.  * PARAMETERS
  2763.  *  string_buffer       [?]     
  2764.  *  IP1                 [?]     
  2765.  *  IP2                 [?]     
  2766.  *  IP3                 [?]     
  2767.  *  IP4                 [?]     
  2768.  * RETURNS
  2769.  *  void
  2770.  *****************************************************************************/
  2771. void mmi_imps_prof_ip_addr_callback(U8 *string_buffer, U8 *IP1, U8 *IP2, U8 *IP3, U8 *IP4)
  2772. {
  2773.     /*----------------------------------------------------------------*/
  2774.     /* Local Variables                                                */
  2775.     /*----------------------------------------------------------------*/
  2776.     U8 Point[4];
  2777.     /*----------------------------------------------------------------*/
  2778.     /* Code Body                                                      */
  2779.     /*----------------------------------------------------------------*/
  2780.     AnsiiToUnicodeString((S8*) Point, (S8*) ".");
  2781.     pfnUnicodeStrcpy((PS8) string_buffer, (PS8) IP1);
  2782.     pfnUnicodeStrcat((PS8) string_buffer, (PS8) Point);
  2783.     pfnUnicodeStrcat((PS8) string_buffer, (PS8) IP2);
  2784.     pfnUnicodeStrcat((PS8) string_buffer, (PS8) Point);
  2785.     pfnUnicodeStrcat((PS8) string_buffer, (PS8) IP3);
  2786.     pfnUnicodeStrcat((PS8) string_buffer, (PS8) Point);
  2787.     pfnUnicodeStrcat((PS8) string_buffer, (PS8) IP4);
  2788. }
  2789. /*****************************************************************************
  2790.  * FUNCTION
  2791.  *  mmi_imps_hilite_prof_full_edit
  2792.  * DESCRIPTION
  2793.  *  Highlight handler of all common full screen eidtor.
  2794.  * PARAMETERS
  2795.  *  void
  2796.  * RETURNS
  2797.  *  void
  2798.  *****************************************************************************/
  2799. void mmi_imps_hilite_prof_full_edit(void)
  2800. {
  2801.     /*----------------------------------------------------------------*/
  2802.     /* Local Variables                                                */
  2803.     /*----------------------------------------------------------------*/
  2804.     /*----------------------------------------------------------------*/
  2805.     /* Code Body                                                      */
  2806.     /*----------------------------------------------------------------*/
  2807.     ChangeLeftSoftkey(STR_GLOBAL_OPTIONS, 0);
  2808.     SetLeftSoftkeyFunction(mmi_imps_entry_comm_full_edit_opt, KEY_EVENT_UP);
  2809. }
  2810. /*****************************************************************************
  2811.  * FUNCTION
  2812.  *  mmi_imps_entry_comm_full_edit_opt
  2813.  * DESCRIPTION
  2814.  *  Entry common full screen editor in Profile.
  2815.  * PARAMETERS
  2816.  *  void
  2817.  * RETURNS
  2818.  *  void
  2819.  *****************************************************************************/
  2820. void mmi_imps_entry_comm_full_edit_opt(void)
  2821. {
  2822.     /*----------------------------------------------------------------*/
  2823.     /* Local Variables                                                */
  2824.     /*----------------------------------------------------------------*/
  2825.     U8 *guiBuffer;
  2826.     U16 itemList[2];
  2827.     U16 nItems;
  2828.     /*----------------------------------------------------------------*/
  2829.     /* Code Body                                                      */
  2830.     /*----------------------------------------------------------------*/
  2831.     EntryNewScreen(SCR_ID_IMPS_COMM_FULL_EDIT_OPT, NULL, mmi_imps_entry_comm_full_edit_opt, NULL);
  2832.     SetParentHandler(MENU_ID_IMPS_PROF_EDITOR_OPT);
  2833.     guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_COMM_FULL_EDIT_OPT);
  2834.     nItems = GetNumOfChild(MENU_ID_IMPS_PROF_EDITOR_OPT);
  2835.     GetSequenceStringIds(MENU_ID_IMPS_PROF_EDITOR_OPT, itemList);
  2836.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  2837.     ShowCategory52Screen(
  2838.         STR_GLOBAL_OPTIONS,
  2839.         GetRootTitleIcon(MENU_ID_IMPS_MAIN),
  2840.         STR_GLOBAL_OK,
  2841.         IMG_GLOBAL_OK,
  2842.         STR_GLOBAL_BACK,
  2843.         IMG_GLOBAL_BACK,
  2844.         nItems,
  2845.         itemList,
  2846.         (PU16) gIndexIconsImageList,
  2847.         0,
  2848.         0,
  2849.         0,
  2850.         guiBuffer);
  2851.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  2852. }
  2853. /*****************************************************************************
  2854.  * FUNCTION
  2855.  *  mmi_imps_hilite_prof_done
  2856.  * DESCRIPTION
  2857.  *  Highlight handler of all common full screen eidtor -> Done option
  2858.  * PARAMETERS
  2859.  *  void
  2860.  * RETURNS
  2861.  *  void
  2862.  *****************************************************************************/
  2863. void mmi_imps_hilite_prof_done(void)
  2864. {
  2865.     /*----------------------------------------------------------------*/
  2866.     /* Local Variables                                                */
  2867.     /*----------------------------------------------------------------*/
  2868.     /*----------------------------------------------------------------*/
  2869.     /* Code Body                                                      */
  2870.     /*----------------------------------------------------------------*/
  2871.     SetLeftSoftkeyFunction(ConfirmInlineFullScreenEdit, KEY_EVENT_UP);
  2872. }
  2873. /*****************************************************************************
  2874. * FUNCTION
  2875. * mmi_imps_prof_gprs_dt_callback
  2876. * DESCRIPTION
  2877. * Callback function for GPRS Data Account
  2878. * PARAMETERS
  2879. * index    IN    highlight index of selected account
  2880. * RETURNS
  2881. * None.
  2882. * GLOBALS AFFECTED
  2883. * None.
  2884. *****************************************************************************/
  2885. void mmi_imps_prof_gprs_dt_callback_(U16 account_id)
  2886. {
  2887.    imps_p->prof_misc->edit_prof.curr_dt_acct = (U8)account_id;
  2888.    mmi_dtcnt_get_account_name((U8)account_id, (S8*)imps_p->prof_misc->dt_acct_name, MAX_DATA_ACCOUNT_NAME_LEN);
  2889.    DeleteUptoScrID(SCR_ID_IMPS_PROF_SETTING);
  2890.    GoBackHistory();
  2891.    SetInlineListMenuChanged();
  2892. }
  2893. /*****************************************************************************
  2894.  * FUNCTION
  2895.  *  mmi_imps_prof_gprs_dt_callback
  2896.  * DESCRIPTION
  2897.  *  Callback function for GPRS Data Account
  2898.  * PARAMETERS
  2899.  *  index       [IN]        Highlight index of selected account
  2900.  * RETURNS
  2901.  *  void
  2902.  *****************************************************************************/
  2903. void mmi_imps_prof_gprs_dt_callback(U16 index)
  2904. {
  2905.     /*----------------------------------------------------------------*/
  2906.     /* Local Variables                                                */
  2907.     /*----------------------------------------------------------------*/
  2908.     /*----------------------------------------------------------------*/
  2909.     /* Code Body                                                      */
  2910.     /*----------------------------------------------------------------*/
  2911. /*   pfnUnicodeStrncpy((S8*)imps_p->prof_misc->dt_acct_name,
  2912.                    (S8*)g_GPRS_DataAccount[index].DataAccountName,
  2913.                    MAX_DATA_ACCOUNT_NAME_LEN);
  2914.    imps_p->prof_misc->edit_prof.curr_dt_acct = (U8)(index + MAX_DATA_ACCOUNT_GSM_LIMIT);
  2915.    DeleteUptoScrID(SCR_ID_IMPS_PROF_SETTING);
  2916.    GoBackHistory();
  2917.    SetInlineListMenuChanged();*/
  2918. }
  2919. /*****************************************************************************
  2920.  * FUNCTION
  2921.  *  mmi_imps_prof_list_data_acct
  2922.  * DESCRIPTION
  2923.  *  LSK handler of Data Account item in Profile Setting inline editor screen.
  2924.  * PARAMETERS
  2925.  *  void
  2926.  * RETURNS
  2927.  *  void
  2928.  *****************************************************************************/
  2929. void mmi_imps_prof_list_data_acct(void)
  2930. {
  2931.     /*----------------------------------------------------------------*/
  2932.     /* Local Variables                                                */
  2933.     /*----------------------------------------------------------------*/
  2934.     /*----------------------------------------------------------------*/
  2935.     /* Code Body                                                      */
  2936.     /*----------------------------------------------------------------*/
  2937.     mmi_dtcnt_select_account(mmi_imps_prof_gprs_dt_callback_, MENU_ID_IMPS_MAIN, DATA_ACCOUNT_BEARER_GPRS | DATA_ACCOUNT_BEARER_WIFI);
  2938. }
  2939. #define ABOUT_ME_IMPS
  2940. /*****************************************************************************
  2941.  * FUNCTION
  2942.  *  mmi_imps_hilite_about_me
  2943.  * DESCRIPTION
  2944.  *  Hilite handler of Contact List -> About Me option
  2945.  * PARAMETERS
  2946.  *  void
  2947.  * RETURNS
  2948.  *  void
  2949.  *****************************************************************************/
  2950. void mmi_imps_hilite_about_me(void)
  2951. {
  2952.     /*----------------------------------------------------------------*/
  2953.     /* Local Variables                                                */
  2954.     /*----------------------------------------------------------------*/
  2955.     /*----------------------------------------------------------------*/
  2956.     /* Code Body                                                      */
  2957.     /*----------------------------------------------------------------*/
  2958.     SetLeftSoftkeyFunction(mmi_imps_pre_entry_about_me, KEY_EVENT_UP);
  2959. }
  2960. /*****************************************************************************
  2961.  * FUNCTION
  2962.  *  mmi_imps_pre_entry_about_me
  2963.  * DESCRIPTION
  2964.  *  Pre-Entry function of inline editor screen for About Me.
  2965.  * PARAMETERS
  2966.  *  void
  2967.  * RETURNS
  2968.  *  void
  2969.  *****************************************************************************/
  2970. void mmi_imps_pre_entry_about_me(void)
  2971. {
  2972.     /*----------------------------------------------------------------*/
  2973.     /* Local Variables                                                */
  2974.     /*----------------------------------------------------------------*/
  2975.     mmi_imps_nvram_struct *nvram_buff;
  2976.     /*----------------------------------------------------------------*/
  2977.     /* Code Body                                                      */
  2978.     /*----------------------------------------------------------------*/
  2979.     /* prevent the user from entering when contact list not ready */
  2980.     if (!imps_p->gen_info.auto_update_done)
  2981.     {
  2982.         mmi_imps_util_disp_warning_popup(STR_ID_IMPS_ERR_CONT_NOT_READY);
  2983.         return;
  2984.     }
  2985.     nvram_buff = (mmi_imps_nvram_struct*) OslMalloc(sizeof(mmi_imps_nvram_struct));
  2986.     /* read data from NVRAM */
  2987.     if (imps_p->about_info == NULL)
  2988.     {
  2989.         imps_p->about_info = OslMalloc(sizeof(mmi_imps_about_me_struct));
  2990.         memset(imps_p->about_info, 0, sizeof(mmi_imps_about_me_struct));
  2991.     }
  2992.     /* retrieve data from NVRAM */
  2993.     mmi_imps_util_read_nvram((void*)nvram_buff);
  2994.     /* status */
  2995.     imps_p->about_info->status = (S32) nvram_buff->about_me.status;
  2996.     imps_p->about_info->mood = (S32) nvram_buff->about_me.mood;
  2997.     /* my profile */
  2998.     pfnUnicodeStrcpy((S8*) imps_p->about_info->my_prof, (S8*) nvram_buff->about_me.my_prof);
  2999.     /* my picture */
  3000.     imps_p->about_info->is_pic = (S32) nvram_buff->about_me.is_pic;
  3001.     if (imps_p->about_info->is_pic)
  3002.     {
  3003.         mmi_imps_util_get_img_path((S8*) imps_p->about_info->my_pic);
  3004.         pfnUnicodeStrcat((S8*) imps_p->about_info->my_pic, (S8*) IMPS_ABOUT_PIC_PREFIX);
  3005.         pfnUnicodeStrcat(
  3006.             (S8*) imps_p->about_info->my_pic,
  3007.             (S8*) mmi_fmgr_extract_ext_file_name((S8*) nvram_buff->about_me.pic_name));
  3008.         pfnUnicodeStrcpy((S8*) imps_p->about_info->file_buff, (S8*) imps_p->about_info->my_pic);
  3009.         pfnUnicodeStrcpy((S8*) imps_p->about_info->pic_name, (S8*) nvram_buff->about_me.pic_name);
  3010.     }
  3011.     OslMfree(nvram_buff);
  3012.     mmi_imps_entry_about_me();
  3013. }
  3014. /*****************************************************************************
  3015.  * FUNCTION
  3016.  *  mmi_imps_entry_about_me
  3017.  * DESCRIPTION
  3018.  *  Entry inline editor screen for About Me.
  3019.  * PARAMETERS
  3020.  *  void
  3021.  * RETURNS
  3022.  *  void
  3023.  *****************************************************************************/
  3024. void mmi_imps_entry_about_me(void)
  3025. {
  3026.     /*----------------------------------------------------------------*/
  3027.     /* Local Variables                                                */
  3028.     /*----------------------------------------------------------------*/
  3029.     U8 *guiBuffer;
  3030.     U8 *inputBuffer;
  3031.     U16 inputBufferSize;
  3032.     /*----------------------------------------------------------------*/
  3033.     /* Code Body                                                      */
  3034.     /*----------------------------------------------------------------*/
  3035.     EntryNewScreen(SCR_ID_IMPS_ABOUT_ME_INLINE, mmi_imps_exit_about_me, NULL, NULL);
  3036.     InitializeCategory57Screen();
  3037.     mmi_imps_about_me_fill_inline_struct();
  3038.     guiBuffer = GetCurrGuiBuffer(SCR_ID_IMPS_ABOUT_ME_INLINE);