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

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.  * JBrowserMMIServiceInbox.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  *   MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *   This file is intends for service inbox implementation.
  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.  *------------------------------------------------------------------------------
  88.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  89.  *============================================================================
  90.  ****************************************************************************/
  91. #ifndef _MMI_JBROWSERMMISERVICEINBOX_C
  92. #define _MMI_JBROWSERMMISERVICEINBOX_C
  93. #include "MMI_features.h"
  94. #if defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT)
  95. #ifndef __MMI_UNIFIED_MESSAGE__
  96. #include "PixtelDataTypes.h"
  97. #include "Unicodexdcl.h"
  98. #include "HistoryGprot.h"
  99. #include "GlobalDefs.h"
  100. #include "SettingProfile.h"
  101. #include "DebugInitDef.h"
  102. #include "CommonScreens.h"
  103. #include "EventsGprot.h"
  104. #include "wgui_inputs.h"
  105. #include "wgui_categories.h"
  106. #include "wgui_categories_inputs.h"
  107. #include "OrganizerDef.h"
  108. #include "DateTimeGprot.h"
  109. #include "TimerEvents.h"
  110. #include "wgui_categories_popup.h"
  111. #include "settingGprots.h"
  112. #include "wgui_status_icons.h"
  113. #include "NVRAMType.h"
  114. #include "NVRAMProt.h"
  115. #include "NVRAMEnum.h"
  116. #include "ddl.h"
  117. #include "jcal.h"
  118. #include "jdd_memapi.h"
  119. #include "browserlayout.h"
  120. #include "jdi_servicehandler.h"
  121. #include "jdi_browserinterface.h"
  122. #include "fsm.h"
  123. #include "IdleAppDef.h"
  124. #include "JBrowserMMIDefs.h"
  125. #include "JBrowserMMIProts.h"
  126. #include "JBrowserMMITypes.h"
  127. #include "JBrowserMMIGprots.h"
  128. #include "JPushInboxCommonAPIs.h"
  129. #include "JPushInboxCommonUI.h"
  130. #include "time.h"
  131. #include "DateTimeGprot.h"
  132. #include "MessagesResourceData.h"
  133. #include "MessagesMiscell.h"
  134. #ifdef  __MMI_KEYPAD_LOCK_PROMPT_TEXT__
  135. #include "KeyBrd.h"
  136. #endif
  137. U8 *g_read_arrived_message_buffer = NULL;
  138. SERVICE_VALUE *g_brw_rcvd_service_msg_p = NULL;
  139. /*****************************************************************************
  140.  * FUNCTION
  141.  *  mmi_brw_entry_service_inbox
  142.  * DESCRIPTION
  143.  *  Entry function for service inbox
  144.  * PARAMETERS
  145.  *  void
  146.  * RETURNS
  147.  *  void
  148.  *****************************************************************************/
  149. void mmi_brw_entry_service_inbox(void)
  150. {
  151.     /*----------------------------------------------------------------*/
  152.     /* Local Variables                                                */
  153.     /*----------------------------------------------------------------*/
  154.     U8 *guiBuffer;
  155.     JC_UINT32 brw_total_msg_count;
  156.     JC_UINT32 brw_unread_msg_count;
  157.     /*----------------------------------------------------------------*/
  158.     /* Code Body                                                      */
  159.     /*----------------------------------------------------------------*/
  160.     mmi_brw_get_push_statistics(&brw_total_msg_count, &brw_unread_msg_count);
  161.     /* While reading the messsage from idle screen when user will press back. 
  162.        at that time while displying the message list local buffer should clear
  163.        Vivek - 12082006 */
  164.     mmi_brw_push_free_service_value_struct(&g_current_service_message);
  165.     g_brw_cntx.push_msg_rcvd_flag = MMI_FALSE;
  166.     g_mmi_brw_delete_push_notification = MMI_FALSE;
  167.     /* Display 'Empty' if no push messages are present */
  168.     if ((brw_total_msg_count) == 0)
  169.     {
  170.         DisplayPopup((PU8) GetString(STR_GLOBAL_EMPTY), IMG_GLOBAL_EMPTY, 1, UI_POPUP_NOTIFYDURATION_TIME, EMPTY_LIST_TONE);
  171.         /* Added by Vivek - 30july, 2006. If push inbox is open from the 'idle screen 
  172.            push indication'. After showing the empty pop up it should return to 
  173.            idle screen */
  174.         if (SCR_ID_BRW_NEW_PUSH_MESSAGE_IND == GetCurrScrnId())
  175.         {
  176.             DeleteNHistory(1);
  177.         }
  178.     }
  179.     else
  180.     {
  181.         EntryNewScreen(SCR_ID_BRW_SERVICE_INBOX, NULL, mmi_brw_entry_service_inbox, NULL);
  182.         /* Added by Vivek - 11july, 2006. If push inbox is open from the 'idle screen 
  183.            push indication' */
  184.         if (SCR_ID_BRW_NEW_PUSH_MESSAGE_IND == GetCurrScrnId())
  185.         {
  186.             DeleteNHistory(1);
  187.         }
  188.         guiBuffer = GetCurrGuiBuffer(SCR_ID_BRW_SERVICE_INBOX);
  189.         mmi_brw_create_push_msg_list();
  190.         ShowCategory184Screen(
  191.             STR_ID_BRW_SERVICE_INBOX,
  192.             GetRootTitleIcon(SERVICES_WAP_MENU_ID),
  193.             STR_GLOBAL_OPTIONS,
  194.             0,
  195.             STR_GLOBAL_BACK,
  196.             0,
  197.             brw_total_msg_count,
  198.             mmi_brw_service_inbox_list_get_item,
  199.             0,
  200.             0,
  201.             guiBuffer);
  202.         SetLeftSoftkeyFunction(mmi_brw_highlighted_push_msg, KEY_EVENT_UP);
  203.         SetKeyHandler(mmi_brw_highlighted_push_msg, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  204.         SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  205.         SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  206.     }
  207. }
  208. /*****************************************************************************
  209.  * FUNCTION
  210.  *  mmi_brw_service_inbox_list_get_item
  211.  * DESCRIPTION
  212.  *  Item call back function for dynamic list of push messages
  213.  * PARAMETERS
  214.  *  item_index          [IN]        
  215.  *  str_buff            [IN]        
  216.  *  img_buff_p          [?]         
  217.  *  str_img_mask        [IN]        
  218.  * RETURNS
  219.  *  void
  220.  *****************************************************************************/
  221. pBOOL mmi_brw_service_inbox_list_get_item(S32 item_index, UI_string_type str_buff, PU8 *img_buff_p, U8 str_img_mask)
  222. {
  223.     /*----------------------------------------------------------------*/
  224.     /* Local Variables                                                */
  225.     /*----------------------------------------------------------------*/
  226.     struct tm expiry_timestamp = {0};
  227.     time_t expiry_secs_since_1970 = {0};
  228.     time_t current_secs_since_1970 = {0};
  229.     U32 rcvd_message_href_len = 0;
  230.     /*----------------------------------------------------------------*/
  231.     /* Code Body                                                      */
  232.     /*----------------------------------------------------------------*/
  233.     if ((item_index < 0) || (item_index > g_max_push_messages))
  234.     {
  235.         return FALSE;
  236.     }
  237.     /* Edited by Vivek - 5th july 2006 */
  238.     if (g_brw_service_msg_list_p[item_index]->service_flag == SERVICE_INDICATION)
  239.     {
  240.         if ((NULL == g_brw_service_msg_list_p[item_index]->pmMessage) ||
  241.             !pfnUnicodeStrlen((S8*) g_brw_service_msg_list_p[item_index]->pmMessage))
  242.         {
  243.             rcvd_message_href_len = pfnUnicodeStrlen((S8*) g_brw_service_msg_list_p[item_index]->pmHref);
  244.             if (rcvd_message_href_len > MAX_SUBMENU_CHARACTERS - 1)
  245.             {
  246.                 pfnUnicodeStrncpy(
  247.                     (S8*) str_buff,
  248.                     (S8*) g_brw_service_msg_list_p[item_index]->pmHref,
  249.                     MAX_SUBMENU_CHARACTERS - 3);
  250.                 pfnUnicodeStrcat((S8*) str_buff, "...");
  251.             }
  252.             else
  253.             {
  254.                 pfnUnicodeStrcpy((S8*) str_buff, (S8*) g_brw_service_msg_list_p[item_index]->pmHref);
  255.             }
  256.         }
  257.         else
  258.         {
  259.             rcvd_message_href_len = pfnUnicodeStrlen((S8*) g_brw_service_msg_list_p[item_index]->pmMessage);
  260.             if (rcvd_message_href_len > MAX_SUBMENU_CHARACTERS - 1)
  261.             {
  262.                 pfnUnicodeStrncpy(
  263.                     (S8*) str_buff,
  264.                     (S8*) g_brw_service_msg_list_p[item_index]->pmMessage,
  265.                     MAX_SUBMENU_CHARACTERS - 3);
  266.                 pfnUnicodeStrcat((S8*) str_buff, "...");
  267.             }
  268.             else
  269.             {
  270.                 pfnUnicodeStrcpy((S8*) str_buff, (S8*) g_brw_service_msg_list_p[item_index]->pmMessage);
  271.             }
  272.         }
  273.     }
  274.     else if (g_brw_service_msg_list_p[item_index]->service_flag == SERVICE_LOADING)
  275.     {
  276.         rcvd_message_href_len = pfnUnicodeStrlen((S8*) g_brw_service_msg_list_p[item_index]->pmHref);
  277.         if (rcvd_message_href_len > MAX_SUBMENU_CHARACTERS - 1)
  278.         {
  279.             pfnUnicodeStrncpy(
  280.                 (S8*) str_buff,
  281.                 (S8*) g_brw_service_msg_list_p[item_index]->pmHref,
  282.                 MAX_SUBMENU_CHARACTERS - 3);
  283.             pfnUnicodeStrcat((S8*) str_buff, "...");
  284.         }
  285.         else
  286.         {
  287.             pfnUnicodeStrcpy((S8*) str_buff, (S8*) g_brw_service_msg_list_p[item_index]->pmHref);
  288.         }
  289.     }
  290.     else
  291.     {
  292.         /* ERROR */
  293.     }
  294.     /* Expiry time is to be calculated in case of SI to display expired message in case of expired message */
  295.     if (g_brw_service_msg_list_p[item_index]->service_flag == SERVICE_INDICATION)
  296.     {
  297.         if (g_brw_service_msg_list_p[item_index]->pSIExpires != NULL)
  298.         {
  299.             expiry_timestamp.tm_mon = g_brw_service_msg_list_p[item_index]->pSIExpires->month - 1;      /* month scale to 0 to 11 */
  300.             expiry_timestamp.tm_year = g_brw_service_msg_list_p[item_index]->pSIExpires->year - 1900;   /* offset since 1900 */
  301.             expiry_timestamp.tm_mday = g_brw_service_msg_list_p[item_index]->pSIExpires->day;
  302.             expiry_timestamp.tm_hour = g_brw_service_msg_list_p[item_index]->pSIExpires->hour;
  303.             expiry_timestamp.tm_min = g_brw_service_msg_list_p[item_index]->pSIExpires->minute;
  304.             expiry_timestamp.tm_sec = g_brw_service_msg_list_p[item_index]->pSIExpires->seconds;
  305.             /* Get difference of seconds of expiry time from 1970 (as per UTC standard) */
  306.             expiry_secs_since_1970 = (time_t) mktime(&expiry_timestamp);
  307.             /* Get difference of seconds of current time from 1970 (as per UTC standard) */
  308.             current_secs_since_1970 = get_current_utc_time();
  309.         }
  310.         /* Show icon depending on whether it is read,unread,read but expired and unread but expired */
  311.         if (g_brw_service_msg_list_p[item_index]->bIsRead == 0)
  312.         {
  313.             if ((expiry_secs_since_1970 > current_secs_since_1970) ||
  314.                 (g_brw_service_msg_list_p[item_index]->pSIExpires == NULL))
  315.             {
  316.                 *img_buff_p = get_image(IMG_ID_BRW_PUSH_UNREAD);
  317.             }
  318.             else
  319.             {
  320.                 *img_buff_p = get_image(IMG_ID_BRW_PUSH_EXPIRED_UNREAD);
  321.             }
  322.         }
  323.         else
  324.         {
  325.             if ((expiry_secs_since_1970 > current_secs_since_1970) ||
  326.                 (g_brw_service_msg_list_p[item_index]->pSIExpires == NULL))
  327.             {
  328.                 *img_buff_p = get_image(IMG_ID_BRW_PUSH_READ);
  329.             }
  330.             else
  331.             {
  332.                 *img_buff_p = get_image(IMG_ID_BRW_PUSH_EXPIRED_READ);
  333.             }
  334.         }
  335.     }
  336.     else if (g_brw_service_msg_list_p[item_index]->service_flag == SERVICE_LOADING)
  337.     {
  338.         if (g_brw_service_msg_list_p[item_index]->bIsRead == 0)
  339.         {
  340.             *img_buff_p = get_image(IMG_ID_BRW_PUSH_UNREAD);
  341.         }
  342.         else
  343.         {
  344.             *img_buff_p = get_image(IMG_ID_BRW_PUSH_READ);
  345.         }
  346.     }
  347.     else
  348.     {
  349.         /* error */
  350.     }
  351.     return TRUE;
  352. }
  353. /*****************************************************************************
  354.  * FUNCTION
  355.  *  mmi_brw_highlighted_push_msg
  356.  * DESCRIPTION
  357.  *  Function to get the highlighted push message and call appropriate function.
  358.  * PARAMETERS
  359.  *  void
  360.  * RETURNS
  361.  *  void
  362.  *****************************************************************************/
  363. void mmi_brw_highlighted_push_msg(void)
  364. {
  365.     /*----------------------------------------------------------------*/
  366.     /* Local Variables                                                */
  367.     /*----------------------------------------------------------------*/
  368.     /*----------------------------------------------------------------*/
  369.     /* Code Body                                                      */
  370.     /*----------------------------------------------------------------*/
  371.     g_brw_index_current_highlighted_item = (U8) GetHighlightedItem();
  372.     mmi_brw_entry_service_inbox_options();
  373. }
  374. /*****************************************************************************
  375.  * FUNCTION
  376.  *  mmi_brw_delete_all_push_messages
  377.  * DESCRIPTION
  378.  *  Deletes the entire recent page list
  379.  * PARAMETERS
  380.  *  void
  381.  * RETURNS
  382.  *  void
  383.  *****************************************************************************/
  384. void mmi_brw_delete_all_push_messages(void)
  385. {
  386.     /*----------------------------------------------------------------*/
  387.     /* Local Variables                                                */
  388.     /*----------------------------------------------------------------*/
  389.     U16 msg_counter;
  390.     JC_UINT32 brw_total_msg_count;
  391.     JC_UINT32 brw_unread_msg_count;
  392.     /*----------------------------------------------------------------*/
  393.     /* Code Body                                                      */
  394.     /*----------------------------------------------------------------*/
  395.     /* added by Vivek */
  396.     HideStatusIcon(STATUS_ICON_WAP);
  397.     mmi_brw_get_push_statistics(&brw_total_msg_count, &brw_unread_msg_count);
  398.     for (msg_counter = 0; msg_counter < brw_total_msg_count; msg_counter++)
  399.     {
  400.         mmi_brw_delete_push_msg(0);
  401.     }
  402.     /* Added by Vivek - 13072006 */
  403.     mmi_brw_push_free_service_value_struct(&g_current_service_message);
  404.     /* Edited By Vivek - 5 July 2006 */
  405.     /* DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_DELETED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE); */
  406.     /* Edited by Vivek - 02082006. Now instead of displaying the image IMG_GLOBAL_DELETED
  407.        we are displaying IMG_GLOBAL_ACTIVATED as we are doing in other part of browser */
  408.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE);
  409.     if (IsScreenPresent(SCR_ID_BRW_SERVICE_INBOX))
  410.     {
  411.         DeleteUptoScrID(SCR_ID_BRW_SERVICE_INBOX);
  412.     }
  413.     else    /* when message is deleted from idle screen */
  414.     {
  415.         mmi_brw_entry_service_inbox();
  416.         DeleteScreenIfPresent(SCR_ID_BRW_PUSH_MESSAGE_READ_OPTIONS);
  417.         DeleteScreenIfPresent(SCR_ID_BRW_NEW_PUSH_MESSAGE_IND);
  418.         DeleteScreenIfPresent(SCR_ID_BRW_READ_SERVICE_MESSAGE);
  419.     }
  420.     /* Save to persistant storage */
  421.     mmi_brw_save_current_push_info();
  422. }
  423. /*****************************************************************************
  424.  * FUNCTION
  425.  *  mmi_brw_entry_service_inbox_options_back
  426.  * DESCRIPTION
  427.  *  Back function for service inbox options screen.
  428.  * PARAMETERS
  429.  *  void
  430.  * RETURNS
  431.  *  void
  432.  *****************************************************************************/
  433. void mmi_brw_entry_service_inbox_options_back(void)
  434. {
  435.     /*----------------------------------------------------------------*/
  436.     /* Local Variables                                                */
  437.     /*----------------------------------------------------------------*/
  438.     /*----------------------------------------------------------------*/
  439.     /* Code Body                                                      */
  440.     /*----------------------------------------------------------------*/
  441.     /* Added by Vivek - 13072006 */
  442.     mmi_brw_push_free_service_value_struct(&g_current_service_message);
  443.     GoBackHistory();
  444. }
  445. /*****************************************************************************
  446.  * FUNCTION
  447.  *  mmi_brw_entry_service_inbox_options
  448.  * DESCRIPTION
  449.  *  Entry function for service inbox options screen.
  450.  * PARAMETERS
  451.  *  void
  452.  * RETURNS
  453.  *  void
  454.  *****************************************************************************/
  455. void mmi_brw_entry_service_inbox_options(void)
  456. {
  457.     /*----------------------------------------------------------------*/
  458.     /* Local Variables                                                */
  459.     /*----------------------------------------------------------------*/
  460.     U16 UC_list_of_items[3];
  461.     U8 *guiBuffer;
  462.     S32 num_of_items;
  463.     /*----------------------------------------------------------------*/
  464.     /* Code Body                                                      */
  465.     /*----------------------------------------------------------------*/
  466.     EntryNewScreen(SCR_ID_BRW_SERVICE_INBOX_OPTIONS, NULL, mmi_brw_entry_service_inbox_options, NULL);
  467.     guiBuffer = GetCurrGuiBuffer(SCR_ID_BRW_SERVICE_INBOX_OPTIONS);
  468.     num_of_items = GetNumOfChild(MENU_ID_BRW_PUSH_MSG_OPTIONS);
  469.     GetSequenceStringIds(MENU_ID_BRW_PUSH_MSG_OPTIONS, UC_list_of_items);
  470.     SetParentHandler(MENU_ID_BRW_PUSH_MSG_OPTIONS);
  471.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  472.     ShowCategory15Screen(
  473.         STR_ID_BRW_OPTION,
  474.         GetRootTitleIcon(SERVICES_WAP_MENU_ID),
  475.         STR_GLOBAL_OK,
  476.         0,
  477.         STR_GLOBAL_BACK,
  478.         0,
  479.         num_of_items,
  480.         UC_list_of_items,
  481.         (U16*) gIndexIconsImageList,
  482.         LIST_MENU,
  483.         0,
  484.         guiBuffer);
  485.     SetRightSoftkeyFunction(mmi_brw_entry_service_inbox_options_back, KEY_EVENT_UP);
  486.     SetKeyHandler(mmi_brw_entry_service_inbox_options_back, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  487. }
  488. /*****************************************************************************
  489.  * FUNCTION
  490.  *  mmi_brw_read_arrived_push_message_exit
  491.  * DESCRIPTION
  492.  *  Exit Function to read arrived push message form idle screen
  493.  * PARAMETERS
  494.  *  void
  495.  * RETURNS
  496.  *  void
  497.  *****************************************************************************/
  498. void mmi_brw_read_arrived_push_message_exit(void)
  499. {
  500.     /*----------------------------------------------------------------*/
  501.     /* Local Variables                                                */
  502.     /*----------------------------------------------------------------*/
  503.     /*----------------------------------------------------------------*/
  504.     /* Code Body                                                      */
  505.     /*----------------------------------------------------------------*/
  506.     if (NULL != g_read_arrived_message_buffer)
  507.     {
  508.         jdd_MemFree(g_read_arrived_message_buffer);
  509.         g_read_arrived_message_buffer = NULL;
  510.     }
  511. }
  512. /*****************************************************************************
  513.  * FUNCTION
  514.  *  mmi_brw_read_arrived_push_message
  515.  * DESCRIPTION
  516.  *  Entry Function to read arrived push message form idle screen
  517.  * PARAMETERS
  518.  *  void
  519.  * RETURNS
  520.  *  void
  521.  *****************************************************************************/
  522. void mmi_brw_read_arrived_push_message(void)
  523. {
  524.     /*----------------------------------------------------------------*/
  525.     /* Local Variables                                                */
  526.     /*----------------------------------------------------------------*/
  527.     U32 brw_total_msg_count = 0;
  528.     U32 brw_unread_msg_count = 0;
  529.     /*----------------------------------------------------------------*/
  530.     /* Code Body                                                      */
  531.     /*----------------------------------------------------------------*/
  532.     mmi_brw_get_push_statistics(&brw_total_msg_count, &brw_unread_msg_count);
  533.     if (1 == brw_unread_msg_count)
  534.     {
  535.         g_brw_index_current_highlighted_item = 0;
  536.         mmi_brw_entry_read_push_message();
  537.     }
  538.     else
  539.     {
  540.         mmi_brw_entry_service_inbox();
  541.     }
  542. }
  543. /*****************************************************************************
  544.  * FUNCTION
  545.  *  mmi_brw_new_push_msg_ind
  546.  * DESCRIPTION
  547.  *  Function to check the status whether new message is recieved
  548.  * PARAMETERS
  549.  *  void
  550.  * RETURNS
  551.  *  void
  552.  *****************************************************************************/
  553. U8 mmi_brw_new_push_msg_ind(void)
  554. {
  555.     /*----------------------------------------------------------------*/
  556.     /* Local Variables                                                */
  557.     /*----------------------------------------------------------------*/
  558.     /*----------------------------------------------------------------*/
  559.     /* Code Body                                                      */
  560.     /*----------------------------------------------------------------*/
  561.     return g_brw_cntx.push_msg_rcvd_flag;
  562. }
  563. /*****************************************************************************
  564.  * FUNCTION
  565.  *  mmi_brw_new_push_msg_ind_on_idlescreen
  566.  * DESCRIPTION
  567.  *  Entry Function to display screen for push message arrived indication
  568.  *  on idle-screen.
  569.  * PARAMETERS
  570.  *  void
  571.  * RETURNS
  572.  *  void
  573.  *****************************************************************************/
  574. void mmi_brw_new_push_msg_ind_on_idlescreen(void)   /* added by puneet */
  575. {
  576.     /*----------------------------------------------------------------*/
  577.     /* Local Variables                                                */
  578.     /*----------------------------------------------------------------*/
  579.     S8 buf[4] = {0};
  580.     S8 pOutBuffer[8] = {0};
  581.     S8 message_string[40] = {0};
  582.     U32 brw_total_msg_count = 0;
  583.     U32 brw_unread_msg_count = 0;
  584.     /*----------------------------------------------------------------*/
  585.     /* Code Body                                                      */
  586.     /*----------------------------------------------------------------*/
  587.     mmi_brw_get_push_statistics(&brw_total_msg_count, &brw_unread_msg_count);
  588.     if (SCR_ID_BRW_NEW_PUSH_MESSAGE_IND == GetActiveScreenId())
  589.     {
  590.         DeleteNHistory(1);
  591.     }
  592.     if (0 == brw_unread_msg_count)
  593.     {
  594.         DisplayIdleScreen();
  595.         return;
  596.     }
  597.     if (brw_unread_msg_count < 10)
  598.     {
  599.         sprintf(buf, "%01d", brw_unread_msg_count);
  600.     }
  601.     else
  602.     {
  603.         sprintf(buf, "%02d", brw_unread_msg_count);
  604.     }
  605.     AnsiiToUnicodeString(pOutBuffer, buf);
  606.     pfnUnicodeStrcpy((S8*) message_string, pOutBuffer);
  607.     pfnUnicodeStrcat((S8*) message_string, " ");
  608.     pfnUnicodeStrcat((S8*) message_string, GetString(STR_ID_BRW_SERVICE_MESSAGE_RCVD));
  609.     EntryNewScreen(SCR_ID_BRW_NEW_PUSH_MESSAGE_IND, NULL, mmi_brw_new_push_msg_ind_on_idlescreen, NULL);
  610.     ShowStatusIcon(STATUS_ICON_WAP);
  611.     if (0 == g_keylock_context.gKeyPadLockFlag)
  612.     {
  613.     ShowCategory154Screen(
  614.         0,
  615.         0,
  616.         STR_ID_BRW_READ,
  617.         IMG_GLOBAL_YES,
  618.         STR_GLOBAL_BACK,
  619.         IMG_GLOBAL_BACK,
  620.             (PU8) message_string,
  621.         0,
  622.             IMG_NEW_MESSAGE_NOTIFICATION_MSG,
  623.         NULL);
  624.     g_brw_cntx.push_msg_rcvd_flag = MMI_FALSE;
  625.     if (1 == brw_unread_msg_count)
  626.     {
  627.         SetLeftSoftkeyFunction(mmi_brw_read_arrived_push_message, KEY_EVENT_UP);
  628.     }
  629.     else
  630.     {
  631.         SetLeftSoftkeyFunction(mmi_brw_entry_service_inbox, KEY_EVENT_UP);
  632.     }
  633.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  634. }
  635.     else /* Keypad is locked */
  636.     {
  637.         extern void EntryScrAfterPessingRSK(void);
  638.         extern void EntryScrKeyPadLockOnPessingAnyKey(void);
  639.         ShowCategory154Screen(
  640.             0,
  641.             0,
  642.             g_keylock_context.KeyLockLSKStringID,
  643.             g_keylock_context.KeyLockLSKIconID,
  644.             g_keylock_context.KeyLockRSKStringID,
  645.             g_keylock_context.KeyLockRSKIconID,
  646.             (PU8) message_string,
  647.             0,
  648.             IMG_NEW_MESSAGE_NOTIFICATION_MSG,
  649.             NULL);
  650.         #if defined(__MMI_KEYPAD_LOCK_PROMPT_TEXT__)
  651.             SetGroupKeyHandler(
  652.                 EntryScrKeyPadLockOnPessingAnyKey,
  653.                 (PU16) PresentAllKeys,
  654.                 (U8) TOTAL_KEYS,
  655.                 (U16) KEY_EVENT_DOWN);
  656.         #endif /* defined(__MMI_KEYPAD_LOCK_PROMPT_TEXT__) */ 
  657.         #if defined(__MMI_TOUCH_SCREEN__) && (!defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__) || defined(__MMI_SLIDE__)) //KP Jerry add "!defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__)" on 2007-3-26
  658. #ifdef __MMI_KEYPAD_LOCK_PROMPT_TEXT__
  659. #if defined(__MMI_KEYPAD_LOCK_PATTERN_1__) || defined(__MMI_KEYPAD_LOCK_PATTERN_3__) || defined(__MMI_KEYPAD_LOCK_PATTERN_4__)     //KP Jerry add "__MMI_KEYPAD_LOCK_PATTERN_3__" on 2007-3-27
  660. SetRightSoftkeyFunction(EntryScrKeyPadLockOnPessingAnyKey, KEY_EVENT_DOWN);
  661. #endif
  662. #ifdef __MMI_KEYPAD_LOCK_PATTERN_2__
  663. SetLeftSoftkeyFunction(EntryScrKeyPadLockOnPessingAnyKey, KEY_EVENT_DOWN);
  664. #endif 
  665. #else
  666. ClearKeyHandler(KEY_LSK, KEY_EVENT_DOWN);
  667. ClearKeyHandler(KEY_LSK, KEY_EVENT_UP);
  668. ClearKeyHandler(KEY_RSK, KEY_EVENT_DOWN);
  669. ClearKeyHandler(KEY_RSK, KEY_EVENT_UP);
  670. #endif /* __MMI_KEYPAD_LOCK_PROMPT_TEXT__ */ 
  671. SetKeyHandler(EntryScrAfterPessingRSK, KEY_SEND, KEY_EVENT_DOWN);
  672.         #else /* __MMI_TOUCH_SCREEN__ && !__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__ */ //KP Jerry add "!__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__" on 2007-3-26 
  673. #if defined(__MMI_KEYPAD_LOCK_PATTERN_1__) || defined(__MMI_KEYPAD_LOCK_PATTERN_3__) || defined(__MMI_KEYPAD_LOCK_PATTERN_4__)     //KP Jerry add "__MMI_KEYPAD_LOCK_PATTERN_3__" on 2007-3-27
  674. SetRightSoftkeyFunction(EntryScrAfterPessingRSK, KEY_EVENT_DOWN);
  675. #endif 
  676. #ifdef __MMI_KEYPAD_LOCK_PATTERN_2__
  677. SetLeftSoftkeyFunction(EntryScrAfterPessingRSK, KEY_EVENT_DOWN);
  678. #endif 
  679.      
  680.        #endif /* __MMI_TOUCH_SCREEN__ && !__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__ */ //KP Jerry add "!__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__" on 2007-3-26 
  681.         ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
  682.         #ifdef __MMI_TOUCH_SCREEN__
  683.             mmi_idle_pen_block(); 
  684.         #endif
  685.     }
  686. }
  687. /*****************************************************************************
  688.  * FUNCTION
  689.  *  mmi_brw_entry_new_push_msg_ind
  690.  * DESCRIPTION
  691.  *  Entry Function to display screen for push message arrived indication
  692.  * PARAMETERS
  693.  *  void
  694.  * RETURNS
  695.  *  void
  696.  *****************************************************************************/
  697. void mmi_brw_entry_new_push_msg_ind(void)
  698. {
  699.     /*----------------------------------------------------------------*/
  700.     /* Local Variables                                                */
  701.     /*----------------------------------------------------------------*/
  702.     /*----------------------------------------------------------------*/
  703.     /* Code Body                                                      */
  704.     /*----------------------------------------------------------------*/
  705.            
  706.     mmi_brw_new_push_msg_ind_on_idlescreen();
  707.     g_brw_cntx.push_msg_rcvd_flag = MMI_FALSE;
  708. }
  709. #endif /* __MMI_UNIFIED_MESSAGE__ */ 
  710. #endif /* defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT) */ 
  711. #endif /* _MMI_JBROWSERMMISERVICEINBOX_C */