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

📄 jmmsdraftsui.c

📁 MTK手机平台的MMI部分的源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
    if (g_jmms_context->pParseContent == NULL)
    {
        g_jmms_context->pParseContent = (CONTENT_DATA*) jdd_MemAlloc(sizeof(CONTENT_DATA), 1);
    }

    g_jmms_context->pParseContent->bIsStream = E_TRUE;
    index =
        (JC_INT32) (g_jmms_context->store_context->nMsgs_in_Current_folder - g_jmms_context->nCurr_scr_hilited_index);

	eRet = mmi_jmms_get_message("Drafts", g_jmms_context->pParseContent, index);
	if (eRet != JC_OK)
    {
        mmi_jmms_error_handler(eRet);
        goto END;
    }

    mmi_jmms_parsing_progressing_screen();
    eRet =
        mmi_jmms_jdi_parse_msg_buffer(&(g_jmms_context->msg_handle), g_jmms_context->pParseContent, E_TYPE_MMS, E_TRUE);

    if (eRet == JC_ERR_MMS_PARSE_PENDING)
    {
        mmi_jmms_parse_continue_start_timer(g_jmms_context->msg_handle, mmi_jmms_drafts_edit_message_async_callback,mmi_jmms_only_abort_parsing_progress);
        return;
    }
#endif 

#ifdef __MMI_UNIFIED_MESSAGE__					
	mmi_jmms_jdi_preedit(&g_jmms_context->msg_handle);	// Edit
#endif
	mmi_jmms_drafts_edit_message_async_callback(eRet);
    return;

#ifndef __MMI_UNIFIED_MESSAGE__
END:
    if (g_jmms_context->pParseContent != NULL)
    {
        if (g_jmms_context->pParseContent->pFileName != NULL)
        {
            jdd_MemFree(g_jmms_context->pParseContent->pFileName);
        }
        jdd_MemFree(g_jmms_context->pParseContent);
        g_jmms_context->pParseContent = NULL;
    }
    if (eRet != JC_OK)
    {
        if (g_jmms_context->msg_handle != NULL)
        {
            mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
            g_jmms_context->msg_handle = NULL;
        }

    }
#endif 
    g_jmms_context->is_add_media_warning = 0;

}

