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

📄 jpushinboxcommonui.c

📁 MTK手机平台的MMI部分的源代码
💻 C
📖 第 1 页 / 共 3 页
字号:
        return local_time_p;
    }

    currGMTTime.nSec = gmt_time_p->seconds;
    currGMTTime.nMin = gmt_time_p->minute;
    currGMTTime.nHour = gmt_time_p->hour;
    currGMTTime.nDay = gmt_time_p->day;
    currGMTTime.nMonth = gmt_time_p->month;
    currGMTTime.nYear = gmt_time_p->year;

    timeSecs = (U32) mmi_dt_mytime_2_utc_sec(&currGMTTime, MMI_TRUE);

    tz = mmi_dt_get_tz();
    if(tz < 0)
    {
        time = applib_conv_tz_to_mytime(tz * (-1));
    }
    else
    {
        time = applib_conv_tz_to_mytime(tz);
    }
    tzdiff =  time.nHour * 3600 + time.nMin * 60 + time.nSec;

    if(tz > 0)
    {
    	local_time = timeSecs + tzdiff;
    }
    else
    {
    	local_time = timeSecs - tzdiff;
    }

    mmi_dt_utc_sec_2_mytime(local_time, &result, MMI_TRUE);

    local_time_p.year = result.nYear;
    local_time_p.month = result.nMonth;
    local_time_p.day = result.nDay;
    local_time_p.hour = result.nHour;
    local_time_p.minute = result.nMin;
    local_time_p.seconds = result.nSec;

    return local_time_p;
}


/*****************************************************************************
 * FUNCTION
 *  mmi_brw_create_push_display_format
 * DESCRIPTION
 *  This function is responsible for creating the formatted Push message string.
 *  Push message should display in the following format.
 *  SI message should be display in the following format(example)
 *  
 *  10 jan 2006 12:00 (If created date is not present then received date should be here)
 *  Expires:
 *  20 Jun 2006 12:00
 *  URL:
 *  http://www.exampleSISL.com
 *  Message:
 *  SISL message Body
 *  
 *  for SL messages only URL should display.
 * PARAMETERS
 *  push_message_struct     [IN]        Structure pointer which contatins all the information
 *  about push messages.(?)
 * RETURNS
 *  returns buffer, which contains the formatted string of push messages.
 *****************************************************************************/
PS8 mmi_brw_create_push_display_format(SERVICE_VALUE *push_message_struct)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S16 message_length = 0;
    S16 message_href_length = 0;
    S16 meassage_body_length = 0;

    PS8 ucs2_message_buffer = NULL;
    S8 ucs2_time_string[MMI_BRW_SI_DATE_N_TIME_STRING_LENGTH] = {0};

    SI_TIME sisl_local_time = {0};

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (push_message_struct->service_flag == SERVICE_INDICATION)
    {
        meassage_body_length = pfnUnicodeStrlen((const S8*)push_message_struct->pmMessage);
        message_href_length = pfnUnicodeStrlen((const S8*)push_message_struct->pmHref);

        /* Calculate the length of the message */
        message_length = message_href_length + meassage_body_length +
            MMI_BRW_SI_DATE_N_TIME_STRING_LENGTH +
            pfnUnicodeStrlen((const S8*)GetString(STR_ID_BRW_PUSH_MESSAGE)) +
            pfnUnicodeStrlen((const S8*)GetString(STR_ID_BRW_PUSH_URL));

        if (NULL != push_message_struct->pSIExpires)
        {
            message_length += (MMI_BRW_SI_DATE_N_TIME_STRING_LENGTH +
                               pfnUnicodeStrlen((const S8*)GetString(STR_ID_BRW_PUSH_EXPIRES)));
        }

        /* adding 1 for '\0' */
        ucs2_message_buffer = (PS8) jdd_MemAlloc((message_length + 1), ENCODING_LENGTH);
        /* todo : check null value */

        if (NULL != push_message_struct->pSICreated)
        {
            sisl_local_time = convert_gmt_in_to_local_time(push_message_struct->pSICreated);
        }
        else    /* If date Created is not present, use date received. */
        {
            sisl_local_time = convert_gmt_in_to_local_time(push_message_struct->pSIRcvd);
        }
        mmi_brw_create_ucs2_push_time_format_string(&sisl_local_time, ucs2_time_string);

        pfnUnicodeStrcpy(ucs2_message_buffer, ucs2_time_string);
        pfnUnicodeStrcat(ucs2_message_buffer, "\n");

        if (NULL != push_message_struct->pSIExpires)
        {
            pfnUnicodeStrcat(ucs2_message_buffer, GetString(STR_ID_BRW_PUSH_EXPIRES));
            pfnUnicodeStrcat(ucs2_message_buffer, "\n");

            sisl_local_time = convert_gmt_in_to_local_time(push_message_struct->pSIExpires);
            mmi_brw_create_ucs2_push_time_format_string(&sisl_local_time, ucs2_time_string);

            pfnUnicodeStrcat(ucs2_message_buffer, ucs2_time_string);
            pfnUnicodeStrcat(ucs2_message_buffer, "\n");
        }

        pfnUnicodeStrcat((S8*) ucs2_message_buffer, GetString(STR_ID_BRW_PUSH_URL));
        pfnUnicodeStrcat(ucs2_message_buffer, "\n");

        pfnUnicodeStrcat((S8*) ucs2_message_buffer, (const S8*)push_message_struct->pmHref);
        pfnUnicodeStrcat((S8*) ucs2_message_buffer, "\n");

        if (0 != meassage_body_length)
        {
            pfnUnicodeStrcat((S8*) ucs2_message_buffer, GetString(STR_ID_BRW_PUSH_MESSAGE));
            pfnUnicodeStrcat(ucs2_message_buffer, "\n");

            pfnUnicodeStrcat((S8*) ucs2_message_buffer, (const S8*)push_message_struct->pmMessage);
        }
    }

    else if (push_message_struct->service_flag == SERVICE_LOADING)
    {
        message_href_length = pfnUnicodeStrlen((const S8*)push_message_struct->pmHref);
        message_length = message_href_length + pfnUnicodeStrlen((const S8*)GetString(STR_ID_BRW_PUSH_URL));

        ucs2_message_buffer = (PS8) jdd_MemAlloc((message_length + 2), ENCODING_LENGTH);

        pfnUnicodeStrcpy(ucs2_message_buffer, GetString(STR_ID_BRW_PUSH_URL));

        pfnUnicodeStrcat(ucs2_message_buffer, "\n");
        pfnUnicodeStrcat((S8*) ucs2_message_buffer, (const S8*)push_message_struct->pmHref);
    }

    else
    {
        /* error */
    }

    return ucs2_message_buffer;
}


