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

📄 jmmsinboxui.c

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

#ifdef __MMI_UNIFIED_MESSAGE__
    SetHiliteHandler(MENU_ID_JMMS_INBOX_OPTIONS_EDIT_MESSAGE, mmi_jmms_highlight_inbox_options_edit_message);
    SetHiliteHandler(MENU_ID_JMMS_INBOX_OPTIONS_USE_DETAILS_NUMBER, mmi_jmms_highlight_inbox_options_use_number);
#else /* __MMI_UNIFIED_MESSAGE__ */ 
    SetHiliteHandler(MENU_ID_JMMS_INBOX_OPTIONS_USE_DETAILS, mmi_jmms_highlight_inbox_options_use_details);
    SetHiliteHandler(MENU_ID_JMMS_INBOX_OPTIONS_USE_DETAILS_EMAIL, mmi_jmms_highlight_options_use_details_email);
    SetHiliteHandler(MENU_ID_JMMS_INBOX_OPTIONS_USE_DETAILS_NUMBER, mmi_jmms_highlight_options_use_details_number);
#endif /* __MMI_UNIFIED_MESSAGE__ */ 

    g_jmms_context->store_context->inbox_msgs_read_status =
        (U8*) jdd_MemAlloc(sizeof(U8), MAX_READ_UNREAD_STATUS_BYTES);
    if (g_jmms_context->store_context->inbox_msgs_read_status == NULL)
    {
        return;
    }

    ReadRecord(
        NVRAM_EF_JMMS_INBOX_READ_UNREAD_LID,
        1,
        (g_jmms_context->store_context->inbox_msgs_read_status),
        (U16) MAX_READ_UNREAD_STATUS_BYTES,
        &error);

    /*
     * if (g_jmms_context->store_context->inbox_msgs_read_status[0] == 0xFF)
     * {
     * for (i = 0; i < MAX_READ_UNREAD_STATUS_BYTES; i++)
     * {
     * g_jmms_context->store_context->inbox_msgs_read_status[i] = 0x00;
     * }
     * 
     * WriteRecord(
     * NVRAM_EF_JMMS_INBOX_READ_UNREAD_LID,
     * 1,
     * (g_jmms_context->store_context->inbox_msgs_read_status),
     * (U16) MAX_READ_UNREAD_STATUS_BYTES,
     * &error);
     * ReadRecord(
     * NVRAM_EF_JMMS_INBOX_READ_UNREAD_LID,
     * 1,
     * (g_jmms_context->store_context->inbox_msgs_read_status),
     * (U16) MAX_READ_UNREAD_STATUS_BYTES,
     * &error);
     * }
     */
}


/*****************************************************************************
 * FUNCTION
 *  mmi_jmms_free_read_unread_status_bytes
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_jmms_free_read_unread_status_bytes(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (g_jmms_context->store_context->inbox_msgs_read_status != NULL)
    {
        jdd_MemFree(g_jmms_context->store_context->inbox_msgs_read_status);
    }

}

#ifndef __MMI_UNIFIED_MESSAGE__


/*****************************************************************************
 * FUNCTION
 *  mmi_jmms_entry_inbox
 * DESCRIPTION
 *  This is pre entry fn for Inbox screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_jmms_entry_inbox(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U8 total_num_msgs = 0;
    JC_RETCODE eRet = JC_OK;
    U16 currScrenID = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    eRet = mmi_mms_get_number_of_messages(MMI_JMMS_INBOX, &total_num_msgs);
    if (eRet != JC_OK)
    {
        ASSERT(0);
    }
    /* set the open msg status- for At delete */
    g_jmms_context->msg_open_status[0] = E_JMMS_INBOX;
    g_jmms_context->msg_open_status[1] = 0;

    if (total_num_msgs == 0)
    {
        DisplayPopup((U8*) GetString(STR_GLOBAL_EMPTY), IMG_GLOBAL_EMPTY, 1, JMMS_POPUP_TIME, EMPTY_LIST_TONE);
        return;
    }

    g_jmms_context->store_context->nMsgs_in_Current_folder = total_num_msgs;
	g_jmms_context->store_context->update_nmsgs_in_current_folder = 0;
    g_jmms_context->store_context->current_folder_name = E_JMMS_INBOX;

    mmi_jmms_free_msgs_list(&(g_jmms_context->store_context->messages_list));

    g_jmms_context->store_context->jmms_start_index = 1;

    mmi_jmms_entry_get_msgs_progress_screen();

    eRet = mmi_jmms_get_folder_msg_list(&(g_jmms_context->store_context->messages_list), MMI_JMMS_INBOX, total_num_msgs);

    if (eRet != JC_OK || g_jmms_context->store_context->messages_list == NULL)
    {
        currScrenID = GetActiveScreenId();

        mmi_jmms_free_msgs_list(&(g_jmms_context->store_context->messages_list));

        if (currScrenID == SCR_ID_JMMS_GET_MSGS_PROGRESS_SCREEN)
        {
            DisplayPopup(
                (U8*) GetString(STR_ID_JMMS_ERROR_GET_MSG_LIST),
                IMG_GLOBAL_ERROR,
                1,
                JMMS_POPUP_TIME,
                (U8) ERROR_TONE);
            DeleteUptoScrID(SCR_ID_JMMS_MAIN_MENU);
        }
        else
        {
            /* to avoid the show of pop up over Phone call or some other screen */
            HistoryReplace(
                SCR_ID_JMMS_GET_MSGS_PROGRESS_SCREEN,
                SCR_ID_JMMS_GET_MSGS_ERROR_SCREEN,
                mmi_jmms_entry_msgs_get_error_screen);
        }

    }

    return;

}