/*****************************************************************************
 * FUNCTION
 *  mmi_jmms_drafts_edit_message_async_callback
 * DESCRIPTION
 *  
 * PARAMETERS
 *  eRet        [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_jmms_drafts_edit_message_async_callback(JC_RETCODE eRet)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    MESSAGE_HEADERS *pMsgHeaders = NULL;
    MESSAGE_SEND *send_p = NULL;
#ifdef __MMI_UNIFIED_MESSAGE__ 
    ECreationMode create_mode;
    MESSAGE_RETRIEVAL *reterive_p = NULL;
#endif
    S32 len = 0;
    S8 *temp_str = NULL;
    S8 *str = NULL;
    S32 start_index = 0;
    MMI_BOOL is_email = MMI_FALSE;
    S32 len_to_copy = 0;
    U8 ret = 0;
    JC_RETCODE eRet_restricted = JC_OK;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (JC_OK != eRet)
    {
        if (GetActiveScreenId() == SCR_ID_JMMS_PARSING_PROGRESS)
        {
            mmi_jmms_error_handler(eRet);
        }
        goto END;
    }
#if !defined(__MMI_UNIFIED_MESSAGE__) && defined(__DRM_SUPPORT__) 

    if (mmi_jmms_is_drm_fwd_lock_media_in_mms(g_jmms_context->msg_handle, E_TRUE) == E_TRUE)
    {
       goto END;
    }
#endif	


    eRet =
        mmi_jmms_jdi_msg_register_callback(g_jmms_context->msg_handle, E_CB_ERROR_IND, (void *)mmi_jmms_error_ind_cb);



    if (eRet != JC_OK)
    {
        mmi_jmms_error_handler(eRet);
        goto END;
    }

    eRet = mmi_jmms_jdi_set_content_class(g_jmms_context->msg_handle, MMS_SUPPORTED_CONTENT_CLASS);



    if (eRet != JC_OK)
    {
        mmi_jmms_error_handler(eRet);
        goto END;
    }

    eRet = mmi_jmms_jdi_set_creation_mode(g_jmms_context->msg_handle, mmi_jmms_compose_settings_creation_mode());
    if (mmi_jmms_is_corrupted_video_media_in_mms(g_jmms_context->msg_handle) == E_TRUE)
    {
        eRet =-1;
        goto END;
    }
#ifdef __MMI_UNIFIED_MESSAGE__
    create_mode = mmi_jmms_compose_settings_creation_mode();
    if(IsMMSRestrictedMode(g_jmms_context->msg_handle, MMS_SUPPORTED_CONTENT_CLASS) != JC_OK)
    {
        if(create_mode == E_CREATION_MODE_RESTRICTED)
        {
            eRet_restricted = JC_ERR_MSG_MMS_CONTENT_RESTRICTED;
        }
        else if(create_mode == E_CREATION_MODE_WARNING)
        {
            g_jmms_context->is_add_media_warning = 1;
        }
    }
#endif

    if (eRet != JC_OK)
    {
        /********************************************************************
           These lines are added to ask a query if the message contains the 
           invalid media in restricted mode.

            Written By  : RAJ KUMAR GUPTA
            Date        : Augest 08, 2006
         *******************************************************************/
        if (JC_ERR_MSG_MMS_CONTENT_RESTRICTED == eRet)
        {
            eRet_restricted = JC_ERR_MSG_MMS_CONTENT_RESTRICTED;
        }
        else
        {
            mmi_jmms_error_handler(eRet);
            goto END;
        }
        /*******************************************************************/
    }

    eRet = mmi_jmms_jdi_set_msg_type(g_jmms_context->msg_handle, E_TYPE_MMS);



    if (eRet != JC_OK)
    {
        mmi_jmms_error_handler(eRet);
        goto END;
    }
    eRet = mmi_jmms_jdi_set_presentation_type(g_jmms_context->msg_handle, E_PRESENTATION_SMIL);
    if (eRet != JC_OK)
    {
        mmi_jmms_error_handler(eRet);
        goto END;
    }
    eRet = mmi_jmms_jdi_set_max_pages(g_jmms_context->msg_handle, (U8) mmi_jmms_compose_settings_max_no_pages());
    if (eRet != JC_OK)
    {
        mmi_jmms_error_handler(eRet);
        goto END;
    }

    eRet = mmi_jmms_jdi_get_msg_headers(g_jmms_context->msg_handle, &pMsgHeaders);
    if (eRet != JC_OK || pMsgHeaders == NULL)
    {
        eRet = JC_ERR_STORE_FILE_CORRUPTED;
        mmi_jmms_error_handler(eRet);
        goto END;
    }

#ifdef __MMI_UNIFIED_MESSAGE__

    if (pMsgHeaders->eMsgType == E_MSG_TYPE_SEND)
    {
        send_p = (MESSAGE_SEND*) (pMsgHeaders->pHeaders);
    }

    else if (pMsgHeaders->eMsgType == E_MSG_TYPE_RECEIVE)
    {
        reterive_p = (MESSAGE_RETRIEVAL*) (pMsgHeaders->pHeaders);
    }