/*****************************************************************************
 * FUNCTION
 *  mmi_brw_create_ucs2_push_time_format_string
 * DESCRIPTION
 *  This function is responsible for generating time string (As given in the following  example),
 *  which will be displayed with push messages.
 *  Ex. : 20 Jun 2006 12:00
 * PARAMETERS
 *  sisl_time               [?]         
 *  ucs2_time_string        [IN]        
 *  time(?)                 [IN]        Time structure.
 * RETURNS
 *  returns buffer, which contains the formatted string of time for push messages.(?)
 *****************************************************************************/
void mmi_brw_create_ucs2_push_time_format_string(SI_TIME *sisl_time, PS8 ucs2_time_string)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    MYTIME time = {0};
    UI_character_type temp_time_buffer[20] = {0};

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    time.nYear = sisl_time->year;
    time.nMonth = sisl_time->month;
    time.nDay = sisl_time->day;
    time.nHour = sisl_time->hour;
    time.nMin = sisl_time->minute;
    time.nSec = sisl_time->seconds;

    date_string(&time, temp_time_buffer, DT_IDLE_SCREEN);

    pfnUnicodeStrncpy((S8*) ucs2_time_string, (S8*) temp_time_buffer, pfnUnicodeStrlen((const S8*)temp_time_buffer));

    pfnUnicodeStrncat((S8*) ucs2_time_string, (S8*) " ", 1);

    time_string(&time, temp_time_buffer, DT_IDLE_SCREEN);

    pfnUnicodeStrncat((S8*) ucs2_time_string, (S8*) temp_time_buffer, pfnUnicodeStrlen((const S8*)temp_time_buffer));

    pfnUnicodeStrncat((S8*) ucs2_time_string, (S8*) "\0", 1);
}


/*****************************************************************************
 * FUNCTION
 *  mmi_brw_entry_read_push_message_exit
 * DESCRIPTION
 *  Exit Function to read arrived push message form idle screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_brw_entry_read_push_message_exit(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (NULL != g_message_buffer)
    {
        jdd_MemFree(g_message_buffer);
        g_message_buffer = NULL;
    }

#ifdef __MMI_UNIFIED_MESSAGE__
    if (!IsScreenPresent(SCR_ID_BRW_READ_SERVICE_MESSAGE))
    {
        mmi_brw_push_free_service_value_struct(&g_current_service_message);
    }
#endif /* __MMI_UNIFIED_MESSAGE__ */ 
}


#ifndef __MMI_UNIFIED_MESSAGE__