/*****************************************************************************
 * FUNCTION
 *  mmi_jmms_entry_inbox_screen
 * DESCRIPTION
 *  Entry fn for inbox screen
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_jmms_entry_inbox_screen(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    PU8 gui_buffer; /* Buffer holding history data */
    U8 num_item = 0;
    JC_RETCODE eRet = JC_OK;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_mms_get_number_of_messages(MMI_JMMS_INBOX, &num_item);
    if (eRet != JC_OK)
    {
        ASSERT(0);
    }
    //if number of msga in fodelr is not same to as in global var then
    //it means some has been recieved as user was in inbox so need to update
    ///the msgs list
    if (g_jmms_context->store_context->update_nmsgs_in_current_folder)
    {
        mmi_jmms_entry_inbox();
        return;
    }

    ///Free any pending node to show on ideal screen
    //because after entering into inbox we can't show these nodes on ideal screen
    ///because user may can change the mms e.g. may downlaod a mms notificaction
    //so that notification will not be notification. 
    mmi_jmms_delete_mms_pop_ups_list_on_inbox_entry();

    EntryNewScreen(SCR_ID_JMMS_INBOX, NULL, mmi_jmms_entry_inbox_screen, NULL);

    gui_buffer = GetCurrGuiBuffer(SCR_ID_JMMS_INBOX);

    SetParentHandler(MENU_ID_JMMS_INBOX);
    RegisterHighlightHandler(mmi_jmms_folder_list_highlight_hdlr);

    /* reset the open msg status- for At delete */
    g_jmms_context->msg_open_status[0] = 0;
    g_jmms_context->msg_open_status[1] = 0;

    ShowCategory184Screen(
        STR_ID_JMMS_INBOX,
        GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
        STR_GLOBAL_OPTIONS,
        IMG_GLOBAL_OPTIONS,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        g_jmms_context->store_context->nMsgs_in_Current_folder,
        mmi_jmms_get_item_data_inbox,
        mmi_jmms_get_item_hint_inbox,
        g_jmms_context->nCurr_scr_hilited_index,	
        gui_buffer);

    SetLeftSoftkeyFunction(mmi_jmms_pre_entry_inbox_options_scren, KEY_EVENT_UP);
    SetKeyHandler(mmi_jmms_pre_entry_inbox_options_scren, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
    SetKeyHandler(mmi_jmms_pre_entry_inbox_options_scren, KEY_WAP, KEY_EVENT_DOWN);

    SetRightSoftkeyFunction(mmi_jmms_back_from_msgs_list_screen, KEY_EVENT_UP);
    SetKeyHandler(mmi_jmms_back_from_msgs_list_screen, KEY_LEFT_ARROW, KEY_EVENT_DOWN);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_jmms_get_item_data_inbox
 * DESCRIPTION
 *  fn retrun the item data
 * PARAMETERS
 *  item_index          [IN]        (index of item to be drawn)
 *  str_buff            [IN]        (string of item)
 *  img_buff_p          [?]         [?]         (image corrsponding to item
 *  str_img_mask        [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
pBOOL mmi_jmms_get_item_data_inbox(S32 item_index, UI_string_type str_buff, PU8 *img_buff_p, U8 str_img_mask)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    S32 count = 0;
    jmms_folder_msgs_list *msgs_list_node = NULL;
    U8 msg_index = 0;
    MMI_BOOL is_msg_read = MMI_TRUE;

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

    msgs_list_node = g_jmms_context->store_context->messages_list;

    while (count != item_index && msgs_list_node != NULL)
    {
        msgs_list_node = msgs_list_node->next;
        count++;
    }

    if (msgs_list_node == NULL)
    {
        return FALSE;
    }

    pfnUnicodeStrcpy((S8*) str_buff, msgs_list_node->subject_as_caption);

    msg_index = g_jmms_context->store_context->nMsgs_in_Current_folder - item_index;
    msg_index = msg_index - 1;

    switch (msgs_list_node->msg_type)
    {

        case E_MSG_NOTIFICATION:
            *img_buff_p = (PU8) GetImage((U16) (IMG_ID_JMMS_MMS_NOTIFICATION));
            break;

        case E_MSG_RECEIVE:
            is_msg_read = mmi_jmms_is_msg_read(msg_index);
            if (is_msg_read == MMI_TRUE)
            {
                *img_buff_p = (PU8) GetImage((U16) (IMG_ID_JMMS_NEW_MMS_READ));
            }
            else
            {
                *img_buff_p = (PU8) GetImage((U16) (IMG_ID_JMMS_NEW_MMS_UNREAD));
            }
            break;

        case E_MSG_DELIVERY_REPORT:

            is_msg_read = mmi_jmms_is_msg_read(msg_index);
            if (is_msg_read == MMI_TRUE)
            {
                *img_buff_p = (PU8) GetImage((U16) (IMG_ID_JMMS_DELIVERY_READ));
            }
            else
            {
                *img_buff_p = (PU8) GetImage((U16) (IMG_ID_JMMS_DELIVERY_UNREAD));
            }

            break;

        case E_MSG_JAVA_MESSAGE:
            *img_buff_p = (PU8) GetImage((U16) (IMG_ID_JMMS_JAVA_MMS));
            break;

        case E_MSG_READ_REPORT:

            is_msg_read = mmi_jmms_is_msg_read(msg_index);
            if (is_msg_read == MMI_TRUE)
            {
                *img_buff_p = (PU8) GetImage((U16) (IMG_ID_JMMS_READ_REPORT_READ));
            }
            else
            {
                *img_buff_p = (PU8) GetImage((U16) (IMG_ID_JMMS_READ_REPORT_UNREAD));
            }

            break;

    }

    return TRUE;
}


/*****************************************************************************
 * FUNCTION
 *  mmi_jmms_get_item_hint_inbox
 * DESCRIPTION
 *  Retrun the hint fot the item to be drawn
 * PARAMETERS
 *  item_index      [IN]        (index of item to be drawn)
 *  hint_array      [?]         [?]         (hint buufer for the item_index)
 * RETURNS
 *  void
 *****************************************************************************/
S32 mmi_jmms_get_item_hint_inbox(S32 item_index, UI_string_type *hint_array)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 count = 0;
    jmms_folder_msgs_list *msgs_list_node = NULL;

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

    msgs_list_node = g_jmms_context->store_context->messages_list;
    while (count != item_index && msgs_list_node != NULL)
    {
        msgs_list_node = msgs_list_node->next;
        count++;
    }

    if (msgs_list_node == NULL || msgs_list_node->address_as_hint == NULL)
    {
        return 0;
    }

    if (pfnUnicodeStrlen((S8*) (msgs_list_node->address_as_hint)))
    {
        pfnUnicodeStrcpy((S8*) hint_array[0], (S8*) (msgs_list_node->address_as_hint));
    }
    else
    {
        return 0;   /* No Hint Data */
    }

⌨️ 快捷键说明

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