⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jbrowsermmiserviceinbox.c

📁 MTK手机平台的MMI部分的源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
/*****************************************************************************
*  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:
 * ---------
 * JBrowserMMIServiceInbox.c
 *
 * Project:
 * --------
 *   MAUI
 *
 * Description:
 * ------------
 *   This file is intends for service inbox implementation.
 *
 * Author:
 * -------
 * -------
 *
 *============================================================================
 *             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!
 *
 *------------------------------------------------------------------------------
 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *============================================================================
 ****************************************************************************/
#ifndef _MMI_JBROWSERMMISERVICEINBOX_C
#define _MMI_JBROWSERMMISERVICEINBOX_C

#include "MMI_features.h"

#if defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT)
#ifndef __MMI_UNIFIED_MESSAGE__
#include "PixtelDataTypes.h"
#include "Unicodexdcl.h"
#include "HistoryGprot.h"
#include "GlobalDefs.h"
#include "SettingProfile.h"
#include "DebugInitDef.h"
#include "CommonScreens.h"
#include "EventsGprot.h"
#include "wgui_inputs.h"
#include "wgui_categories.h"
#include "wgui_categories_inputs.h"
#include "OrganizerDef.h"
#include "DateTimeGprot.h"
#include "TimerEvents.h"

#include "wgui_categories_popup.h"
#include "settingGprots.h"

#include "wgui_status_icons.h"

#include "NVRAMType.h"
#include "NVRAMProt.h"
#include "NVRAMEnum.h"

#include "ddl.h"
#include "jcal.h"
#include "jdd_memapi.h"
#include "browserlayout.h"
#include "jdi_servicehandler.h"
#include "jdi_browserinterface.h"
#include "fsm.h"
#include "IdleAppDef.h"

#include "JBrowserMMIDefs.h"
#include "JBrowserMMIProts.h"
#include "JBrowserMMITypes.h"
#include "JBrowserMMIGprots.h"

#include "JPushInboxCommonAPIs.h"
#include "JPushInboxCommonUI.h"
#include "time.h"
#include "DateTimeGprot.h"
#include "MessagesResourceData.h"
#include "MessagesMiscell.h"

#ifdef  __MMI_KEYPAD_LOCK_PROMPT_TEXT__
#include "KeyBrd.h"
#endif

U8 *g_read_arrived_message_buffer = NULL;
SERVICE_VALUE *g_brw_rcvd_service_msg_p = NULL;