/*****************************************************************************
 * FUNCTION
 *  mmi_brw_idle_screen_read_message_back_option
 * DESCRIPTION
 *  This function will be called when RSK
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_brw_idle_screen_read_message_back_option(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_brw_entry_service_inbox();

    DeleteScreenIfPresent(SCR_ID_BRW_NEW_PUSH_MESSAGE_IND);
    DeleteScreenIfPresent(SCR_ID_BRW_READ_SERVICE_MESSAGE);

    /* DeleteUptoScrID(IDLE_SCREEN_ID); */
}

#endif /* __MMI_UNIFIED_MESSAGE__ */


/*****************************************************************************
 * FUNCTION
 *  mmi_brw_entry_read_push_message
 * DESCRIPTION
 *  Deletes the entire recent page list
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_brw_entry_read_push_message(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 *gui_buffer;
    S32 buffer_size;
    SERVICE_VALUE *selected_push_message_p = NULL;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    g_mmi_brw_delete_push_notification = MMI_FALSE;

    if (NULL == g_current_service_message)
    {
        selected_push_message_p = g_brw_service_msg_list_p[g_brw_index_current_highlighted_item];

        /* Set the read status */
        mmi_brw_set_read_status(1, g_brw_service_msg_list_p[g_brw_index_current_highlighted_item]);

        /* Save to persistant storage */
        mmi_brw_save_current_push_info();

        mmi_brw_unread_push_message_indication();
        UpdateStatusIcons();    /* Added By Vivek 24072006 */

        g_message_buffer = (U8*) mmi_brw_create_push_display_format(selected_push_message_p);

        g_current_service_message = mmi_brw_push_service_value_struct_dup(selected_push_message_p);
        if(NULL == g_current_service_message)
        {
            DisplayPopup((PU8) GetString(STR_ID_BRW_PUSH_MEMORY_NOT_ENOUGH), IMG_GLOBAL_ERROR, 1, UI_POPUP_NOTIFYDURATION_TIME, ERROR_TONE);
            return;
        }
    }
    else
    {
        g_message_buffer = (U8*) mmi_brw_create_push_display_format(g_current_service_message);
        selected_push_message_p = g_current_service_message;
    }

    EntryNewScreen(
        SCR_ID_BRW_READ_SERVICE_MESSAGE,
        mmi_brw_entry_read_push_message_exit,
        mmi_brw_entry_read_push_message,
        NULL);

    gui_buffer = GetCurrGuiBuffer(SCR_ID_BRW_READ_SERVICE_MESSAGE);

    buffer_size = pfnUnicodeStrlen((PS8) g_message_buffer);

    if (selected_push_message_p->service_flag == SERVICE_LOADING)
    {
        ShowCategory74Screen(
            STR_ID_BRW_MESSAGE,
            GetRootTitleIcon(SERVICES_WAP_MENU_ID),
            STR_GLOBAL_OPTIONS,
            IMG_GLOBAL_OPTIONS,
            STR_GLOBAL_BACK,
            IMG_GLOBAL_BACK,
            g_message_buffer,
            buffer_size,
            gui_buffer);
    }
    else if (selected_push_message_p->service_flag == SERVICE_INDICATION)
    {
        ShowCategory74Screen(
            STR_ID_BRW_MESSAGE,
            GetRootTitleIcon(SERVICES_WAP_MENU_ID),
            STR_GLOBAL_OPTIONS,
            IMG_GLOBAL_OPTIONS,
            STR_GLOBAL_BACK,
            IMG_GLOBAL_BACK,
            g_message_buffer,
            buffer_size,
            gui_buffer);
    }
    else
    {
        /* Assert */
    }

    SetLeftSoftkeyFunction(mmi_brw_entry_service_inbox_read_options, KEY_EVENT_UP);

#ifndef __MMI_UNIFIED_MESSAGE__
    
    if (TRUE == IsScreenPresent(SCR_ID_BRW_NEW_PUSH_MESSAGE_IND))
    {
        SetRightSoftkeyFunction(mmi_brw_idle_screen_read_message_back_option, KEY_EVENT_UP);
        SetKeyHandler(mmi_brw_idle_screen_read_message_back_option, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
    }
    else
    {
        SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
        SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
    }

#else 
        SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
        SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

#endif /* __MMI_UNIFIED_MESSAGE__ */

}


/*****************************************************************************
 * FUNCTION
 *  mmi_brw_unread_push_message_indication
 * DESCRIPTION
 *  Function to show unread push message icon on idle screen.
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_brw_unread_push_message_indication(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    JC_UINT32 brw_total_msg_count;
    JC_UINT32 brw_unread_msg_count;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* If browser is not ready then return */
    if (!jbrowser_is_ready())

⌨️ 快捷键说明

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