#else /* __MMI_UNIFIED_MESSAGE__ */ 

    if (pMsgHeaders->eMsgType != E_MSG_TYPE_SEND)
    {
        DisplayPopup((U8*) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
        goto END;
    }
    send_p = (MESSAGE_SEND *) (pMsgHeaders->pHeaders);
#endif /* __MMI_UNIFIED_MESSAGE__ */ 

    mmi_jmms_free_addresses_list();

    /* /Make the To Addresses list */
    if(send_p != NULL)
    {
        if (send_p->pTo != NULL)
        {
            str = (S8*) (send_p->pTo);
            len = 0;
            start_index = 0;
            g_jmms_context->address_list_flag = E_TO_ADDRESSES;

            while (pfnUnicodeStrcmp(str, "\0") != 0)
            {
                while (((*str) != ';') && ((*str) != '\0'))
                {
                    if ((*str) == '@')
                    {
                        is_email = MMI_TRUE;
                    }

                    len++;
                    str = str + ENCODING_LENGTH;
                }

                if (is_email == MMI_FALSE && len > (MAX_POSSIBLE_NUMBER_LENGHT_SENT))
                {
                    len_to_copy = MAX_POSSIBLE_NUMBER_LENGHT_SENT;
                }
                else if (is_email == MMI_TRUE && len > (MAX_POSSIBLE_EMAIL_LENGHT_SENT))
                {
                    len_to_copy = MAX_POSSIBLE_EMAIL_LENGHT_SENT;
                }
                else
                {
                    len_to_copy = len;
                }

                temp_str = (S8*) jdd_MemAlloc(sizeof(S8), (len_to_copy + 1) * ENCODING_LENGTH);
                if (temp_str == NULL)
                {
                    DisplayPopup(
                        (U8*) GetString(STR_ID_JMMS_OUT_OF_MEMORY),
                        IMG_GLOBAL_ERROR,
                        1,
                        JMMS_POPUP_TIME,
                        (U8) ERROR_TONE);
                    goto END;
                }
                pfnUnicodeStrncpy((S8*) temp_str, (S8*) (send_p->pTo + start_index), len_to_copy);

                ret = mmi_jmms_add_address_in_addresse_list((S8*) temp_str);
                if (ret != 0)
                {
                    DisplayPopup((U8*) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
                    goto END;
                }
    
                if (temp_str != NULL)
                {
                    jdd_MemFree(temp_str);
                    temp_str = NULL;
                }
    
                start_index = start_index + len + 1;
                len = 0;
                if ((*str) != '\0')
                {
                    str = str + ENCODING_LENGTH;
                }
            }
    
            if (temp_str != NULL)
            {
                jdd_MemFree(temp_str);
                temp_str = NULL;
            }
        }

        /* /Make the Cc Addresses list */
        if (send_p->pCc != NULL)
        {
            str = (S8*) (send_p->pCc);
            len = 0;
            start_index = 0;
            g_jmms_context->address_list_flag = E_CC_ADDRESSES;
            is_email = MMI_FALSE;
    
            while (pfnUnicodeStrcmp(str, "\0") != 0)
            {
    
                while (((*str) != ';') && ((*str) != '\0'))
                {
                    len++;
                    if ((*str) == '@')
                    {
                        is_email = MMI_TRUE;
                    }
    
                    str = str + ENCODING_LENGTH;
                }

                if (is_email == MMI_FALSE && len > (MAX_POSSIBLE_NUMBER_LENGHT_SENT))
                {
                    len_to_copy = MAX_POSSIBLE_NUMBER_LENGHT_SENT;
                }
                else if (is_email == MMI_TRUE && len > (MAX_POSSIBLE_EMAIL_LENGHT_SENT))
                {
                    len_to_copy = MAX_POSSIBLE_EMAIL_LENGHT_SENT;
                }
                else
                {
                    len_to_copy = len;
                }

                temp_str = (S8*) jdd_MemAlloc(sizeof(S8), (len_to_copy + 1) * ENCODING_LENGTH);
                if (temp_str == NULL)
                {
                    DisplayPopup(
                        (U8*) GetString(STR_ID_JMMS_OUT_OF_MEMORY),
                        IMG_GLOBAL_ERROR,
                        1,
                        JMMS_POPUP_TIME,
                        (U8) ERROR_TONE);
                    goto END;
                }
                pfnUnicodeStrncpy((S8*) temp_str, (S8*) (send_p->pCc + start_index), len_to_copy);

                ret = mmi_jmms_add_address_in_addresse_list((S8*) temp_str);
                if (ret != 0)
                {
                    DisplayPopup((U8*) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
                    goto END;
                }

                if (temp_str != NULL)
                {
                    jdd_MemFree(temp_str);
                    temp_str = NULL;
                }

                start_index = start_index + len + 1;
                len = 0;
                if ((*str) != '\0')
                {
                    str = str + ENCODING_LENGTH;
                }
            }

            if (temp_str != NULL)
            {
                jdd_MemFree(temp_str);
                temp_str = NULL;
            }
        }

        /* /Make the BCc Addres

⌨️ 快捷键说明

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