/*****************************************************************************
 * FUNCTION
 *  mmi_brw_entry_service_inbox
 * DESCRIPTION
 *  Entry function for service inbox
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_brw_entry_service_inbox(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 *guiBuffer;
    JC_UINT32 brw_total_msg_count;
    JC_UINT32 brw_unread_msg_count;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_brw_get_push_statistics(&brw_total_msg_count, &brw_unread_msg_count);

    /* While reading the messsage from idle screen when user will press back. 
       at that time while displying the message list local buffer should clear
       Vivek - 12082006 */
    mmi_brw_push_free_service_value_struct(&g_current_service_message);

    g_brw_cntx.push_msg_rcvd_flag = MMI_FALSE;
    g_mmi_brw_delete_push_notification = MMI_FALSE;

    /* Display 'Empty' if no push messages are present */
    if ((brw_total_msg_count) == 0)
    {
        DisplayPopup((PU8) GetString(STR_GLOBAL_EMPTY), IMG_GLOBAL_EMPTY, 1, UI_POPUP_NOTIFYDURATION_TIME, EMPTY_LIST_TONE);

        /* Added by Vivek - 30july, 2006. If push inbox is open from the 'idle screen 
           push indication'. After showing the empty pop up it should return to 
           idle screen */
        if (SCR_ID_BRW_NEW_PUSH_MESSAGE_IND == GetCurrScrnId())
        {
            DeleteNHistory(1);
        }
    }
    else
    {
        EntryNewScreen(SCR_ID_BRW_SERVICE_INBOX, NULL, mmi_brw_entry_service_inbox, NULL);

        /* Added by Vivek - 11july, 2006. If push inbox is open from the 'idle screen 
           push indication' */
        if (SCR_ID_BRW_NEW_PUSH_MESSAGE_IND == GetCurrScrnId())
        {
            DeleteNHistory(1);
        }

        guiBuffer = GetCurrGuiBuffer(SCR_ID_BRW_SERVICE_INBOX);

        mmi_brw_create_push_msg_list();

        ShowCategory184Screen(
            STR_ID_BRW_SERVICE_INBOX,
            GetRootTitleIcon(SERVICES_WAP_MENU_ID),
            STR_GLOBAL_OPTIONS,
            0,
            STR_GLOBAL_BACK,
            0,
            brw_total_msg_count,
            mmi_brw_service_inbox_list_get_item,
            0,
            0,
            guiBuffer);

        SetLeftSoftkeyFunction(mmi_brw_highlighted_push_msg, KEY_EVENT_UP);
        SetKeyHandler(mmi_brw_highlighted_push_msg, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);

        SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
        SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_brw_service_inbox_list_get_item
 * DESCRIPTION
 *  Item call back function for dynamic list of push messages
 * PARAMETERS
 *  item_index          [IN]        
 *  str_buff            [IN]        
 *  img_buff_p          [?]         
 *  str_img_mask        [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
pBOOL mmi_brw_service_inbox_list_get_item(S32 item_index, UI_string_type str_buff, PU8 *img_buff_p, U8 str_img_mask)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    struct tm expiry_timestamp = {0};
    time_t expiry_secs_since_1970 = {0};
    time_t current_secs_since_1970 = {0};
    U32 rcvd_message_href_len = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if ((item_index < 0) || (item_index > g_max_push_messages))
    {
        return FALSE;
    }

    /* Edited by Vivek - 5th july 2006 */
    if (g_brw_service_msg_list_p[item_index]->service_flag == SERVICE_INDICATION)
    {
        if ((NULL == g_brw_service_msg_list_p[item_index]->pmMessage) ||
            !pfnUnicodeStrlen((S8*) g_brw_service_msg_list_p[item_index]->pmMessage))
        {
            rcvd_message_href_len = pfnUnicodeStrlen((S8*) g_brw_service_msg_list_p[item_index]->pmHref);
            if (rcvd_message_href_len > MAX_SUBMENU_CHARACTERS - 1)
            {
                pfnUnicodeStrncpy(
                    (S8*) str_buff,
                    (S8*) g_brw_service_msg_list_p[item_index]->pmHref,
                    MAX_SUBMENU_CHARACTERS - 3);
                pfnUnicodeStrcat((S8*) str_buff, ".\0.\0.\0");
            }
            else
            {
                pfnUnicodeStrcpy((S8*) str_buff, (S8*) g_brw_service_msg_list_p[item_index]->pmHref);
            }
        }
        else
        {
            rcvd_message_href_len = pfnUnicodeStrlen((S8*) g_brw_service_msg_list_p[item_index]->pmMessage);
            if (rcvd_message_href_len > MAX_SUBMENU_CHARACTERS - 1)
            {
                pfnUnicodeStrncpy(
                    (S8*) str_buff,
                    (S8*) g_brw_service_msg_list_p[item_index]->pmMessage,
                    MAX_SUBMENU_CHARACTERS - 3);
                pfnUnicodeStrcat((S8*) str_buff, ".\0.\0.\0");
            }
            else
            {
                pfnUnicodeStrcpy((S8*) str_buff, (S8*) g_brw_service_msg_list_p[item_index]->pmMessage);
            }
        }
    }
    else if (g_brw_service_msg_list_p[item_index]->service_flag == SERVICE_LOADING)
    {
        rcvd_message_href_len = pfnUnicodeStrlen((S8*) g_brw_service_msg_list_p[item_index]->pmHref);
        if (rcvd_message_href_len > MAX_SUBMENU_CHARACTERS - 1)
        {
            pfnUnicodeStrncpy(
                (S8*) str_buff,
                (S8*) g_brw_service_msg_list_p[item_index]->pmHref,
                MAX_SUBMENU_CHARACTERS - 3);
            pfnUnicodeStrcat((S8*) str_buff, ".\0.\0.\0");
        }
        else
        {
            pfnUnicodeStrcpy((S8*) str_buff, (S8*) g_brw_service_msg_list_p[item_index]->pmHref);
        }
    }
    else
    {
        /* ERROR */
    }

    /* Expiry time is to be calculated in case of SI to display expired message in case of expired message */
    if (g_brw_service_msg_list_p[item_index]->service_flag == SERVICE_INDICATION)
    {
        if (g_brw_service_msg_list_p[item_index]->pSIExpires != NULL)
        {
            expiry_timestamp.tm_mon = g_brw_service_msg_list_p[item_index]->pSIExpires->month - 1;      /* month scale to 0 to 11 */
            expiry_timestamp.tm_year = g_brw_service_msg_list_p[item_index]->pSIExpires->year - 1900;   /* offset since 1900 */
            expiry_timestamp.tm_mday = g_brw_service_msg_list_p[item_index]->pSIExpires->day;
            expiry_timestamp.tm_hour = g_brw_service_msg_list_p[item_index]->pSIExpires->hour;
            expiry_timestamp.tm_min = g_brw_service_msg_list_p[item_index]->pSIExpires->minute;
            expiry_timestamp.tm_sec = g_brw_service_msg_list_p[item_index]->pSIExpires->seconds;

            /* Get difference of seconds of expiry time from 1970 (as per UTC standard) */
            expiry_secs_since_1970 = (time_t) mktime(&expiry_timestamp);
            /* Get difference of seconds of current time from 1970 (as per UTC standard) */
            current_secs_since_1970 = get_current_utc_time();
        }

        /* Show icon depending on whether it is read,unread,read but expired and unread but expired */
        if (g_brw_service_msg_list_p[item_index]->bIsRead == 0)
        {
            if ((expiry_secs_since_1970 > current_secs_since_1970) ||
                (g_brw_service_msg_list_p[item_index]->pSIExpires == NULL))
            {
                *img_buff_p = get_image(IMG_ID_BRW_PUSH_UNREAD);
            }
            else
            {
                *img_buff_p = get_image(IMG_ID_BRW_PUSH_EXPIRED_UNREAD);
            }
        }
        else
        {
            if ((expiry_secs_since_1970 > current_secs_since_1970) ||
                (g_brw_service_msg_list_p[item_index]->pSIExpires == NULL))
            {
                *img_buff_p = get_image(IMG_ID_BRW_PUSH_READ);
            }
            else
            {
                *img_buff_p = get_image(IMG_ID_BRW_PUSH_EXPIRED_READ);
            }
        }
    }
    else if (g_brw_service_msg_list_p[item_index]->service_flag == SERVICE_LOADING)
    {
        if (g_brw_service_msg_list_p[item_index]->bIsRead == 0)
        {
            *img_buff_p = get_image(IMG_ID_BRW_PUSH_UNREAD);
        }
        else
        {
            *img_buff_p = get_image(IMG_ID_BRW_PUSH_READ);
        }
    }
    else
    {
        /* error */
    }

    return TRUE;
}


/*****************************************************************************
 * FUNCTION
 *  mmi_brw_highlighted_push_msg
 * DESCRIPTION
 *  Function to get the highlighted push message and call appropriate function.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_brw_highlighted_push_msg(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -