JBrowserStartup.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:223k
源码类别:
MTK
开发平台:
C/C++
- /*****************************************************************************
- * Copyright Statement:
- * --------------------
- * This software is protected by Copyright and the information contained
- * herein is confidential. The software may not be copied and the information
- * contained herein may not be used or disclosed except with the written
- * permission of MediaTek Inc. (C) 2005
- *
- * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
- * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
- * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
- * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
- * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
- *
- * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
- * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
- * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- *
- * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
- * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
- * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
- * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
- * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
- *
- *****************************************************************************/
- /*******************************************************************************
- * Filename:
- * ---------
- * JBrowserStartup.c
- *
- * Project:
- * --------
- * MAUI
- *
- * Description:
- * ------------
- *
- *
- * Author:
- * -------
- * -------
- * Shantanu Meher -20051012
- *==============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *==============================================================================
- *******************************************************************************/
- #ifndef _MMI_JBROWSERSTARTUP_C
- #define _MMI_JBROWSERSTARTUP_C
- /* Include: MMI header file */
- #include "MMI_features.h"
- #if defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT)
- #include "PixtelDataTypes.h"
- #include "KeyBrd.h" /* Added By Vivek */
- #include "wgui_status_icons.h"
- #include "wgui_softkeys.h"
- #include "Unicodexdcl.h"
- #include "HistoryGprot.h"
- #include "GlobalDefs.h"
- #include "CommonScreens.h"
- #include "DebugInitDef.h"
- #include "JBrowserMMIDefs.h"
- #include "JBrowserMMIProts.h"
- #include "JBrowserMMITypes.h"
- #include "JBrowserMMIGProts.h"
- #include "IdleAppDef.h"
- #include "JProfileHandlerTypes.h"
- #include "JProfileHandlerProts.h"
- #include "JProvProts.h"
- #include "jdd_ui_datatypes.h"
- #include "IdleAppDef.h"
- #include "SettingProfile.h"
- #include "JPushInboxCommonUI.h"
- #include "JPushInboxCommonAPIs.h"
- #include "JBrowserDRMHandler.h"
- #include "JPushInboxUM.h"
- #include "jdd_MMIapi.h"
- #include "jdd_ui_input_ctrl.h"
- #include "jdd_ui_window.h" /* Added by Shantanu - 20060808 */
- #include "jdd_ui_img_ctrl.h"
- #include "jdd_audioapi.h"
- #include "jdd_dataconnection.h"
- #include "TimerEvents.h"
- #include "SmsGuiInterfaceType.h" /* Added by Vivek 29 June 2006 */
- #include "SmsGuiInterfaceProt.h"
- #include "UnifiedMessageDef.h" /* Added by Vivek 21072006 */
- #include "wgui_categories_inputs.h" /* Added by pawan 31-07-06 */
- #include "wgui_categories_popup.h"
- #include "ProfileGprots.h" /* playRequestedTone() */
- #include "gpioInc.h"
- #include "content_type.h"
- #include "CallManagementGprot.h"
- #include "CallStructureManagementProt.h"
- #include "sat_def.h"
- #include "ServiceDefs.h"
- #include "USBDeviceGprot.h"
- #include "FileManagerDef.h"
- #include "jdd_ui_defs.h"
- #include "JMMSResEnum.h"
- #ifdef JBROWSER_USE_ASM
- #include "App_mem.h"
- #endif /* ifdef JBROWSER_USE_ASM */
- #include "wapadp.h"
- #ifdef __JBROWSER_DLS_SUPPORT__
- brw_dls_context_struct g_brw_dls_cntx;
- #endif /* __JBROWSER_DLS_SUPPORT__*/
- JC_BROWSER_CONTEXT pBrowserCtxt;
- static JC_CHAR *g_pmMsg = NULL;
- static JC_CHAR *g_pmDefaultValue = NULL;
- void *pArg;
- BROWSER_CONFIRM_CB gCallBackConfirm;
- BROWSER_PROMPT_CB gCallBackPrompt;
- BROWSER_ALERT_CB gCallBackAlert;
- /* Extern function, variables */
- extern JC_FETCH_URL_INFO fetchUrlInfo;
- extern JC_UINT32 mmi_jdd_ui_get_appWindowID(ETaskID eSrcTaskID);
- extern void mmi_brw_rendered_page_options(void);
- extern void mmi_brw_read_arrived_push_message(void);
- extern void EntryScrAfterPessingRSK(void);
- extern void mmi_brw_entry_auth_handler(void);
- extern void jdd_MemSetActiveModuleID(ETaskID taskId);
- /* added by tk */
- extern U32 mmi_brw_delete_push_msg(U32 pos);
- extern pBOOL isInCall(void); /* Vivek - 8nov2006 */
- extern FuncPtr g_brw_LskFunPtr;
- extern FuncPtr g_brw_RskFunPtr;
- extern U16 g_brw_LskLabel;
- extern U16 g_brw_RskLabel;
- extern U8 g_brw_showimgflag;
- extern U8 g_brw_notificationFlag;
- extern kal_uint8 custom_get_csd_profile_num(void);
- extern JC_BOOLEAN mmi_jdd_ui_is_entry_notification_screen_present(void);
- BOOL g_CSDcall_aborted_status = FALSE;/*Added to handle the csd call aborted state*/
- BOOL g_BrwCsdCallDisconnect = FALSE; /*It is being set when csd call get disconnected*/
- BOOL g_EndKey_pressed = FALSE; /*Added to process the end key through internal queue*/
- /* Himanshu - Stores the current title icon animation status */
- MMI_BOOL g_brw_title_icon_animation_status = MMI_FALSE;
- #ifdef JBROWSER_USE_ASM
- void *wap_heap_space = NULL;
- #endif /* ifdef JBROWSER_USE_ASM */
- /*****************************************************************************
- * FUNCTION
- * mmi_jbrowser_startup
- * DESCRIPTION
- * Startup Event.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jbrowser_startup(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE eRet = JC_OK;
- JC_EVENT_DATA eventData = {0, };
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* send browser start up event */
- eventData.destTaskInfo.iAppID = E_TASK_BROWSER_UI;
- eventData.destTaskInfo.iTaskID = E_TASK_BROWSER_UI;
- eventData.srcTaskInfo.iAppID = E_TASK_BROWSER_UI;
- eventData.srcTaskInfo.iTaskID = E_TASK_BROWSER_UI;
- eventData.uiEventInfoSize = 0;
- eventData.iEventType = E_BRW_STARTUP_EVENT;
- eRet = jdd_QueueCreate(E_TASK_BROWSER_CORE, "BrwCoreQ", sizeof(JC_EVENT_DATA), 128, E_FALSE);
- eRet = jdd_QueueCreate(E_TASK_BROWSER_UI, "BrwUIQ", sizeof(JC_EVENT_DATA), 128, E_FALSE);
- eRet = jdd_QueueSend(&eventData);
- if (JC_OK != eRet)
- {
- return;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jdd_browser_core_events_hdlr
- * DESCRIPTION
- * Core Event Handler
- * PARAMETERS
- * pEventData [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jdd_browser_core_events_hdlr(JC_EVENT_DATA *pEventData)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE iRet = JC_OK;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (E_TASK_TRANSPORT == pEventData->srcTaskInfo.iTaskID)
- {
- iRet = jdi_BrowserHandleTransportResponse(pBrowserCtxt, pEventData);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * JBrowserKeyLeftArrowEventHdlr
- * DESCRIPTION
- * JBrowserKeyLeftArrowEventHdlr
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void JBrowserKeyLeftArrowEventHdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- EJCScrollDirection eScrollDirection;
- JC_RETCODE iRet = JC_OK;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- eScrollDirection = E_JC_SCROLL_LEFT;
- iRet = jdi_BrowserHandleScroll(pBrowserCtxt, eScrollDirection);
- if (JC_OK != iRet)
- {
- jdd_MMINotificationMessage((JC_INT32) iRet, E_NOTIFICATION_ERR, NULL, NULL);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * JBrowserKeyRightArrowEventHdlr
- * DESCRIPTION
- * JBrowserKeyRightArrowEventHdlr
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void JBrowserKeyRightArrowEventHdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- EJCScrollDirection eScrollDirection;
- JC_RETCODE iRet = JC_OK;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- eScrollDirection = E_JC_SCROLL_RIGHT;
- iRet = jdi_BrowserHandleScroll(pBrowserCtxt, eScrollDirection);
- if (JC_OK != iRet)
- {
- jdd_MMINotificationMessage((JC_INT32) iRet, E_NOTIFICATION_ERR, NULL, NULL);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * JBrowserKeyUpArrowEventHdlr
- * DESCRIPTION
- * JBrowserKeyUpArrowEventHdlr
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void JBrowserKeyUpArrowEventHdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- EJCScrollDirection eScrollDirection;
- JC_RETCODE iRet = JC_OK;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- eScrollDirection = E_JC_SCROLL_UP;
- iRet = jdi_BrowserHandleScroll(pBrowserCtxt, eScrollDirection);
- if (JC_OK != iRet)
- {
- jdd_MMINotificationMessage((JC_INT32) iRet, E_NOTIFICATION_ERR, NULL, NULL);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * JBrowserKeyDownArrowEventHdlr
- * DESCRIPTION
- * JBrowserKeyDownArrowEventHdlr
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void JBrowserKeyDownArrowEventHdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- EJCScrollDirection eScrollDirection;
- JC_RETCODE iRet = JC_OK;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- eScrollDirection = E_JC_SCROLL_DOWN;
- iRet = jdi_BrowserHandleScroll(pBrowserCtxt, eScrollDirection);
- if (JC_OK != iRet)
- {
- jdd_MMINotificationMessage((JC_INT32) iRet, E_NOTIFICATION_ERR, NULL, NULL);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * JBrowserGoEvent
- * DESCRIPTION
- * Go event handler
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void JBrowserGoEvent(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE iRet = JC_OK;
- JC_EVENT_DATA eventData = {0, };
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- eventData.pEventInfo = NULL;
- eventData.uiEventInfoSize = 0;
- eventData.iEventType = E_BRW_START_FETCH_EVENT;
- eventData.destTaskInfo.iAppID = E_TASK_BROWSER_UI;
- eventData.destTaskInfo.iTaskID = E_TASK_BROWSER_UI;
- eventData.srcTaskInfo.iAppID = E_TASK_BROWSER_UI;
- eventData.srcTaskInfo.iTaskID = E_TASK_BROWSER_UI;
- iRet = jdd_QueueSend(&eventData);
- if (JC_OK != iRet)
- {
- return;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_deinit_event
- * DESCRIPTION
- * Deinit event handler
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_deinit_event(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE iRet = JC_OK;
- JC_EVENT_DATA eventData = {0, };
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- eventData.pEventInfo = NULL;
- eventData.uiEventInfoSize = 0;
- eventData.iEventType = E_BRW_DEINIT_EVENT;
- eventData.destTaskInfo.iAppID = E_TASK_BROWSER_UI;
- eventData.destTaskInfo.iTaskID = E_TASK_BROWSER_UI;
- eventData.srcTaskInfo.iAppID = E_TASK_BROWSER_UI;
- eventData.srcTaskInfo.iTaskID = E_TASK_BROWSER_UI;
- iRet = jdd_QueueSend(&eventData);
- if (JC_OK != iRet)
- {
- return;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_dataconn_auto_disc_timeout_event
- * DESCRIPTION
- * Dataconn auto disconnect event handler.It disconn csd call on the basic
- * of timeout event handler
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_dataconn_auto_disc_timeout_event(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE iRet = JC_OK;
- JC_EVENT_DATA eventData = {0, };
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- eventData.pEventInfo = NULL;
- eventData.uiEventInfoSize = 0;
- eventData.iEventType = E_BRW_DATACONN_AUTO_DISC_TIMEOUT_EVENT;
- eventData.destTaskInfo.iAppID = E_TASK_BROWSER_UI;
- eventData.destTaskInfo.iTaskID = E_TASK_BROWSER_UI;
- eventData.srcTaskInfo.iAppID = E_TASK_BROWSER_UI;
- eventData.srcTaskInfo.iTaskID = E_TASK_BROWSER_UI;
- iRet = jdd_QueueSend(&eventData);
- if (JC_OK != iRet)
- {
- return;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * JBrowserRefreshDisplayHdlr
- * DESCRIPTION
- * Refresh event handler
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void JBrowserRefreshDisplayHdlr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE iRet = JC_OK;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- jdd_MemSetActiveModuleID(E_TASK_BROWSER_CORE);
- iRet = jdi_BrowserRefreshDisplay(pBrowserCtxt);
- if (JC_OK != iRet)
- {
- jdd_MMINotificationMessage((JC_INT32) iRet, E_NOTIFICATION_ERR, NULL, NULL);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_multimedia_callback_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * pAppArg [?]
- * pObjectInfo [?]
- * RETURNS
- *
- *****************************************************************************/
- JC_RETCODE mmi_brw_multimedia_callback_hdlr(void *pAppArg, JC_OBJECT_INFO *pObjectInfo)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE eRet;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (pObjectInfo)
- {
- eRet = mmi_jdd_audio_play(pObjectInfo);
- }
- else
- {
- eRet = mmi_jdd_audio_stop();
- }
- if (eRet != JC_OK)
- {
- jdd_MMINotificationMessage((JC_INT32) eRet, E_NOTIFICATION_ERR, NULL, NULL);
- }
- return JC_OK;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_mime_content_callback_hdlr
- * DESCRIPTION
- * mime callback handler for cached content
- * PARAMETERS
- * pAppArg [?]
- * pMimeContent [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_mime_content_callback_hdlr(void *pAppArg, COMM_URL_IND *pMimeContent)
- {
- S8 download_msg[200] = {0};
- S8 tmp_str_ascii[50] = {0};
- S8 tmp_str_ucs2[100] = {0};
- g_brw_cntx.isDownloading = FALSE;
- memset((void*)&g_brw_cntx.dwnld_mime_info, 0, sizeof(JC_MIME_INFO));
- g_brw_cntx.dwnld_mime_info.psContentType = jdi_UtilsStrdup(pMimeContent->pszContentType);
- if(!g_brw_cntx.dwnld_mime_info.psContentType)
- {
- goto error_handle;
- }
- g_brw_cntx.dwnld_mime_info.psUrl = jdi_UtilsTcsDup(pMimeContent->psUrl);
- if(!g_brw_cntx.dwnld_mime_info.psUrl)
- {
- goto error_handle;
- }
- g_brw_cntx.dwnld_mime_info.pBuffer = jdd_MemAlloc(pMimeContent->uiLength, 1);
- if(!g_brw_cntx.dwnld_mime_info.pBuffer)
- {
- goto error_handle;
- }
- memcpy(g_brw_cntx.dwnld_mime_info.pBuffer, pMimeContent->pBuffer, pMimeContent->uiLength);
- g_brw_cntx.dwnld_mime_info.iBufferLen = pMimeContent->uiLength;
- pfnUnicodeStrcpy(download_msg, GetString(STR_ID_BRW_DOWNLOAD_QUERY));
- pfnUnicodeStrcat(download_msg, "n");
- if (pMimeContent->uiLength)
- {
- pfnUnicodeStrcat(download_msg, GetString(STR_ID_BRW_CONTENT_SIZE));
- pfnUnicodeStrcat(download_msg, ":");
- if (pMimeContent->uiLength >= 1000)
- {
- sprintf(tmp_str_ascii, "%.1f ", (pMimeContent->uiLength / 1024.0));
- }
- else
- {
- sprintf(tmp_str_ascii, "%d ", pMimeContent->uiLength);
- }
- AnsiiToUnicodeString(tmp_str_ucs2, tmp_str_ascii);
- pfnUnicodeStrcat(download_msg, tmp_str_ucs2);
- if (pMimeContent->uiLength >= 1000)
- {
- pfnUnicodeStrcat(download_msg, GetString(STR_ID_BRW_KB));
- }
- else
- {
- pfnUnicodeStrcat(download_msg, GetString(STR_ID_BRW_BYTES));
- }
- }
- mmi_brw_entry_download_confirm((UI_string_type) download_msg, mmi_brw_save_mime_content, mmi_brw_cancel_save_mime_content);
- return;
- error_handle:
- mmi_brw_free_dwnld_info_memory();
- DisplayPopup((PU8) GetString(STR_ID_JATAAYU_JDD_BROWSER_NOT_ENOUGH_MEMORY), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_save_mime_content
- * DESCRIPTION
- * Save mime content
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_save_mime_content(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_CHAR *filename;
- JC_RETCODE eRet;
- JC_UINT32 navlist_count;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_brw_cntx.isDownloading = TRUE;
- jdi_BrowserGetNavListCount(pBrowserCtxt, &navlist_count);
- if (!navlist_count)
- {
- DeleteScreenIfPresent(SCR_ID_BRW_JBROWSER_MAIN);
- }
- #ifdef __USB_IN_NORMAL_MODE__
- if (mmi_usb_is_in_mass_storage_mode())
- {
- mmi_usb_app_unavailable_popup(0);
- g_brw_cntx.isDownloading = FALSE;
- goto error_handle;
- }
- #endif /* __USB_IN_NORMAL_MODE__ */
- if (jdd_FSInitialize(&g_brw_cntx.dwnld_fs_handle) == JC_OK)
- {
- jdd_FSGetDownloadFileName(&filename);
- g_brw_cntx.dwnld_mime_info.psFileName = filename;
- g_brw_cntx.dwnld_file_handle = jdd_FSOpen(g_brw_cntx.dwnld_fs_handle, filename, E_CREATE_APPEND_WRITE_MODE);
- if (g_brw_cntx.dwnld_file_handle)
- {
- eRet = jdd_FSWrite(
- (void*)g_brw_cntx.dwnld_mime_info.pBuffer,
- g_brw_cntx.dwnld_mime_info.iBufferLen,
- 1, g_brw_cntx.dwnld_file_handle);
- if (eRet != 1)
- {
- jdd_FSClose(g_brw_cntx.dwnld_file_handle);
- jdd_FSDelete(g_brw_cntx.dwnld_fs_handle, g_brw_cntx.dwnld_mime_info.psFileName);
- jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
- DisplayPopup((PU8) GetString(STR_ID_BRW_FILE_SYSTEM_FULL), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
- }
- else
- {
- if (!navlist_count)
- {
- mmi_brw_set_data_connection_deactive_flag(E_TRUE);
- mmi_brw_deinit_all();
- }
- jdd_FSClose(g_brw_cntx.dwnld_file_handle);
- jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
- eRet = jdd_MimeHandler(&g_brw_cntx.dwnld_mime_info);
- if (eRet != JC_OK)
- {
- DisplayPopup((PU8) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 0, JBROWSER_POPUP_TIME, ERROR_TONE);
- }
- }
- }
- else
- {
- DisplayPopup((PU8) GetString(STR_ID_BRW_FILE_SYSTEM_ERROR), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
- jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
- }
- }
- else
- {
- DisplayPopup((PU8) GetString(STR_ID_BRW_FILE_SYSTEM_ERROR), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
- }
- error_handle:
- mmi_brw_free_dwnld_info_memory();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_cancel_save_mime_content
- * DESCRIPTION
- * Dont save mime content
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_cancel_save_mime_content(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_UINT32 navlist_count;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_brw_free_dwnld_info_memory();
- jdi_BrowserGetNavListCount(pBrowserCtxt, &navlist_count);
- if (navlist_count)
- {
- GoBackHistory();
- }
- else
- {
- mmi_brw_set_data_connection_deactive_flag(E_TRUE);
- mmi_brw_deinit_all();
- GoBacknHistory(1);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_mime_callback_hdlr
- * DESCRIPTION
- * mime callback handler
- * PARAMETERS
- * pAppArg [?]
- * pMimeInfo [?]
- * pBrowserFetchCallBacks [?]
- * RETURNS
- *
- *****************************************************************************/
- JC_RETCODE mmi_brw_mime_callback_hdlr(
- void *pAppArg,
- JC_BROWSER_MIME_INFO *pMimeInfo,
- JC_BROWSER_FETCH_CALLBACKS *pBrowserFetchCallBacks)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (!(pMimeInfo->psContentType) || !pfnUnicodeStrlen(pMimeInfo->psContentType))
- {
- jdd_MMINotificationMessage(JC_ERR_UNKNOWN_CONTENT_TYPE, E_NOTIFICATION_ERR, NULL, NULL);
- return JC_ERR_UNKNOWN_CONTENT_TYPE;
- }
- #ifndef WAP_SEC_SUPPORT
- if (jc_strcmp(pMimeInfo->psContentType, APPLICATION_X_X509_CA_CERT_VALUE) == 0
- || jc_strcmp(pMimeInfo->psContentType, APPLICATION_X_X509_USER_CERT_VALUE) == 0
- || jc_strcmp(pMimeInfo->psContentType, APPLICATION_VND_WAP_WTLS_CA_CERTIFICATE_VALUE) == 0
- || jc_strcmp(pMimeInfo->psContentType, APPLICATION_VND_WAP_WTLS_USER_CERTIFICATE_VALUE) == 0)
- {
- jdd_MMINotificationMessage(JC_ERR_UNKNOWN_CONTENT_TYPE_PROCESSED, E_NOTIFICATION_ERR, NULL, NULL);
- return JC_ERR_UNKNOWN_CONTENT_TYPE;
- }
- #endif // if defined WAP_SEC_SUPPORT
- if ((jdi_UtilsStartsWith(pMimeInfo->psContentType, "application/vnd.oma.drm.rights+xml") == 0) ||
- (jdi_UtilsStartsWith(pMimeInfo->psContentType, "application/vnd.oma.drm.rights+wbxml") == 0))
- {
- pBrowserFetchCallBacks->CB_browserFetchHeaderInfo = mmi_brw_drm_rights_header_info_callback_hdlr;
- pBrowserFetchCallBacks->CB_browserFetchResponseInfo = mmi_brw_drm_rights_fetch_indication_info_callback_hdlr;
- pBrowserFetchCallBacks->CB_browserFetchErrorInfo = mmi_brw_drm_rights_fetch_error_info_callback_hdlr;
- }
- else
- {
- g_brw_cntx.isDownloading = FALSE;
- g_brw_cntx.isDownloadSuspended = FALSE;
- g_brw_cntx.showDownloadAbortedPopup = FALSE;
- #ifdef __JBROWSER_DLS_SUPPORT__
- pBrowserFetchCallBacks->CB_browserFetchHeaderInfo = mmi_brw_dls_header_info_callback_hdlr;
- pBrowserFetchCallBacks->CB_browserFetchResponseInfo = mmi_brw_dls_fetch_indication_info_callback_hdlr;
- pBrowserFetchCallBacks->CB_browserFetchErrorInfo = mmi_brw_dls_fetch_error_info_callback_hdlr;
- #else
- pBrowserFetchCallBacks->CB_browserFetchHeaderInfo = mmi_brw_header_info_callback_hdlr;
- pBrowserFetchCallBacks->CB_browserFetchResponseInfo = mmi_brw_fetch_indication_info_callback_hdlr;
- pBrowserFetchCallBacks->CB_browserFetchErrorInfo = mmi_brw_fetch_error_info_callback_hdlr;
- #endif /* __JBROWSER_DLS_SUPPORT__*/
- }
- return JC_OK;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_drm_rights_header_info_callback_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * pAppArg [?]
- * pBrowserHeaderIndication [?]
- * RETURNS
- *
- *****************************************************************************/
- JC_RETCODE mmi_brw_drm_rights_header_info_callback_hdlr(
- void *pAppArg,
- COMM_HEADER_INDICATION *pBrowserHeaderIndication)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_CHAR *filename;
- JC_RETCODE eRet = JC_OK;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_brw_cntx.showDownloadAbortedPopup = TRUE;
- #ifdef __USB_IN_NORMAL_MODE__
- if (mmi_usb_is_in_mass_storage_mode())
- {
- mmi_usb_app_unavailable_popup(0);
- jdi_BrowserFetchStop(pBrowserCtxt);
- g_brw_cntx.showDownloadAbortedPopup = FALSE;
- goto error_handle;
- }
- #endif /* __USB_IN_NORMAL_MODE__ */
- memset((void*)&g_brw_cntx.dwnld_mime_info, 0, sizeof(JC_MIME_INFO));
- eRet = jdd_FSInitialize(&g_brw_cntx.dwnld_fs_handle);
- if (eRet == JC_OK)
- {
- jdd_FSGetDownloadFileName(&filename);
- g_brw_cntx.dwnld_mime_info.psFileName = filename;
- g_brw_cntx.dwnld_file_handle = jdd_FSOpen(g_brw_cntx.dwnld_fs_handle, filename, E_CREATE_APPEND_WRITE_MODE);
- if (!g_brw_cntx.dwnld_file_handle)
- {
- jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
- eRet = JC_ERR_FILE_OPEN;
- goto error_handle;
- }
- }
- else
- {
- goto error_handle;
- }
- g_brw_cntx.total_content_length = 0;
- g_brw_cntx.downloaded_content_length = 0;
- g_brw_cntx.dwnld_mime_info.psContentType = jdi_UtilsStrdup(pBrowserHeaderIndication->pszContentType);
- g_brw_cntx.dwnld_mime_info.psUrl = jdi_UtilsTcsDup(pBrowserHeaderIndication->psUrl);
- if (pBrowserHeaderIndication->uiContentLength)
- {
- g_brw_cntx.total_content_length = pBrowserHeaderIndication->uiContentLength;
- g_brw_cntx.dwnld_mime_info.iBufferLen = pBrowserHeaderIndication->uiContentLength;
- }
- g_brw_page_cntx.brw_PageFetchStatus = 0;
- return JC_OK;
- error_handle:
- if(g_brw_cntx.dwnld_mime_info.psFileName)
- {
- jdd_MemFree(g_brw_cntx.dwnld_mime_info.psFileName);
- g_brw_cntx.dwnld_mime_info.psFileName = NULL;
- }
- return eRet;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_drm_rights_fetch_indication_info_callback_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * pAppArg [?]
- * pBrowserFetchURLIndResp [?]
- * RETURNS
- *
- *****************************************************************************/
- JC_RETCODE mmi_brw_drm_rights_fetch_indication_info_callback_hdlr(
- void *pAppArg,
- COMM_FETCH_URL_IND_RESP *pBrowserFetchURLIndResp)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE eRet;
- JC_UINT32 navlist_count;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((pBrowserFetchURLIndResp->bHasMoreData)
- || (!pBrowserFetchURLIndResp->bHasMoreData && pBrowserFetchURLIndResp->uiCurrentLength))
- {
- g_brw_cntx.downloaded_content_length += pBrowserFetchURLIndResp->uiCurrentLength;
- eRet = jdd_FSWrite(
- (void*)pBrowserFetchURLIndResp->pucBuffer,
- pBrowserFetchURLIndResp->uiCurrentLength,
- 1,
- g_brw_cntx.dwnld_file_handle);
- if (eRet != 1)
- {
- jdd_FSClose(g_brw_cntx.dwnld_file_handle);
- jdd_FSDelete(g_brw_cntx.dwnld_fs_handle, g_brw_cntx.dwnld_mime_info.psFileName);
- jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
- if (IsScreenPresent(SCR_ID_BRW_JBROWSER_MAIN))
- {
- g_brw_page_cntx.brw_pageRenderStatus = 1;
- }
- goto error_handle;
- }
- }
- if (!pBrowserFetchURLIndResp->bHasMoreData)
- {
- jdd_FSClose(g_brw_cntx.dwnld_file_handle);
- jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
- if(IsScreenPresent(SCR_FMGR_DA_FILE_OPTION))
- {
- ClearExitHandler();
- }
- jdi_BrowserGetNavListCount(pBrowserCtxt, &navlist_count);
- if (!navlist_count)
- {
- mmi_brw_set_data_connection_deactive_flag(E_TRUE);
- mmi_brw_deinit_event();
- }
- if (IsScreenPresent(SCR_ID_BRW_JBROWSER_MAIN))
- {
- g_brw_page_cntx.brw_pageRenderStatus = 1;
- }
- eRet = jdd_MimeHandler(&g_brw_cntx.dwnld_mime_info);
- goto error_handle;
- }
- return JC_OK;
- error_handle:
- mmi_brw_free_dwnld_info_memory();
- return eRet;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_drm_rights_fetch_error_info_callback_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * pAppArg [?]
- * uiReferenceID [IN]
- * eRet [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_drm_rights_fetch_error_info_callback_hdlr(void *pAppArg, JC_UINT32 uiReferenceID, JC_RETCODE eRet)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_brw_cntx.dwnld_file_handle)
- {
- jdd_FSClose(g_brw_cntx.dwnld_file_handle);
- jdd_FSDelete(g_brw_cntx.dwnld_fs_handle, g_brw_cntx.dwnld_mime_info.psFileName);
- }
- mmi_brw_free_dwnld_info_memory();
- if (g_brw_cntx.dwnld_fs_handle)
- {
- jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
- }
- if(g_brw_cntx.showDownloadAbortedPopup)
- {
- DisplayPopup((PU8) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
- }
- }
- #ifdef __JBROWSER_DLS_SUPPORT__
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_dls_header_info_callback_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * pAppArg [?]
- * pBrowserHeaderIndication [?]
- * RETURNS
- * JC_RETCODE
- *****************************************************************************/
- JC_RETCODE mmi_brw_dls_header_info_callback_hdlr(void *pAppArg, COMM_HEADER_INDICATION *pBrowserHeaderIndication)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE eRet;
- JC_UINT32 navlist_count;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "ENTER: mmi_brw_dls_header_info_callback_hdlr"));
- eRet = jdi_BrowserSuspendRequest(pBrowserCtxt);
- if (eRet != JC_OK)
- {
- jdi_BrowserFetchStop(pBrowserCtxt);
- return eRet;
- }
- g_brw_cntx.isDownloadSuspended = TRUE;
- g_brw_cntx.total_content_length = 0;
- g_brw_cntx.downloaded_content_length = 0;
- g_brw_dls_cntx.session_id = pBrowserHeaderIndication->uiRequestID;
- g_brw_dls_cntx.seq_num = 0;
- g_brw_dls_cntx.progress_flag = TRUE;
- if (pBrowserHeaderIndication->uiContentLength)
- {
- g_brw_cntx.total_content_length = pBrowserHeaderIndication->uiContentLength;
- }
- g_brw_page_cntx.brw_PageFetchStatus = 0;
- // PMTSW00006571 Start
- jdi_BrowserGetNavListCount(pBrowserCtxt, &navlist_count);
- if (!navlist_count)
- {
- ClearExitHandler();
- }
- // PMTSW00006571 End
- mmi_brw_dls_send_file_dl_ind(pBrowserHeaderIndication);
- return JC_OK;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_dls_fetch_indication_info_callback_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * pAppArg [?]
- * pBrowserFetchURLIndResp [?]
- * RETURNS
- * void
- *****************************************************************************/
- JC_RETCODE mmi_brw_dls_fetch_indication_info_callback_hdlr(void *pAppArg, COMM_FETCH_URL_IND_RESP *pBrowserFetchURLIndResp)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE eRet;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)(%d)", "ENTER: mmi_brw_dls_fetch_indication_info_callback_hdlr", pBrowserFetchURLIndResp->uiCurrentLength, pBrowserFetchURLIndResp->bHasMoreData));
- if (g_brw_cntx.isDownloading == TRUE )
- {
- if ((pBrowserFetchURLIndResp->bHasMoreData)
- || (!pBrowserFetchURLIndResp->bHasMoreData && pBrowserFetchURLIndResp->uiCurrentLength))
- {
- g_brw_cntx.downloaded_content_length += pBrowserFetchURLIndResp->uiCurrentLength;
- eRet = jdd_FSWrite(
- (void*)pBrowserFetchURLIndResp->pucBuffer,
- pBrowserFetchURLIndResp->uiCurrentLength,
- 1,
- g_brw_cntx.dwnld_file_handle);
- if (eRet == 1)
- {
- if ( g_brw_dls_cntx.progress_flag == TRUE )
- mmi_brw_dls_send_file_dl_progress_ind(WAP_DL_STATUS_DOWNLOADING,WAP_DL_ERROR_OK);
- }
- else
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "ERROR: jdd_FSWrite", eRet));
- g_brw_cntx.isDownloading = FALSE;
- jdd_FSClose(g_brw_cntx.dwnld_file_handle);
- g_brw_cntx.dwnld_file_handle = NULL;
- if (g_brw_dls_cntx.p_file_name != NULL)
- {
- jdd_MemFree(g_brw_dls_cntx.p_file_name);
- g_brw_dls_cntx.p_file_name = NULL;
- }
- jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
- g_brw_cntx.dwnld_fs_handle = NULL;
- jdi_BrowserFetchStop(pBrowserCtxt);
- switch (eRet)
- {
- case JC_ERR_FILE_INVALID_PATH:
- mmi_brw_dls_send_file_dl_progress_ind(WAP_DL_STATUS_ABORTED, WAP_DL_ERROR_INVALID_FILE);
- break;
- case JC_ERR_FILE_FULL:
- mmi_brw_dls_send_file_dl_progress_ind(WAP_DL_STATUS_ABORTED, WAP_DL_ERROR_DISK_FULL);
- break;
- case JC_ERR_FILE_INVALID_ACCESS:
- default:
- mmi_brw_dls_send_file_dl_progress_ind(WAP_DL_STATUS_ABORTED, WAP_DL_ERROR_FILE_ACCESS);
- break;
- }
- return eRet;
- }
- }
- if (!pBrowserFetchURLIndResp->bHasMoreData)
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Download Complete"));
- g_brw_cntx.isDownloading = FALSE;
- if (g_brw_cntx.dwnld_file_handle)
- {
- jdd_FSClose(g_brw_cntx.dwnld_file_handle);
- g_brw_cntx.dwnld_file_handle = NULL;
- if (g_brw_dls_cntx.p_file_name!=NULL)
- {
- jdd_MemFree(g_brw_dls_cntx.p_file_name);
- g_brw_dls_cntx.p_file_name = NULL;
- }
- }
- if (g_brw_cntx.dwnld_fs_handle)
- {
- jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
- g_brw_cntx.dwnld_fs_handle = NULL;
- }
- if (IsScreenPresent(SCR_ID_BRW_JBROWSER_MAIN))
- {
- g_brw_page_cntx.brw_pageRenderStatus = 1;
- }
- mmi_brw_dls_send_file_dl_progress_ind(WAP_DL_STATUS_COMPLETE,WAP_DL_ERROR_OK);
- }
- }
- else
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "EXIT: mmi_brw_dls_fetch_indication_info_callback_hdlr and g_brw_cntx.isDownloading is False" ));
- return JC_OK;
- }
- return JC_OK;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_dls_fetch_error_info_callback_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * pAppArg [?]
- * uiReferenceID [IN]
- * eRet [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_dls_fetch_error_info_callback_hdlr(void *pAppArg, JC_UINT32 uiReferenceID, JC_RETCODE eRet)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)(%d)", "ENTER: mmi_brw_dls_fetch_error_info_callback_hdlr", g_brw_cntx.isDownloading, g_brw_cntx.isDownloadSuspended));
- if ( g_brw_cntx.isDownloading == TRUE ) // Connection loss while downloading
- {
- mmi_brw_dls_send_file_dl_progress_ind(WAP_DL_STATUS_ABORTED,WAP_DL_ERROR_CONNECTION_CLOSED);
- }
- g_brw_cntx.isDownloading = FALSE;
- g_brw_cntx.isDownloadSuspended = FALSE;
- if (g_brw_cntx.dwnld_file_handle)
- {
- jdd_FSClose(g_brw_cntx.dwnld_file_handle);
- g_brw_cntx.dwnld_file_handle = NULL;
- if (g_brw_dls_cntx.p_file_name != NULL && g_brw_cntx.dwnld_fs_handle != NULL)
- {
- jdd_FSDelete(g_brw_cntx.dwnld_fs_handle, g_brw_dls_cntx.p_file_name); // Delete file
- jdd_MemFree(g_brw_dls_cntx.p_file_name);
- g_brw_dls_cntx.p_file_name = NULL;
- }
- }
- if (g_brw_cntx.dwnld_fs_handle)
- {
- jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
- g_brw_cntx.dwnld_fs_handle = NULL;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_dls_send_file_dl_ind
- * DESCRIPTION
- * To send file download indication to DA
- * PARAMETERS
- * pBrowserHeaderIndication [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_dls_send_file_dl_ind(COMM_HEADER_INDICATION *pBrowserHeaderIndication)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MYQUEUE Message;
- wap_mmi_file_dl_ind_struct *p_dl_ind_st = NULL;
- wap_mmi_file_dl_var_struct *p_dl_var_st = NULL;
- peer_buff_struct *peer_buff_ptr = NULL;
- U16 peer_pdu_len = 0;
- JC_CHAR *tempFileName;
- FS_HANDLE fHandle;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "ENTER: mmi_brw_dls_send_file_dl_ind"));
- p_dl_ind_st = (wap_mmi_file_dl_ind_struct*) construct_local_para(sizeof(wap_mmi_file_dl_ind_struct), TD_CTRL);
- p_dl_ind_st->session_id = pBrowserHeaderIndication->uiRequestID;
- pfnUnicodeStrcpy((S8*)p_dl_ind_st->url, (S8*) pBrowserHeaderIndication->psUrl);
- mmi_brw_dls_set_file_name(p_dl_ind_st->url, '/'); // Get file name in g_brw_dls_cntx.p_file_name
- if(g_brw_dls_cntx.p_file_name != NULL)
- {
- fHandle = FS_GetAttributes (g_brw_dls_cntx.p_file_name);
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "FS_GetAttributes returns", fHandle));
- }
- if ( g_brw_dls_cntx.p_file_name == NULL || fHandle == FS_INVALID_FILENAME )
- {
- // File Name is not valid. Creating a temp file name
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Invalid file name"));
- if (g_brw_dls_cntx.p_file_name != NULL )
- {
- jdd_MemFree(g_brw_dls_cntx.p_file_name);
- g_brw_dls_cntx.p_file_name = NULL;
- }
- jdd_FSGetDownloadFileName(&tempFileName);
- mmi_brw_dls_set_file_name((U8*)tempFileName, '\'); // Get file name in g_brw_dls_cntx.p_file_name
- jdd_MemFree(tempFileName);
- }
- pfnUnicodeStrcpy((S8*)p_dl_ind_st->file_name ,(S8*) g_brw_dls_cntx.p_file_name);
- jdd_MemFree(g_brw_dls_cntx.p_file_name);
- g_brw_dls_cntx.p_file_name = NULL;
- pfnUnicodeStrcpy((S8*)p_dl_ind_st->mime_type, pBrowserHeaderIndication->pszContentType);
- p_dl_ind_st->file_length = pBrowserHeaderIndication->uiContentLength;
- peer_buff_ptr = (peer_buff_struct*)construct_peer_buff(sizeof(wap_mmi_file_dl_var_struct), 0, 0, TD_CTRL);
- p_dl_var_st = get_pdu_ptr(peer_buff_ptr, &peer_pdu_len);
- if(p_dl_var_st)
- {
- p_dl_var_st->content_len = pBrowserHeaderIndication->uiHeaderLength;
- pfnUnicodeStrcpy((S8*)p_dl_var_st->content, (S8*)pBrowserHeaderIndication->pucHeader ) ;
- }
- Message.oslSrcId = MOD_WAP;
- Message.oslDestId = MOD_MMI;
- Message.oslMsgId = MSG_ID_WAP_MMI_FILE_DL_IND;
- Message.oslDataPtr = (oslParaType*) p_dl_ind_st;
- Message.oslPeerBuffPtr = peer_buff_ptr;
- OslMsgSendExtQueue(&Message);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_dls_file_dl_res_hdlr
- * DESCRIPTION
- * To handle response message of file download indication from DA
- * PARAMETERS
- * Msg [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_dls_file_dl_res_hdlr(void *Msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE eRet;
- wap_mmi_file_dl_res_struct * p_dl_res_st = (wap_mmi_file_dl_res_struct *) Msg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)(%d)", "ENTER: mmi_brw_dls_file_dl_res_hdlr", p_dl_res_st->result, g_brw_cntx.isDownloadSuspended));
- if ( g_brw_cntx.isDownloadSuspended == TRUE )
- {
- if ( p_dl_res_st->result == WAP_DL_ERROR_CANCELLED)
- {
- g_brw_cntx.isDownloading = FALSE;
- g_brw_cntx.isDownloadSuspended = FALSE;
- jdi_BrowserFetchStop(pBrowserCtxt); // Download Cancel
- }
- else if ( p_dl_res_st->result == WAP_DL_ERROR_OK) // Start Download
- {
- if(p_dl_res_st->session_id == g_brw_dls_cntx.session_id )
- {
- if (g_brw_cntx.total_content_length != 0 && mmi_brw_dls_is_free_space_available(p_dl_res_st->file_path) == FALSE) // Free Space not available
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "ERROR: mmi_brw_dls_is_free_space_available"));
- g_brw_cntx.isDownloading = FALSE;
- g_brw_cntx.isDownloadSuspended = FALSE;
- jdi_BrowserFetchStop(pBrowserCtxt);
- mmi_brw_dls_send_file_dl_progress_ind(WAP_DL_STATUS_ABORTED,WAP_DL_ERROR_DISK_FULL);
- }
- else
- {
- eRet = jdd_FSInitialize(&g_brw_cntx.dwnld_fs_handle);
- if (eRet == JC_OK)
- {
- g_brw_dls_cntx.p_file_name = (JC_CHAR *)jdd_MemAlloc(pfnUnicodeStrlen((S8* )p_dl_res_st->file_path) * ENCODING_LENGTH + 2, sizeof(S8));
- pfnUnicodeStrcpy ((S8*)g_brw_dls_cntx.p_file_name, (S8*) p_dl_res_st->file_path);
- g_brw_cntx.dwnld_file_handle = jdd_FSOpen(g_brw_cntx.dwnld_fs_handle, p_dl_res_st->file_path, E_CREATE_WRITE_MODE);
- if (!g_brw_cntx.dwnld_file_handle)
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "ERROR: jdd_FSOpen"));
- g_brw_cntx.isDownloading = FALSE;
- g_brw_cntx.isDownloadSuspended = FALSE;
- jdi_BrowserFetchStop(pBrowserCtxt);
- if (g_brw_dls_cntx.p_file_name!=NULL)
- {
- jdd_MemFree(g_brw_dls_cntx.p_file_name);
- g_brw_dls_cntx.p_file_name = NULL;
- }
- jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
- g_brw_cntx.dwnld_fs_handle = NULL;
- mmi_brw_dls_send_file_dl_progress_ind(WAP_DL_STATUS_ABORTED, WAP_DL_ERROR_INVALID_FILE);
- }
- else
- {
- g_brw_cntx.isDownloadSuspended = FALSE;
- g_brw_cntx.isDownloading = TRUE;
- jdi_BrowserResumeRequest(pBrowserCtxt); // Download Start
- }
- }
- else
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "ERROR: jdd_FSInitialize", eRet));
- g_brw_cntx.isDownloading = FALSE;
- g_brw_cntx.isDownloadSuspended = FALSE;
- jdi_BrowserFetchStop(pBrowserCtxt);
- mmi_brw_dls_send_file_dl_progress_ind(WAP_DL_STATUS_ABORTED,WAP_DL_ERROR_FILE_ACCESS);
- }
- }
- }
- else
- {
- g_brw_cntx.isDownloading = FALSE;
- g_brw_cntx.isDownloadSuspended = FALSE;
- jdi_BrowserFetchStop(pBrowserCtxt);
- mmi_brw_dls_send_file_dl_progress_ind(WAP_DL_STATUS_ABORTED,WAP_DL_ERROR_INVALID_SESSION_ID); // WAP_DL_STATUS_ABORT && WAP_DL_ERROR_INVALID_SESSION_ID
- }
- }
- else // Result is other than WAP_DL_ERROR_OK and WAP_DL_ERROR_CANCELLED.
- {
- g_brw_cntx.isDownloading = FALSE;
- g_brw_cntx.isDownloadSuspended = FALSE;
- jdi_BrowserFetchStop(pBrowserCtxt);
- }
- }
- else
- {
- if ( p_dl_res_st->result == WAP_DL_ERROR_OK)
- mmi_brw_dls_send_file_dl_progress_ind(WAP_DL_STATUS_ABORTED,WAP_DL_ERROR_CONNECTION_CLOSED);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_dls_send_file_dl_progress_ind
- * DESCRIPTION
- * To send file progress information to DA
- * PARAMETERS
- * status [?]
- * cause [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_dls_send_file_dl_progress_ind(U8 status, U8 cause)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MYQUEUE Message;
- wap_mmi_file_dl_progress_ind_struct *p_dl_prg_ind_st = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)(%d)", "ENTER: mmi_brw_dls_send_file_dl_progress_ind", status, cause));
- p_dl_prg_ind_st = (wap_mmi_file_dl_progress_ind_struct*) construct_local_para(sizeof(wap_mmi_file_dl_progress_ind_struct), TD_CTRL);
- g_brw_dls_cntx.progress_flag = FALSE;
- g_brw_dls_cntx.seq_num++;
- p_dl_prg_ind_st->session_id = g_brw_dls_cntx.session_id;
- p_dl_prg_ind_st->seq_num = g_brw_dls_cntx.seq_num;
- p_dl_prg_ind_st->status = status;
- p_dl_prg_ind_st->cause = cause;
- p_dl_prg_ind_st->acc_size = g_brw_cntx.downloaded_content_length;
- Message.oslSrcId = MOD_WAP;
- Message.oslDestId = MOD_MMI;
- Message.oslMsgId = MSG_ID_WAP_MMI_FILE_DL_PROGRESS_IND;
- Message.oslDataPtr = (oslParaType*) p_dl_prg_ind_st;
- Message.oslPeerBuffPtr = NULL;
- OslMsgSendExtQueue(&Message);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_dls_file_dl_progress_res_hdlr
- * DESCRIPTION
- * To handle response message of file progress information from DA
- * PARAMETERS
- * Msg [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_dls_file_dl_progress_res_hdlr(void *Msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wap_mmi_file_dl_progress_res_struct *p_dl_prg_res_st = (wap_mmi_file_dl_progress_res_struct*) Msg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "ENTER: mmi_brw_dls_file_dl_progress_res_hdlr", g_brw_cntx.isDownloading));
- if ( g_brw_cntx.isDownloading == TRUE)
- {
- if (g_brw_dls_cntx.session_id != p_dl_prg_res_st->session_id )
- {
- g_brw_cntx.isDownloadSuspended = FALSE;
- g_brw_cntx.isDownloading = FALSE;
- jdi_BrowserFetchStop(pBrowserCtxt);
- mmi_brw_dls_send_file_dl_progress_ind(WAP_DL_STATUS_ABORTED,WAP_DL_ERROR_INVALID_SESSION_ID); // WAP_DL_STATUS_ABORT && WAP_DL_ERROR_INVALID_SESSION_ID
- }
- else
- {
- g_brw_dls_cntx.progress_flag = TRUE ;
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_dls_file_dl_stop_req_hdlr
- * DESCRIPTION
- * To handle file download request message from DA
- * PARAMETERS
- * Msg [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_dls_file_dl_stop_req_hdlr(void *Msg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wap_mmi_file_dl_stop_req_struct *p_dl_stop_req = (wap_mmi_file_dl_stop_req_struct *) Msg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)", "ENTER: mmi_brw_dls_file_dl_stop_req_hdlr", g_brw_cntx.isDownloading));
- if ( g_brw_cntx.isDownloading == TRUE)
- {
- if (g_brw_dls_cntx.session_id != p_dl_stop_req->session_id )
- {
- mmi_brw_dls_send_file_dl_stop_rsp(WAP_DL_STATUS_DOWNLOADING, WAP_DL_ERROR_INVALID_SESSION_ID);
- }
- else
- {
- jdi_BrowserFetchStop(pBrowserCtxt);
- g_brw_cntx.isDownloading = FALSE;
- g_brw_cntx.isDownloadSuspended = FALSE;
- if (g_brw_cntx.dwnld_file_handle)
- {
- jdd_FSClose(g_brw_cntx.dwnld_file_handle);
- g_brw_cntx.dwnld_file_handle = NULL;
- if (g_brw_dls_cntx.p_file_name != NULL)
- {
- jdd_MemFree(g_brw_dls_cntx.p_file_name);
- g_brw_dls_cntx.p_file_name = NULL;
- }
- }
- if (g_brw_cntx.dwnld_fs_handle)
- {
- jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
- g_brw_cntx.dwnld_fs_handle = NULL;
- }
- mmi_brw_dls_send_file_dl_stop_rsp(WAP_DL_STATUS_CANCELLED, WAP_DL_ERROR_OK);
- }
- }
- else
- {
- mmi_brw_dls_send_file_dl_stop_rsp(WAP_DL_STATUS_COMPLETE,WAP_DL_ERROR_CANCELLED);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_dls_send_file_dl_stop_rsp
- * DESCRIPTION
- * To send response of file donwload request to DA
- * PARAMETERS
- * status [?]
- * cause [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_dls_send_file_dl_stop_rsp(U8 status, U8 cause)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MYQUEUE Message;
- wap_mmi_file_dl_stop_rsp_struct *p_dl_stop_rsp = (wap_mmi_file_dl_stop_rsp_struct *)construct_local_para(sizeof(wap_mmi_file_dl_stop_rsp_struct), TD_CTRL);
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)(%d)", "ENTER: mmi_brw_dls_send_file_dl_stop_rsp", status, cause));
- p_dl_stop_rsp->session_id = g_brw_dls_cntx.session_id;
- p_dl_stop_rsp->seq_num = g_brw_dls_cntx.seq_num;
- p_dl_stop_rsp->status = status;
- p_dl_stop_rsp->cause = cause;
- p_dl_stop_rsp->acc_size = g_brw_cntx.downloaded_content_length;
- Message.oslSrcId = MOD_WAP;
- Message.oslDestId = MOD_MMI;
- Message.oslMsgId = MSG_ID_WAP_MMI_FILE_DL_STOP_RSP;
- Message.oslDataPtr = (oslParaType*) p_dl_stop_rsp;
- Message.oslPeerBuffPtr = NULL;
- OslMsgSendExtQueue(&Message);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_dls_set_file_name
- * DESCRIPTION
- * This function is used to extract the file name from the given url and to set global variable g_brw_dls_cntx.p_file_name
- * PARAMETERS
- * url
- * delim
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_dls_set_file_name(U8 *url, U8 delim)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 url_len, file_name_len, file_ext_len, indexOfDelim, indexOfDot, indexOfFileNameEnd;
- S16 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ASSERT(url);
- url_len = (pfnUnicodeStrlen((S8*) url)) * ENCODING_LENGTH;
- file_name_len = indexOfDelim = indexOfDot = 0;
- indexOfFileNameEnd = url_len; // Here indexOfFileNameEnd is that index in the url which is either NULL character or special character like '?'
- for( i = url_len - 1 * ENCODING_LENGTH; i >= 0 ; i--)
- {
- if(*(url + i) == '?')
- {
- indexOfFileNameEnd = i; // '?' symbol present in the url. Ignore characters after '?' symbol
- }
- if(*(url + i) == '.')
- {
- indexOfDot = i;
- }
- if( *(url + i) == delim)
- {
- indexOfDelim = i;
- break;
- }
- }
- if (indexOfDelim == 0 || indexOfDot == 0 || indexOfDot < indexOfDelim || indexOfFileNameEnd < indexOfDot || indexOfFileNameEnd < indexOfDelim) // Invalid URL.
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s(%d)(%d)(%d)", "ERROR:mmi_brw_dls_set_file_name", indexOfDelim, indexOfDot, indexOfFileNameEnd));
- return;
- }
- file_ext_len = indexOfFileNameEnd - indexOfDot;
- file_name_len = indexOfDot - indexOfDelim - (1 * ENCODING_LENGTH);
- if(file_name_len + (1 * ENCODING_LENGTH) > WAP_DL_MAX_FILE_NAME_LEN - file_ext_len) // If file name length exceeds
- {
- file_name_len = WAP_DL_MAX_FILE_NAME_LEN - file_ext_len;
- }
- g_brw_dls_cntx.p_file_name = (JC_CHAR *)jdd_MemAlloc(file_name_len + file_ext_len + (1 * ENCODING_LENGTH), sizeof(S8));
- // Copying file_name_len characters from the url
- for (i = indexOfDelim + (1 * ENCODING_LENGTH); i < url_len ; i++)
- {
- *( (S8*) g_brw_dls_cntx.p_file_name + i - indexOfDelim - (1 * ENCODING_LENGTH) ) = *(url + i);
- if ( i - indexOfDelim - (1 * ENCODING_LENGTH) == file_name_len ) // break if file_name_len characters are copied
- {
- break;
- }
- }
- // Copying file_ext_len characters from the url
- for (i = 0; i < file_ext_len; i++)
- {
- *( (S8*) g_brw_dls_cntx.p_file_name + file_name_len + i) = *(url + indexOfDot + i);
- }
- *((S8*)g_brw_dls_cntx.p_file_name + file_name_len + file_ext_len) = ' ';
- *((S8*)g_brw_dls_cntx.p_file_name + file_name_len + file_ext_len + 1) = ' ';
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_dls_is_free_space_available
- * DESCRIPTION
- * To determine if free space is available for download
- * PARAMETERS
- * file_path
- * RETURNS
- * BOOL
- *****************************************************************************/
- BOOL mmi_brw_dls_is_free_space_available(void *file_path)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 fs_ret;
- FS_DiskInfo disk_info;
- S8 drv_name[16];
- S32 disk_free_space = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset(drv_name, 0, sizeof(drv_name));
- UCS2Strncpy((PS8) drv_name, (PS8) file_path, 3);
- fs_ret = FS_GetDiskInfo((PU16) drv_name, &disk_info, FS_DI_BASIC_INFO | FS_DI_FREE_SPACE);
- if (fs_ret >= 0)
- {
- disk_free_space = disk_info.FreeClusters * disk_info.SectorsPerCluster * disk_info.BytesPerSector;
- if (disk_free_space > g_brw_cntx.total_content_length)
- return TRUE;
- else
- return FALSE;
- }
- else
- return FALSE;
- }
- #endif /* __JBROWSER_DLS_SUPPORT__ */
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_header_info_callback_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * pAppArg [?]
- * pBrowserHeaderIndication [?]
- * RETURNS
- *
- *****************************************************************************/
- JC_RETCODE mmi_brw_header_info_callback_hdlr(void *pAppArg, COMM_HEADER_INDICATION *pBrowserHeaderIndication)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 download_msg[200] = {0};
- S8 tmp_str_ascii[50] = {0};
- S8 tmp_str_ucs2[100] = {0};
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- jdi_BrowserSuspendRequest(pBrowserCtxt);
- g_brw_cntx.isDownloadSuspended = TRUE;
- g_brw_cntx.total_content_length = 0;
- g_brw_cntx.downloaded_content_length = 0;
- memset((void*)&g_brw_cntx.dwnld_mime_info, 0, sizeof(JC_MIME_INFO));
- g_brw_cntx.dwnld_mime_info.psContentType = jdi_UtilsStrdup(pBrowserHeaderIndication->pszContentType);
- g_brw_cntx.dwnld_mime_info.psUrl = jdi_UtilsTcsDup(pBrowserHeaderIndication->psUrl);
- g_brw_cntx.downloadSizeInKB = FALSE;
- if (pBrowserHeaderIndication->uiContentLength)
- {
- g_brw_cntx.total_content_length = pBrowserHeaderIndication->uiContentLength;
- if (g_brw_cntx.total_content_length >= 1000)
- {
- g_brw_cntx.downloadSizeInKB = TRUE;
- }
- else
- {
- g_brw_cntx.downloadSizeInKB = FALSE;
- }
- g_brw_cntx.dwnld_mime_info.iBufferLen = pBrowserHeaderIndication->uiContentLength;
- }
- pfnUnicodeStrcpy(download_msg, GetString(STR_ID_BRW_DOWNLOAD_QUERY));
- pfnUnicodeStrcat(download_msg, "n");
- if (g_brw_cntx.total_content_length)
- {
- pfnUnicodeStrcat(download_msg, GetString(STR_ID_BRW_CONTENT_SIZE));
- pfnUnicodeStrcat(download_msg, ":");
- if (g_brw_cntx.downloadSizeInKB)
- {
- sprintf(tmp_str_ascii, "%.1f ", (g_brw_cntx.total_content_length / 1024.0));
- }
- else
- {
- sprintf(tmp_str_ascii, "%d ", g_brw_cntx.total_content_length);
- }
- AnsiiToUnicodeString(tmp_str_ucs2, tmp_str_ascii);
- pfnUnicodeStrcat(download_msg, tmp_str_ucs2);
- if (g_brw_cntx.downloadSizeInKB)
- {
- pfnUnicodeStrcat(download_msg, GetString(STR_ID_BRW_KB));
- }
- else
- {
- pfnUnicodeStrcat(download_msg, GetString(STR_ID_BRW_BYTES));
- }
- }
- g_brw_page_cntx.brw_PageFetchStatus = 0;
- mmi_brw_entry_download_confirm((UI_string_type) download_msg, mmi_brw_start_dwnld, mmi_brw_cancel_dwnld_and_goback);
- return JC_OK;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_entry_download_confirm
- * DESCRIPTION
- * Entry screen for download confirmation
- * PARAMETERS
- * message [IN]
- * lsk_hdlr [IN]
- * rsk_hdlr [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_entry_download_confirm(UI_string_type message, FuncPtr lsk_hdlr, FuncPtr rsk_hdlr)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *guiBuffer;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- guiBuffer = GetCurrGuiBuffer(SCR_ID_BRW_WAP_DOWNLOAD_CONFIRM);
- EntryNewScreen(SCR_ID_BRW_WAP_DOWNLOAD_CONFIRM, mmi_brw_exit_download_confirm, NULL, NULL);
- ShowCategory165Screen(
- STR_GLOBAL_YES,
- IMG_GLOBAL_YES,
- STR_GLOBAL_NO,
- IMG_GLOBAL_NO,
- message,
- IMG_GLOBAL_QUESTION,
- guiBuffer);
- SetLeftSoftkeyFunction(lsk_hdlr, KEY_EVENT_UP);
- SetRightSoftkeyFunction(rsk_hdlr, KEY_EVENT_UP);
- playRequestedTone(WARNING_TONE);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_exit_download_confirm
- * DESCRIPTION
- * Exit screen for download confirmation
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_exit_download_confirm(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_UINT32 navlist_count;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (!g_brw_cntx.isDownloading)
- {
- jdi_BrowserFetchStop(pBrowserCtxt);
- mmi_brw_free_dwnld_info_memory();
- jdi_BrowserGetNavListCount(pBrowserCtxt, &navlist_count);
- if (!navlist_count)
- {
- DeleteScreenIfPresent(SCR_ID_BRW_JBROWSER_MAIN);
- }
- }
- stopRequestedTone(WARNING_TONE);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_fetch_indication_info_callback_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * pAppArg [?]
- * pBrowserFetchURLIndResp [?]
- * RETURNS
- *
- *****************************************************************************/
- JC_RETCODE mmi_brw_fetch_indication_info_callback_hdlr(void *pAppArg, COMM_FETCH_URL_IND_RESP *pBrowserFetchURLIndResp)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE eRet;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((pBrowserFetchURLIndResp->bHasMoreData)
- || (!pBrowserFetchURLIndResp->bHasMoreData && pBrowserFetchURLIndResp->uiCurrentLength))
- {
- g_brw_cntx.downloaded_content_length += pBrowserFetchURLIndResp->uiCurrentLength;
- eRet = jdd_FSWrite(
- (void*)pBrowserFetchURLIndResp->pucBuffer,
- pBrowserFetchURLIndResp->uiCurrentLength,
- 1,
- g_brw_cntx.dwnld_file_handle);
- if (eRet == 1)
- {
- mmi_brw_update_downloading_msg();
- if (GetActiveScreenId() == SCR_ID_BRW_WAP_DOWNLOAD_PROGRESS)
- {
- cat66_update_progress_string();
- }
- }
- else
- {
- g_brw_cntx.isDownloading = FALSE;
- jdd_FSClose(g_brw_cntx.dwnld_file_handle);
- jdd_FSDelete(g_brw_cntx.dwnld_fs_handle, g_brw_cntx.dwnld_mime_info.psFileName);
- jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
- if (IsScreenPresent(SCR_ID_BRW_JBROWSER_MAIN))
- {
- g_brw_page_cntx.brw_pageRenderStatus = 1;
- }
- GoBackHistory();
- goto error_handle;
- }
- }
- if (!pBrowserFetchURLIndResp->bHasMoreData)
- {
- JC_UINT32 navlist_count;
- g_brw_cntx.isDownloading = FALSE;
- jdd_FSClose(g_brw_cntx.dwnld_file_handle);
- jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
- if (IsScreenPresent(SCR_ID_BRW_JBROWSER_MAIN))
- {
- g_brw_page_cntx.brw_pageRenderStatus = 1;
- }
- DeleteScreenIfPresent(SCR_ID_BRW_WAP_DOWNLOAD_PROGRESS);
- jdi_BrowserGetNavListCount(pBrowserCtxt, &navlist_count);
- if (!navlist_count)
- {
- mmi_brw_set_data_connection_deactive_flag(E_TRUE);
- mmi_brw_deinit_event();
- }
- eRet = jdd_MimeHandler(&g_brw_cntx.dwnld_mime_info);
- goto error_handle;
- }
- return JC_OK;
- error_handle:
- mmi_brw_free_dwnld_info_memory();
- return eRet;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_fetch_error_info_callback_hdlr
- * DESCRIPTION
- *
- * PARAMETERS
- * pAppArg [?]
- * uiReferenceID [IN]
- * eRet [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_fetch_error_info_callback_hdlr(void *pAppArg, JC_UINT32 uiReferenceID, JC_RETCODE eRet)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_brw_cntx.isDownloading = FALSE;
- mmi_brw_free_dwnld_info_memory();
- if (g_brw_cntx.dwnld_file_handle)
- {
- jdd_FSClose(g_brw_cntx.dwnld_file_handle);
- jdd_FSDelete(g_brw_cntx.dwnld_fs_handle, g_brw_cntx.dwnld_mime_info.psFileName);
- }
- if (g_brw_cntx.dwnld_fs_handle)
- {
- jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
- }
- if (g_brw_cntx.showDownloadAbortedPopup)
- {
- DisplayPopup((PU8) GetString(STR_ID_BRW_DOWNLOAD_ABORTED), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
- }
- else
- {
- g_brw_cntx.showDownloadAbortedPopup = TRUE;
- }
- DeleteScreenIfPresent(SCR_ID_BRW_WAP_DOWNLOAD_PROGRESS);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_start_dwnld
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_start_dwnld(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_CHAR *filename;
- JC_UINT32 navlist_count;
- JC_RETCODE eRet;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_brw_cntx.isDownloading = TRUE;
- g_brw_cntx.showDownloadAbortedPopup = TRUE;
- jdi_BrowserGetNavListCount(pBrowserCtxt, &navlist_count);
- if (!navlist_count)
- {
- DeleteScreenIfPresent(SCR_ID_BRW_JBROWSER_MAIN);
- }
- #ifdef __USB_IN_NORMAL_MODE__
- if (mmi_usb_is_in_mass_storage_mode())
- {
- mmi_usb_app_unavailable_popup(0);
- jdi_BrowserFetchStop(pBrowserCtxt);
- g_brw_cntx.showDownloadAbortedPopup = FALSE;
- goto error_handle;
- }
- #endif /* __USB_IN_NORMAL_MODE__ */
- eRet = jdd_FSInitialize(&g_brw_cntx.dwnld_fs_handle);
- if (eRet == JC_OK)
- {
- jdd_FSGetDownloadFileName(&filename);
- g_brw_cntx.dwnld_mime_info.psFileName = filename;
- g_brw_cntx.dwnld_file_handle = jdd_FSOpen(g_brw_cntx.dwnld_fs_handle, filename, E_CREATE_APPEND_WRITE_MODE);
- if (!g_brw_cntx.dwnld_file_handle)
- {
- jdi_BrowserFetchStop(pBrowserCtxt);
- g_brw_cntx.showDownloadAbortedPopup = FALSE;
- jdd_FSDeinitialize(g_brw_cntx.dwnld_fs_handle);
- DisplayPopup((PU8) GetString(STR_ID_BRW_FILE_SYSTEM_ERROR), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
- goto error_handle;
- }
- }
- else
- {
- jdi_BrowserFetchStop(pBrowserCtxt);
- g_brw_cntx.showDownloadAbortedPopup = FALSE;
- DisplayPopup((PU8) GetString(STR_ID_BRW_FILE_SYSTEM_ERROR), IMG_GLOBAL_ERROR, 1, JBROWSER_POPUP_TIME, ERROR_TONE);
- goto error_handle;
- }
- mmi_brw_entry_dwnld_progress();
- return;
- error_handle:
- mmi_brw_free_dwnld_info_memory();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_cancel_dwnld_and_goback
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_cancel_dwnld_and_goback(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_UINT32 navlist_count;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_brw_cntx.isDownloading = FALSE;
- g_brw_cntx.isDownloadSuspended = FALSE;
- g_brw_cntx.showDownloadAbortedPopup = FALSE;
- mmi_brw_free_dwnld_info_memory();
- jdi_BrowserGetNavListCount(pBrowserCtxt, &navlist_count);
- if (navlist_count)
- {
- GoBackHistory();
- }
- else
- {
- mmi_brw_set_data_connection_deactive_flag(E_TRUE);
- mmi_brw_deinit_all();
- GoBacknHistory(1);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_update_downloading_msg
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_update_downloading_msg(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S8 tmp_str_ascii[50];
- S8 tmp_str_ucs2[100];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_brw_cntx.total_content_length)
- {
- if (g_brw_cntx.downloadSizeInKB)
- {
- sprintf(
- tmp_str_ascii,
- "%.1f/%.1f",
- (g_brw_cntx.downloaded_content_length / 1024.0),
- (g_brw_cntx.total_content_length / 1024.0));
- AnsiiToUnicodeString(tmp_str_ucs2, tmp_str_ascii);
- pfnUnicodeStrcpy(g_brw_cntx.dwnld_progress_str, tmp_str_ucs2);
- pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, " ");
- pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, GetString(STR_ID_BRW_KB));
- pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, "n");
- pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, GetString(STR_ID_BRW_DOWNLOADED));
- }
- else
- {
- sprintf(tmp_str_ascii, "%d/%d", g_brw_cntx.downloaded_content_length, g_brw_cntx.total_content_length);
- AnsiiToUnicodeString(tmp_str_ucs2, tmp_str_ascii);
- pfnUnicodeStrcpy(g_brw_cntx.dwnld_progress_str, tmp_str_ucs2);
- pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, " ");
- pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, GetString(STR_ID_BRW_BYTES));
- pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, "n");
- pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, GetString(STR_ID_BRW_DOWNLOADED));
- }
- }
- else
- {
- if (g_brw_cntx.downloaded_content_length >= 1000)
- {
- sprintf(tmp_str_ascii, "%.1f", (g_brw_cntx.downloaded_content_length / 1024.0));
- AnsiiToUnicodeString(tmp_str_ucs2, tmp_str_ascii);
- pfnUnicodeStrcpy(g_brw_cntx.dwnld_progress_str, tmp_str_ucs2);
- pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, " ");
- pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, GetString(STR_ID_BRW_KB));
- pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, "n");
- pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, GetString(STR_ID_BRW_DOWNLOADED));
- }
- else
- {
- sprintf(tmp_str_ascii, "%d", g_brw_cntx.downloaded_content_length);
- AnsiiToUnicodeString(tmp_str_ucs2, tmp_str_ascii);
- pfnUnicodeStrcpy(g_brw_cntx.dwnld_progress_str, tmp_str_ucs2);
- pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, " ");
- pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, GetString(STR_ID_BRW_BYTES));
- pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, "n");
- pfnUnicodeStrcat(g_brw_cntx.dwnld_progress_str, GetString(STR_ID_BRW_DOWNLOADED));
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_entry_dwnld_progress
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_entry_dwnld_progress(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 title_icon = 0;
- nvram_wap_profile_content_struct *activated_wap_profile;
- activated_wap_profile = mmi_ph_get_activated_wap_profile();
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_brw_cntx.isDownloadSuspended)
- {
- jdi_BrowserResumeRequest(pBrowserCtxt);
- g_brw_cntx.isDownloadSuspended = FALSE;
- }
- mmi_brw_update_downloading_msg();
- EntryNewScreen(SCR_ID_BRW_WAP_DOWNLOAD_PROGRESS, mmi_brw_exit_dwnld_progress, NULL, NULL);
- if (mmi_ph_check_data_account_type(activated_wap_profile->data_account) == PH_DATA_ACCOUNT_CSD)
- {
- title_icon = IMG_ID_BRW_CONNECTION_STATUS_CSD;
- }
- else if (mmi_ph_check_data_account_type(activated_wap_profile->data_account) == PH_DATA_ACCOUNT_GPRS)
- {
- title_icon = IMG_ID_BRW_CONNECTION_STATUS_GPRS;
- }
- ShowCategory66Screen(
- STR_ID_BRW_INTERNET_SERVICES,
- title_icon,
- 0,
- 0,
- STR_GLOBAL_ABORT,
- IMG_GLOBAL_BACK,
- (U8*) g_brw_cntx.dwnld_progress_str,
- IMG_ID_BRW_SAT_WAIT,
- NULL);
- ClearAllKeyHandler();
- ClearKeyHandler(KEY_END, KEY_EVENT_UP);
- ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
- ClearKeyHandler(KEY_END, KEY_LONG_PRESS);
- ClearKeyHandler(KEY_END, KEY_REPEAT);
- ClearKeyHandler(KEY_VOL_UP, KEY_EVENT_UP);
- ClearKeyHandler(KEY_VOL_UP, KEY_EVENT_DOWN);
- ClearKeyHandler(KEY_VOL_UP, KEY_LONG_PRESS);
- ClearKeyHandler(KEY_VOL_UP, KEY_REPEAT);
- ClearKeyHandler(KEY_VOL_DOWN, KEY_EVENT_UP);
- ClearKeyHandler(KEY_VOL_DOWN, KEY_EVENT_DOWN);
- ClearKeyHandler(KEY_VOL_DOWN, KEY_LONG_PRESS);
- ClearKeyHandler(KEY_VOL_DOWN, KEY_REPEAT);
- SetRightSoftkeyFunction(mmi_brw_abort_dwnld, KEY_EVENT_UP);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_exit_dwnld_progress
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_exit_dwnld_progress(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- history h;
- S16 nHistory = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_brw_cntx.isDownloading)
- {
- jdi_BrowserSuspendRequest(pBrowserCtxt);
- g_brw_cntx.isDownloadSuspended = TRUE;
- h.scrnID = SCR_ID_BRW_WAP_DOWNLOAD_PROGRESS;
- h.entryFuncPtr = mmi_brw_entry_dwnld_progress;
- pfnUnicodeStrcpy((PS8) h.inputBuffer, (PS8) & nHistory);
- GetCategoryHistory(h.guiBuffer);
- AddHistory(h);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_abort_dwnld
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_abort_dwnld(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_brw_cntx.isDownloading = FALSE;
- g_brw_cntx.isDownloadSuspended = FALSE;
- mmi_brw_free_dwnld_info_memory();
- jdi_BrowserFetchStop(pBrowserCtxt);
- GoBackHistory();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_free_dwnld_info_memory
- * DESCRIPTION
- * Init function for browser application
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_free_dwnld_info_memory(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if(g_brw_cntx.dwnld_mime_info.psContentType)
- {
- jdd_MemFree(g_brw_cntx.dwnld_mime_info.psContentType);
- g_brw_cntx.dwnld_mime_info.psContentType = NULL;
- }
- if(g_brw_cntx.dwnld_mime_info.pBuffer)
- {
- jdd_MemFree(g_brw_cntx.dwnld_mime_info.pBuffer);
- g_brw_cntx.dwnld_mime_info.pBuffer = NULL;
- }
- if(g_brw_cntx.dwnld_mime_info.psUrl)
- {
- jdd_MemFree(g_brw_cntx.dwnld_mime_info.psUrl);
- g_brw_cntx.dwnld_mime_info.psUrl = NULL;
- }
- if(g_brw_cntx.dwnld_mime_info.psFileName)
- {
- jdd_MemFree(g_brw_cntx.dwnld_mime_info.psFileName);
- g_brw_cntx.dwnld_mime_info.psFileName = NULL;
- }
- }
- #ifdef BROWSER_PUSH_ENABLE
- /*****************************************************************************
- * FUNCTION
- * is_mmi_in_idle_state
- * DESCRIPTION
- * This API checks whether mmi is idle state or not.
- * PARAMETERS
- * void
- * RETURNS
- * return 1 if mmi is in idle state else return 0.
- *****************************************************************************/
- static U16 is_mmi_in_idle_state(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((IDLE_SCREEN_ID == GetActiveScreenId()) || g_idle_context.ScreenSaverRunFlag)
- {
- return 1;
- }
- else
- {
- return 0;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_push_callback
- * DESCRIPTION
- * Push callback
- * PARAMETERS
- * pAppArg [?]
- * pServiceValue [?]
- * cbConfirm [IN]
- * RETURNS
- * void
- *****************************************************************************/
- JC_RETCODE mmi_brw_push_callback(
- void *pAppArg,
- SERVICE_VALUE *pServiceValue,
- CB_BROWSER_PUSH_RESPONSE_HANDLER cbConfirm)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_UNIFIED_MESSAGE__
- MMI_ALERT_TYPE alertType;
- #endif
- JC_UINT32 brw_total_msg_count;
- JC_UINT32 brw_unread_msg_count;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (ACTION_SIGNAL_NONE_VAL == pServiceValue->eActionSignal)
- {
- mmi_brw_delete_push_msg(0);
- return JC_OK;
- }
- mmi_brw_create_push_msg_list();
- #ifndef __MMI_UNIFIED_MESSAGE__
- TurnOnBacklight(1);
- if (is_mmi_in_idle_state())
- {
- PlayMessageArrivalTone();
- mmi_brw_new_push_msg_ind_on_idlescreen();
- g_brw_cntx.push_msg_rcvd_flag = MMI_FALSE;
- }
- else if(SCR_ID_BRW_NEW_PUSH_MESSAGE_IND == GetActiveScreenId())
- {
- PlayMessageArrivalTone();
- g_brw_cntx.push_msg_rcvd_flag = MMI_TRUE;
- GoBackHistory();
- }
- else if(MMI_FALSE == g_mmi_brw_delete_push_notification)
- {
- /*
- if (POPUP_SCREENID == GetActiveScreenId())
- {
- EntryNewScreen(SCR_ID_BRW_WAP_PUSH_POPUP_DUMMY_SCREEN, NULL, NULL, NULL);
- }
- */
- ShowStatusIcon(STATUS_ICON_WAP);
- UpdateStatusIcons();
- mmi_msg_entry_new_msg_popup(MSG_NEW_PUSH);
- g_brw_cntx.push_msg_rcvd_flag = MMI_TRUE;
- /* As we are adding the new message at the top of message list, So
- if a new message come Nth message will become the (N+1)th message.
- Vivek - 01082006 */
- if ((TRUE == IsScreenPresent(SCR_ID_BRW_SERVICE_INBOX)) || (SCR_ID_BRW_SERVICE_INBOX == GetActiveScreenId()))
- {
- g_brw_index_current_highlighted_item++;
- }
- }
- #else /* __MMI_UNIFIED_MESSAGE__ */
- TurnOnBacklight(1);
- /* PlayMessageArrivalTone(); */
- if (!isInCall())
- {
- if ((!is_mmi_in_idle_state()) &&
- (SCR_ID_UM_NEW_MSG_IND != GetActiveScreenId()) &&
- (MMI_FALSE == g_mmi_brw_delete_push_notification)
- )
- {
- /*
- if (POPUP_SCREENID == GetActiveScreenId())
- {
- EntryNewScreen(SCR_ID_BRW_WAP_PUSH_POPUP_DUMMY_SCREEN, NULL, NULL, NULL);
- }
- */
- ShowStatusIcon(STATUS_ICON_WAP);
- UpdateStatusIcons();
- mmi_msg_entry_new_msg_popup(MSG_NEW_PUSH);
- }
- }
- else
- {
- alertType = GetMtCallAlertTypeEnum();
- if (alertType == MMI_VIBRATION_AND_RING || alertType == MMI_VIBRATION_THEN_RING || alertType == MMI_RING)
- {
- playRequestedTone((U8) SMS_IN_CALL_TONE);
- }
- }
- if ((TRUE == IsScreenPresent(SCR_ID_UM_INBOX)) || (SCR_ID_UM_INBOX == GetActiveScreenId()))
- {
- g_brw_index_current_highlighted_item++;
- }
- mmi_um_brw_new_push_message_ind(pServiceValue);
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- /* Save to persistant storage */
- jdi_BrowserPushSaveCurrentInfo(pBrowserCtxt);
- jdi_BrowserPushGetStatistics(pBrowserCtxt, &brw_total_msg_count, &brw_unread_msg_count);
- if (brw_unread_msg_count > 0)
- {
- /* Display unread message icon on idle screen */
- ShowStatusIcon(STATUS_ICON_WAP);
- }
- else
- {
- /* hide unread push message icon on idle screen */
- HideStatusIcon(STATUS_ICON_WAP);
- }
- g_mmi_brw_delete_push_notification = MMI_FALSE;
- return JC_ERR_WAIT_USER_ACTION;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_push_PPG_validate_callback
- * DESCRIPTION
- * Push PPG validate callback
- * PARAMETERS
- * pAppArg [?]
- * bIsPPGAddress [IN]
- * pcPPGHostAddress [?]
- * RETURNS
- * void
- *****************************************************************************/
- JC_BOOLEAN mmi_brw_push_PPG_validate_callback(void *pAppArg, JC_BOOLEAN bIsPPGAddress, JC_INT8 *pcPPGHostAddress)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_BOOLEAN bIsPPGValid = E_TRUE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (bIsPPGAddress)
- {
- bIsPPGValid = mmi_brw_check_ip((PS8) pcPPGHostAddress);
- }
- return bIsPPGValid;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_push_inbox_full_callback
- * DESCRIPTION
- * Push Inbox Full callback
- * PARAMETERS
- * pAppArg [?]
- * pServiceValue [?]
- * cbConfirm [IN]
- * RETURNS
- * void
- *****************************************************************************/
- JC_RETCODE mmi_brw_push_inbox_full_callback(
- void *pAppArg,
- SERVICE_VALUE *pServiceValue,
- CB_BROWSER_PUSHFULL_RESPONSE_HANDLER cbConfirm)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U32 brw_total_msg_count, brw_unread_msg_count;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_brw_get_push_statistics(&brw_total_msg_count, &brw_unread_msg_count);
- if (ACTION_SIGNAL_NONE_VAL == pServiceValue->eActionSignal)
- {
- return JC_ERR_NOT_SUPPORTED;
- }
- else
- {
- mmi_brw_delete_push_msg(brw_total_msg_count - 1);
- }
- return JC_OK;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_push_inbox_max_size_callback
- * DESCRIPTION
- * Push Inbox max size reached callback
- * PARAMETERS
- * pCtxt [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_push_inbox_max_size_callback(void *pCtxt)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_push_with_delete_action
- * DESCRIPTION
- * Push Inbox callback when core will get the push with
- * delete action.
- * PARAMETERS
- * pCtxt [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_push_with_delete_action(void *pCtxt)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_UINT32 brw_total_msg_count = 0;
- JC_UINT32 brw_unread_msg_count = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- jdi_BrowserPushGetStatistics(pBrowserCtxt, &brw_total_msg_count, &brw_unread_msg_count);
- if (brw_unread_msg_count > 0)
- {
- /* Display unread message icon on idle screen */
- ShowStatusIcon(STATUS_ICON_WAP);
- }
- else
- {
- /* hide unread push message icon on idle screen */
- HideStatusIcon(STATUS_ICON_WAP);
- /* Added by Vivek 26072006 */
- g_brw_cntx.push_msg_rcvd_flag = MMI_FALSE;
- }
- UpdateStatusIcons();
- mmi_brw_create_push_msg_list();
- if ((SCR_ID_BRW_READ_SERVICE_MESSAGE == GetActiveScreenId()) ||
- (SCR_ID_BRW_PUSH_MESSAGE_READ_OPTIONS == GetActiveScreenId()) ||
- ((SCR_CONFIRM_SCREEN == GetActiveScreenId()) && (SCR_ID_BRW_PUSH_MESSAGE_READ_OPTIONS == GetCurrScrnId()))
- )
- {
- g_mmi_brw_delete_push_notification = MMI_TRUE;
- /* DisplayPopup((PU8) GetString(STR_GLOBAL_DELETE), IMG_GLOBAL_DELETED, 1, JBROWSER_POPUP_TIME, SUCCESS_TONE); */
- DisplayPopup((PU8) GetString(STR_ID_BRW_PUSH_INBOX_MODIFIED), IMG_GLOBAL_INFO, 1, JBROWSER_POPUP_TIME, SUCCESS_TONE);
- #ifndef __MMI_UNIFIED_MESSAGE__
- DeleteUptoScrID(SCR_ID_BRW_SERVICE_INBOX);
- #else /* __MMI_UNIFIED_MESSAGE__ */
- DeleteUptoScrID(SCR_ID_UM_INBOX);
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- }
- else
- {
- #ifndef __MMI_UNIFIED_MESSAGE__
- if ((SCR_ID_BRW_SERVICE_INBOX_OPTIONS == GetActiveScreenId()) ||
- ((SCR_CONFIRM_SCREEN == GetActiveScreenId()) &&
- (SCR_ID_BRW_SERVICE_INBOX_OPTIONS == GetCurrScrnId())
- ))
- {
- g_mmi_brw_delete_push_notification = MMI_TRUE;
- DisplayPopup((PU8) GetString(STR_ID_BRW_PUSH_INBOX_MODIFIED), IMG_GLOBAL_INFO, 1, JBROWSER_POPUP_TIME, SUCCESS_TONE);
- DeleteUptoScrID(SCR_ID_BRW_SERVICE_INBOX);
- }
- else if((SCR_ID_BRW_SERVICE_INBOX == GetActiveScreenId()) ||
- (SCR_ID_BRW_NEW_PUSH_MESSAGE_IND == GetActiveScreenId()) ||
- (SCR_ID_BRW_NEW_PUSH_MESSAGE_IND == GetCurrScrnId())
- )
- {
- g_mmi_brw_delete_push_notification = MMI_TRUE;
- DisplayPopup((PU8) GetString(STR_ID_BRW_PUSH_INBOX_MODIFIED), IMG_GLOBAL_INFO, 1, JBROWSER_POPUP_TIME, SUCCESS_TONE);
- }
- #else /* __MMI_UNIFIED_MESSAGE__ */
- if ((SCR_ID_UM_MAIN == GetActiveScreenId()) ||
- (SCR_ID_UM_INBOX == GetActiveScreenId()) ||
- (SCR_ID_UM_NEW_MSG_IND == GetActiveScreenId())
- )
- {
- g_mmi_brw_delete_push_notification = MMI_TRUE;
- DisplayPopup((PU8) GetString(STR_ID_BRW_PUSH_INBOX_MODIFIED), IMG_GLOBAL_INFO, 1, JBROWSER_POPUP_TIME, SUCCESS_TONE);
- }
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- }
- }
- #endif /* BROWSER_PUSH_ENABLE */
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_show_progress_bar_callback
- * DESCRIPTION
- * Show progress bar callback
- * PARAMETERS
- * pAppArg [?]
- * pProgressBarInfo [?]
- * RETURNS
- * void
- *****************************************************************************/
- JC_RETCODE mmi_brw_show_progress_bar_callback(void *pAppArg, JC_PROGRESSBAR_INFO *pProgressBarInfo)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return JC_OK;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_page_rendering_status_callback
- * DESCRIPTION
- * Page rendering status callback
- * PARAMETERS
- * pAppArg [?]
- * ePageRenderingStatus [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_page_rendering_status_callback(void *pAppArg, EPageRenderingStatus ePageRenderingStatus)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_show_animated_title
- * DESCRIPTION
- * Showing title with appropiate icon and animation
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_show_animated_title(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- nvram_wap_profile_content_struct *activated_wap_profile;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_brw_page_cntx.brw_PageStatusCodeStack[1] == E_BROWSER_FETCH_BEGIN)
- {
- activated_wap_profile = mmi_ph_get_activated_wap_profile();
- if (mmi_brw_is_animated_title() == MMI_FALSE)
- {
- if (mmi_ph_check_data_account_type(activated_wap_profile->data_account) == PH_DATA_ACCOUNT_CSD)
- {
- MMI_title_icon = (PU8) get_image(IMG_ID_BRW_CONNECTION_STATUS_CSD);
- }
- else if (mmi_ph_check_data_account_type(activated_wap_profile->data_account) == PH_DATA_ACCOUNT_GPRS)
- {
- MMI_title_icon = (PU8) get_image(IMG_ID_BRW_CONNECTION_STATUS_GPRS);
- }
- else
- {
- /* Error */
- }
- g_brw_title_icon_animation_status = MMI_TRUE;
- if (GetActiveScreenId() == SCR_ID_BRW_JBROWSER_MAIN)
- {
- draw_title();
- }
- }
- }
- else if ((g_brw_page_cntx.brw_PageStatusCodeStack[0] == E_BROWSER_PAGE_REQUEST_BEGIN) && (g_brw_page_cntx.brw_PageStatusCodeStack[1] != E_BROWSER_FETCH_BEGIN)
- && (g_brw_page_cntx.brw_PageStatusCodeStack[2] == E_BROWSER_RENDERING_BEGIN))
- {
- MMI_title_icon = (PU8)get_image(GetRootTitleIcon(SERVICES_WAP_MENU_ID));
- g_brw_title_icon_animation_status = MMI_FALSE;
- if (GetActiveScreenId() == SCR_ID_BRW_JBROWSER_MAIN)
- {
- draw_title();
- }
- }
- else
- {
- if (GetActiveScreenId() == SCR_ID_BRW_JBROWSER_MAIN)
- {
- mmi_brw_show_normal_title();
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_show_normal_title
- * DESCRIPTION
- * Showing title with appropiate normal title icon.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_show_normal_title(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- nvram_wap_profile_content_struct *activated_wap_profile;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_brw_title_icon_animation_status = MMI_FALSE;
- activated_wap_profile = mmi_ph_get_activated_wap_profile();
- if (mmi_ph_check_data_account_type(activated_wap_profile->data_account) == PH_DATA_ACCOUNT_CSD)
- {
- MMI_title_icon = (PU8) get_image(IMG_ID_BRW_CONNECTION_STATUS_CSD_STATIC);
- }
- else if (mmi_ph_check_data_account_type(activated_wap_profile->data_account) == PH_DATA_ACCOUNT_GPRS)
- {
- MMI_title_icon = (PU8) get_image(IMG_ID_BRW_CONNECTION_STATUS_GPRS_STATIC);
- }
- draw_title();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_is_animated_title
- * DESCRIPTION
- * Showing title with appropiate normal title icon.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- MMI_BOOL mmi_brw_is_animated_title(void)
- {
- return g_brw_title_icon_animation_status;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_empty_navlist_callback
- * DESCRIPTION
- * Empty Navigation List callback
- * PARAMETERS
- * pAppArg [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_empty_navlist_callback(void *pAppArg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_brw_LskLabel = STR_GLOBAL_OPTIONS;
- g_brw_LskFunPtr = mmi_brw_rendered_page_options;
- g_brw_RskLabel = 0;
- g_brw_RskFunPtr = NULL;
- if (E_TRUE == mmi_brw_is_back())
- {
- g_brw_RskLabel = STR_GLOBAL_BACK;
- g_brw_RskFunPtr = mmi_brw_goto_prev_page;
- }
- if (GetActiveScreenId() == SCR_ID_BRW_JBROWSER_MAIN)
- {
- ChangeRightSoftkey(g_brw_RskLabel, 0);
- ChangeLeftSoftkey(g_brw_LskLabel, 0);
- SetLeftSoftkeyFunction((FuncPtr) g_brw_LskFunPtr, KEY_EVENT_UP);
- SetRightSoftkeyFunction((FuncPtr) g_brw_RskFunPtr, KEY_EVENT_UP);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_handle_page_request_begin
- * DESCRIPTION
- * It handle the page request begin status
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_handle_page_request_begin(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset(g_brw_page_cntx.brw_PageStatusCodeStack, -1, sizeof(g_brw_page_cntx.brw_PageStatusCodeStack));
- /* In case of auto page refresh and current screen is rendered page option screen */
- if (GetActiveScreenId() == SCR_ID_BRW_RENDERED_PAGE_OPTIONS)
- {
- GoBackHistory();
- }
- else
- {
- DeleteScreenIfPresent(SCR_ID_BRW_RENDERED_PAGE_OPTIONS);
- }
- /* The function below added by Shantanu(PMT) - 20060808 */
- /* This function will check the active screen.And if the active screen is not browser
- it will make browser screen the active screen.Specially for listbox */
- mmi_jdd_ui_goback_to_browser_screen();
- /* This flag will intimate the user that the page content has been refreshed if
- while the user is inside the fullscreen editor and when selects done from the
- input editor option screen */
- mmi_jdd_ui_set_jdd_flag(JDD_AUTO_REFRESH_FLAG, E_TRUE);
- /* We will not allow the user to enter the fullscreen editor if submit button is clicked */
- mmi_jdd_ui_set_jdd_flag(JDD_MANUAL_REFRESH_FLAG, E_TRUE);
- jdi_BrowserSuspendMarqueeTimer(pBrowserCtxt);
- g_brw_page_cntx.brw_PageStatusCodeStack[0] = E_BROWSER_PAGE_REQUEST_BEGIN;
- g_brw_page_cntx.brw_PageFetchStatus = 1;
- g_brw_page_cntx.brw_isRefreshDisplay = MMI_FALSE;
- g_brw_showimgflag = g_brw_cntx.show_images;
- g_brw_LskLabel = 0;
- g_brw_RskLabel = STR_GLOBAL_CANCEL;
- g_brw_LskFunPtr = NULL;
- g_brw_RskFunPtr = mmi_brw_stop_fetch;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_handle_page_request_terminated
- * DESCRIPTION
- * It handle the page request terminated status
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_handle_page_request_terminated(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if(g_EndKey_pressed)
- {
- DisplayIdleScreen();
- return;
- }
- if (g_brw_page_cntx.brw_pageRenderStatus == 1 || g_brw_page_cntx.brw_cancel_flag)
- {
- if (g_brw_page_cntx.brw_pageRenderStatus)
- {
- g_brw_page_cntx.brw_Pre_PageRenderStatus = 1;
- }
- if (GetActiveScreenId() == SCR_ID_BRW_JBROWSER_MAIN)
- {
- mmi_brw_show_normal_title();
- }
- if (E_TRUE == mmi_brw_is_back())
- {
- g_brw_LskLabel = STR_GLOBAL_OPTIONS;
- g_brw_RskLabel = STR_GLOBAL_BACK;
- g_brw_LskFunPtr = mmi_brw_rendered_page_options;
- g_brw_RskFunPtr = mmi_brw_goto_prev_page;
- }
- else
- {
- if (g_brw_page_cntx.brw_cancel_flag)
- {
- if (g_brw_cntx.page_fetch_event == BRW_START_FETCH_EVENT && g_brw_page_cntx.brw_pageRenderStatus != 1 &&
- !g_brw_page_cntx.brw_Pre_PageRenderStatus)
- {
- g_brw_page_cntx.brw_cancel_flag = 0;
- g_brw_page_cntx.brw_pageRenderStatus = 0;
- g_brw_page_cntx.brw_PageFetchStatus = 0;
- g_brw_page_cntx.brw_Pre_PageRenderStatus = 0;
- if (GetActiveScreenId() == SCR_ID_BRW_JBROWSER_MAIN)
- {
- mmi_brw_set_data_connection_deactive_flag(E_TRUE);
- mmi_brw_deinit_all();
- GoBackHistory();
- }
- else
- {
- mmi_brw_set_data_connection_deactive_flag(E_TRUE);
- mmi_brw_deinit_all();
- DeleteScreenIfPresent(SCR_ID_BRW_JBROWSER_MAIN);
- }
- jdi_BrowserHistorySave(pBrowserCtxt);
- return;
- }
- }
- g_brw_LskLabel = STR_GLOBAL_OPTIONS;
- g_brw_RskLabel = 0;
- g_brw_LskFunPtr = mmi_brw_rendered_page_options;
- g_brw_RskFunPtr = NULL;
- }
- g_brw_add_hist_flag = 0;// added by tk
- g_brw_enter_add_flag = 0;
- }
- g_brw_page_cntx.brw_cancel_flag = 0;
- g_brw_page_cntx.brw_pageRenderStatus = 0;
- g_brw_page_cntx.brw_PageFetchStatus = 0;
- /* Added By Shantanu - 20060810 */
- /* We have to reset the flag so that the user can enter the fullscreen editor */
- mmi_jdd_ui_set_jdd_flag(JDD_MANUAL_REFRESH_FLAG, E_FALSE);
- jdi_BrowserResumeMarqueeTimer(pBrowserCtxt);
- memset(g_brw_page_cntx.brw_PageStatusCodeStack, -1, sizeof(g_brw_page_cntx.brw_PageStatusCodeStack));
- jdi_BrowserHistorySave(pBrowserCtxt);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_brw_handle_page_fetch_begin
- * DESCRIPTION
- * It handle the page fetch begin status
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_brw_handle_page_fetch_begin(void)
- {