JMMSComposeUtils.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:174k
源码类别:
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) 2002
- *
- *****************************************************************************/
- /*****************************************************************************
- *
- * Filename:
- * ---------
- * mms_compose.C
- *
- * Project:
- * --------
- * MAUI
- *
- * Description:
- * ------------
- *
- *
- * 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!
- * 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!
- *
- * 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!
- * 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!!
- *============================================================================
- ****************************************************************************/
- #include "MMI_features.h"
- #if (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT))
- /* Include: MMI header file */
- #include "stdC.h"
- #include "L4Dr1.h"
- #include "PixtelDataTypes.h"
- #include "JMMSConfig.h"
- #include "JMMSCompose.h"
- #include "JMMSResEnum.h"
- #include "JMMSWriteMMS.h"
- #include "JMMSExdcl.h"
- #include "Globaldefs.h"
- #include "GlobalMenuItems.h"
- #include "GlobalConstants.h"
- #include "EventsGprot.h"
- #include "HistoryGprot.h"
- #include "CommonScreens.h"
- #include "wgui_categories.h"
- #include "SettingProfile.h"
- // #include "Wap.h"
- #include "MessagesResourceData.h"
- #include "FileSystemDef.h"
- #include "FileManagerDef.h"
- #include "FileSystemGProt.h"
- #include "fs_type.h"
- #include "fs_func.h"
- #include "fs_errcode.h"
- #include "FileMgr.h"
- #include "jdd_memapi.h"
- /* jataayu files */
- #include "ddl.h"
- #include "jcal.h"
- #include "JMMSCoreAPI.h"
- #include "ddlbase.h"
- #include "JMMSExdcl.h"
- #include "jcutils.h"
- #include "ddlutils.h"
- #include "jdi_MMSErr.h"
- #include "jcerror.h"
- #include "miscutils.h"
- #include "JMMSMessageSettingsUtils.h"
- // #include "jdi_miscutils.h"
- #include "JMMSGprot.h"
- #include "jdd_MessagingConfig.h"
- #include "JMMSView.h"
- #include "NVRAMType.h"
- #include "NVRAMProt.h"
- #include "NVRAMEnum.h"
- #include "Fs_errcode.h"
- #include "JMMSInbox.h"
- #include "JMMSProtocols.h"
- #include "PhoneBookGprot.h"
- #include "messagingdatatypes.h"
- #include "prvmessagingdatatypes.h"
- #include "app_mine.h"
- #include "jdd_fileapi.h"
- #include "custom_wap_config.h"
- #ifdef __DRM_SUPPORT__
- #include "JMMSDRMHandler.h"
- #endif
- #include "PixtelDataTypes.h" /* dependent headers for AudioPlayerProt.h" */
- #include "mdi_datatype.h" /* dependent headers for AudioPlayerProt.h" */
- #if defined(__MMI_AUDIO_PLAYER__)
- #include "AudioPlayerProt.h"
- #endif
- #ifdef __MMI_VIDEO_PLAYER__
- #include "mdi_video.h"
- #include "jdd_videoapi.h"
- #endif /* __MMI_VIDEO_PLAYER__ */
- #include "SATDefs.h"
- #include "DebugInitDef.h"
- #ifdef __DRM_SUPPORT__
- #include "DRM_gprot.h"
- #endif
- #include "wapadp.h" // compiler warning removal
- /* Include: PS header file */
- /* ... Add More PS header */
- /*****************************************************************************
- * Define
- *****************************************************************************/
- #define STRING_TEXT "Text"
- #define STRING_IMAGE "Image"
- #define STRING_AUDIO "Audio"
- #define STRING_ATTACHMENT "Attachment"
- /*****************************************************************************
- * Typedef
- *****************************************************************************/
- /*****************************************************************************
- * Local static Variable
- *****************************************************************************/
- /*****************************************************************************
- * Local Function
- *****************************************************************************/
- /*****************************************************************************
- * Global Variable
- *****************************************************************************/
- /* HIMANSHU 05122006 START */
- #ifdef __MMI_MMS_MEGA_PIXEL_SUPPORT__
- enum
- {
- RESIZE_ANIMATION_DISABLE_OFF,
- RESIZE_ANIMATION_DISABLE_ON
- };
- U16 resize_animation_disable_status;
- #endif /* __MMI_MMS_MEGA_PIXEL_SUPPORT__ */
- /* HIMANSHU 05122006 END */
- /*****************************************************************************
- * Global Function
- *****************************************************************************/
- extern JC_INT32 GetColorValue(JC_INT8 *pColorString);
- extern MMI_BOOL is_add_media_as_drm;
- extern kal_wchar *mime_get_extension(kal_wchar *file_path); // compiler warning removal
- extern mdi_result mdi_audio_get_duration(void *file_name, U32 *time_p); // compiler warning removal
- extern void kal_get_time(kal_uint32 *ticks_ptr);
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_compose_fill_default_values_slide_settings
- * DESCRIPTION
- * Initialization function of MMS compose.
- * PARAMETERS
- * void
- * a(?) [IN/OUT] Nil(?)
- * b(?) [IN] Nil(?)
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jmms_compose_fill_default_values_slide_settings(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_jmms_context->compose_context->duration[g_jmms_context->compose_context->curr_page_index - 1].txt_dur_max_set = 1;
- g_jmms_context->compose_context->duration[g_jmms_context->compose_context->curr_page_index - 1].img_dur_max_set = 1;
- g_jmms_context->compose_context->duration[g_jmms_context->compose_context->curr_page_index - 1].audio_dur_max_set = 1;
- g_jmms_context->compose_context->duration[g_jmms_context->compose_context->curr_page_index - 1].video_dur_max_set = 1;
- g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.italic = 0;
- g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.bold = 0;
- g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.size = MEDIUM_FONT;
- g_jmms_context->compose_context->curr_slide_info.slide_prop.slide_time = 0;
- g_jmms_context->compose_context->curr_slide_info.slide_prop.text_color = g_jmms_color_RGB_list[COLOR_BLACK];
- g_jmms_context->compose_context->curr_slide_info.img_info.img_x = 0;
- g_jmms_context->compose_context->curr_slide_info.img_info.img_y = 0;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_compose_handle_error
- * DESCRIPTION
- * error handling fn.
- * PARAMETERS
- * ret_code [IN]
- * is_page [IN]
- * a(?) [IN/OUT] Nil(?)
- * b(?) [IN] Nil(?)
- * RETURNS
- * void
- *****************************************************************************/
- JMMS_COMP_ERRCODE mmi_jmms_compose_handle_error(JC_RETCODE ret_code, U8 is_page)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JMMS_COMP_ERRCODE err_code = JMMS_COMP_FAIL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_compose_handle_error"));
- if( (ret_code == JC_ERR_MSG_MMS_AUDIO_EXISTS) || (ret_code == JC_ERR_MSG_MMS_IMAGE_EXISTS ) ||
- (ret_code == JC_ERR_MSG_MMS_VIDEO_EXISTS) || (ret_code == JC_ERR_MSG_MMS_MEDIA_TYPE_EXISTS))
- {
- U8 total_pages = 0;
- mmi_jmms_jdi_get_total_pages(g_jmms_context->msg_handle, &total_pages);
- if( total_pages == mmi_jmms_compose_settings_max_no_pages())
- {
- is_page = 1;
- ret_code = JC_ERR_MSG_MAX_REACHED;
- }
- }
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "mmi_jmms_compose_handle_error = %d", ret_code));
- switch (ret_code)
- {
- case JC_OK:
- if (g_jmms_context->is_add_media_warning == 1 && !g_jmms_context->disable_warning_popup)
- {
- DisplayPopup(
- (PU8) GetString(STR_ID_JMMS_WARNING_MODE_MEDIA),
- IMG_GLOBAL_WARNING,
- 1,
- JMMS_POPUP_TIME,
- WARNING_TONE);
- err_code = JMMS_COMP_POPUP_OK;
- }
- else
- {
- err_code = JMMS_COMP_OK;
- }
- break;
- case JC_ERR_MSG_INVALID_HANDLE:
- DisplayPopup(
- (PU8) GetString(STR_ID_JMMS_INVALID_MESSAGE_HANDLE),
- IMG_GLOBAL_ERROR,
- 1,
- JMMS_POPUP_TIME,
- ERROR_TONE);
- break;
- case JC_ERR_MSG_INVALID_PAGE_INDEX:
- DisplayPopup(
- (PU8) GetString(STR_ID_JMMS_INVALID_PAGE_INDEX),
- IMG_GLOBAL_ERROR,
- 1,
- JMMS_POPUP_TIME,
- ERROR_TONE);
- break;
- case JC_ERR_MSG_INVALID_MEDIA_INDEX:
- DisplayPopup(
- (PU8) GetString(STR_ID_JMMS_INVALID_MEDIA_ID),
- IMG_GLOBAL_ERROR,
- 1,
- JMMS_POPUP_TIME,
- ERROR_TONE);
- break;
- case JC_ERR_MSG_MEDIA_RESTRICTED:
- DisplayPopup(
- (PU8) GetString(STR_ID_JMMS_RESTRICTED_MODE_MEDIA),
- IMG_GLOBAL_ERROR,
- 1,
- JMMS_POPUP_TIME,
- ERROR_TONE);
- err_code = JMMS_COMP_FAIL;
- break;
- case JC_ERR_MSG_MEDIA_WARNING:
- if (!g_jmms_context->disable_warning_popup)
- {
- DisplayPopup(
- (PU8) GetString(STR_ID_JMMS_WARNING_MODE_MEDIA),
- IMG_GLOBAL_WARNING,
- 1,
- JMMS_POPUP_TIME,
- WARNING_TONE);
- err_code = JMMS_COMP_POPUP_OK;
- }
- else
- {
- err_code = JMMS_COMP_OK;
- }
- break;
- case JC_ERR_MSG_MAX_REACHED:
- if (is_page == 1)
- {
- DisplayPopup(
- (PU8) GetString(STR_ID_JMMS_EDIT_CONTENT_MAX_SLIDE_REACHED),
- IMG_GLOBAL_WARNING,
- 1,
- JMMS_POPUP_TIME,
- WARNING_TONE);
- }
- else
- {
- DisplayPopup(
- (PU8) GetString(STR_ID_JMMS_MAX_MSG_REACHED),
- IMG_GLOBAL_WARNING,
- 1,
- JMMS_POPUP_TIME,
- WARNING_TONE);
- }
- break;
- case JC_ERR_UNSUPPORTED:
- DisplayPopup(
- (PU8) GetString(STR_GLOBAL_UNSUPPORTED_FORMAT),
- IMG_GLOBAL_ERROR,
- 1,
- JMMS_POPUP_TIME,
- ERROR_TONE);
- break;
- case JC_ERR_MSG_MMS_UNSUPPORTED_TYPE:
- DisplayPopup(
- (PU8) GetString(STR_ID_JMMS_INVALID_MEDIA_TYPE),
- IMG_GLOBAL_ERROR,
- 1,
- JMMS_POPUP_TIME,
- ERROR_TONE);
- break;
- case JC_ERR_MSG_MMS_AUDIO_EXISTS:
- if (g_jmms_context->is_add_media_warning != 1)
- {
- DisplayPopup(
- (PU8) GetString(STR_ID_JMMS_AUDIO_EXISTS_NEW_SLIDE),
- IMG_GLOBAL_WARNING,
- 1,
- JMMS_POPUP_TIME,
- WARNING_TONE);
- }
- err_code = JMMS_COMP_NEW_SLIDE;
- break;
- case JC_ERR_MSG_MMS_IMAGE_EXISTS:
- if (g_jmms_context->is_add_media_warning != 1)
- {
- DisplayPopup(
- (PU8) GetString(STR_ID_JMMS_IMAGE_EXISTS_NEW_SLIDE),
- IMG_GLOBAL_WARNING,
- 1,
- JMMS_POPUP_TIME,
- WARNING_TONE);
- }
- err_code = JMMS_COMP_NEW_SLIDE;
- break;
- case JC_ERR_MSG_MMS_VIDEO_EXISTS:
- if (g_jmms_context->is_add_media_warning != 1)
- {
- DisplayPopup(
- (PU8) GetString(STR_ID_JMMS_VIDEO_EXISTS_NEW_SLIDE),
- IMG_GLOBAL_WARNING,
- 1,
- JMMS_POPUP_TIME,
- WARNING_TONE);
- }
- err_code = JMMS_COMP_NEW_SLIDE;
- break;
- case JC_ERR_MSG_MMS_MEDIA_TYPE_EXISTS:
- if (g_jmms_context->is_add_media_warning != 1)
- {
- DisplayPopup(
- (PU8) GetString(STR_ID_JMMS_SAME_MEDIA_EXISTS_NEW_SLIDE),
- IMG_GLOBAL_WARNING,
- 1,
- JMMS_POPUP_TIME,
- WARNING_TONE);
- }
- err_code = JMMS_COMP_NEW_SLIDE;
- break;
- case JC_ERR_MSG_INVALID_MEDIA_INFO:
- DisplayPopup(
- (PU8) GetString(STR_ID_JMMS_INVALID_MEDIA_INFO),
- IMG_GLOBAL_ERROR,
- 1,
- JMMS_POPUP_TIME,
- ERROR_TONE);
- break;
- case JC_ERR_MSG_MMS_CONTENT_CLASS:
- err_code = JMMS_CONTENT_CLASS;
- break;
- /*
- * merge case JC_ERR_MSG_MULTIPLE_REFERENCE:
- * err_code=JMMS_COMP_OK;
- * break;
- */
- case JC_ERR_FILE_SYS_INIT:
- case JC_ERR_MEMORY_ALLOCATION:
- DisplayPopup((PU8) GetString(STR_ID_JMMS_OUT_OF_MEMORY), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE);
- err_code = JMMS_COMP_OUT_MEMORY;
- break;
- case JC_ERR_NULL_POINTER:
- DisplayPopup(
- (PU8) GetString(STR_ID_JMMS_INVALID_POINTER),
- IMG_GLOBAL_ERROR,
- 1,
- JMMS_POPUP_TIME,
- ERROR_TONE);
- break;
- default:
- /* DisplayPopup((PU8) GetString(STR_GLOBAL_ERROR), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE); */
- {
- U8 error_str[20];
- S8 temp[10] = {0, };
- memset(error_str, 0x00, 20);
- sprintf((S8*) temp, "%d", ret_code);
- AnsiiToUnicodeString((PS8) (error_str), (PS8) temp);
- DisplayPopup((PU8) (error_str), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE);
- break;
- }
- }
- if (g_jmms_context->is_add_media_warning == 1)
- {
- g_jmms_context->is_add_media_warning = 0;
- }
- return err_code;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_compose_new_mms
- * DESCRIPTION
- * function of writing a new MMS
- * PARAMETERS
- * void
- * a(?) [IN/OUT] Nil(?)
- * b(?) [IN] Nil(?)
- * RETURNS
- * void
- *****************************************************************************/
- JMMS_COMP_ERRCODE mmi_jmms_compose_new_mms(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /* Deepali: use setting API's */
- JC_RETCODE ret_code = JC_OK;
- JMMS_COMP_ERRCODE err_code;
- U8 config_arg = JMMS_CONFIG_PREVIEW;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_compose_new_mms"));
- if (g_jmms_context->msg_handle != NULL)
- {
- ret_code = mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
- }
- if (ret_code == JC_OK)
- {
- g_jmms_context->msg_handle = NULL;
- ret_code = mmi_jmms_jdi_msg_init(&(g_jmms_context->msg_handle), (void*)config_arg);
- }
- if (ret_code == JC_ERR_MEMORY_ALLOCATION)
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Fail to create msg handle"));
- ret_code = JC_ERR_MEMORY_ALLOCATION;
- goto ERROR_HANDLE;
- }
- if (ret_code == JC_OK)
- {
- ret_code = mmi_jmms_jdi_set_content_class(g_jmms_context->msg_handle, MMS_SUPPORTED_CONTENT_CLASS);
- }
- if (ret_code == JC_OK)
- {
- ret_code = mmi_jmms_jdi_set_creation_mode(g_jmms_context->msg_handle, mmi_jmms_compose_settings_creation_mode());
- }
- if (ret_code == JC_OK)
- {
- ret_code = mmi_jmms_jdi_set_msg_type(g_jmms_context->msg_handle, E_TYPE_MMS);
- }
- if (ret_code == JC_OK)
- {
- ret_code = mmi_jmms_jdi_set_presentation_type(g_jmms_context->msg_handle, E_PRESENTATION_SMIL);
- }
- if (ret_code == JC_OK)
- {
- ret_code = mmi_jmms_jdi_set_max_pages(g_jmms_context->msg_handle, (U8) mmi_jmms_compose_settings_max_no_pages());
- }
- if (ret_code == JC_OK)
- {
- ret_code = mmi_jmms_jdi_msg_register_callback(
- g_jmms_context->msg_handle,
- E_CB_ERROR_IND,
- (void*)mmi_jmms_error_ind_cb);
- }
- ERROR_HANDLE:
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "Fail to create msg error= %d", ret_code));
- err_code = mmi_jmms_compose_handle_error(ret_code, 0);
- return err_code;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_error_ind_cb
- * DESCRIPTION
- *
- * PARAMETERS
- * hMsg [IN]
- * pCallbackArg [?] [?]
- * pCBStruct [?] [?]
- * error [IN]
- * RETURNS
- *
- *****************************************************************************/
- JC_RETCODE mmi_jmms_error_ind_cb(MSG_HANDLE hMsg, void *pCallbackArg, void *pCBStruct, ErrorCode error)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE ret_code = JC_OK;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /*DIlip 30 aug 2006 commented to handel Is media already exist error indicator call back*/
- /* g_jmms_context->is_add_media_warning = 0;*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "mmi_jmms_error_ind_cb %d", error));
- switch (error)
- {
- case E_WARNING_CREATION_MODE:
- g_jmms_context->is_add_media_warning = 1;
- break;
- case E_WARNING_DRM_FORWARD_RESTRICTED:
- ret_code = JC_ERR_MSG_DRM_FORWARD_RESTRICTED;
- break;
- }
- return ret_code;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_compose_add_media
- * DESCRIPTION
- * fn to add media.
- * PARAMETERS
- * path_p [?] [?]
- * type [IN]
- * is_attachment [IN]
- * page_index [IN]
- * a(?) [IN/OUT] Nil(?)
- * b(?) [IN] Nil(?)
- * RETURNS
- * void
- *****************************************************************************/
- JMMS_COMP_ERRCODE mmi_jmms_compose_add_media(void *path_p, U8 type, U8 is_attachment, U8 page_index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MEDIA_INFO *media_info_p;
- S8 *file_name_p;
- U32 file_size = 0;
- /* FS_HANDLE file_handle; */
- JC_RETCODE ret_code = JC_OK;
- JMMS_COMP_ERRCODE err_code;
- U32 media_id;
- JDD_FILE file_handle;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_jmms_compose_add_media"));
- media_info_p = (MEDIA_INFO*) jdd_MemAlloc(sizeof(MEDIA_INFO), sizeof(U8));
- if (media_info_p == NULL)
- {
- ret_code = JC_ERR_MEMORY_ALLOCATION;
- goto ERROR_HANDLE;
- }
- if (g_jmms_context->jmms_fs_handle == NULL)
- {
- if (jdd_FSInitialize(&g_jmms_context->jmms_fs_handle) != JC_OK)
- {
- ret_code = JC_ERR_FILE_SYS_INIT;
- goto ERROR_HANDLE;
- }
- }
- file_name_p = mmi_fmgr_extract_file_name((S8*) path_p);
- file_handle = jdd_FSOpen(g_jmms_context->jmms_fs_handle, (U16*) path_p, E_OPEN_READ_MODE);
- if (file_handle == NULL)
- {
- ret_code = JC_ERR_FILE_OPEN;
- goto ERROR_HANDLE;
- }
- jdd_FSGetSize(file_handle, &file_size);
- jdd_FSClose(file_handle);
- media_info_p->pMimeInfo = (MEDIA_MIME_INFO*) jdd_MemAlloc(sizeof(MEDIA_MIME_INFO), sizeof(U8));
- if (media_info_p->pMimeInfo == NULL)
- {
- ret_code = JC_ERR_MEMORY_ALLOCATION;
- goto ERROR_HANDLE;
- }
- media_info_p->eMediaType = type;
- if (is_attachment == E_FALSE && (type == E_MEDIA_IMAGE || type == E_MEDIA_VIDEO))
- {
- U8 size;
- size = strlen(STRING_IMAGE);
- media_info_p->PresentationInfo.pRegionName = (JC_CHAR*) jdd_MemAlloc(sizeof(JC_CHAR), size + 1);
- if (media_info_p->PresentationInfo.pRegionName == NULL)
- {
- ret_code = JC_ERR_MEMORY_ALLOCATION;
- goto ERROR_HANDLE;
- }
- AnsiiToUnicodeString((PS8)(media_info_p->PresentationInfo.pRegionName), (PS8) (STRING_IMAGE) );
- }
- media_info_p->pMimeInfo->ContentData.bIsStream = E_TRUE;
- media_info_p->pMimeInfo->ContentData.eCopyMemory = E_FALSE;
- media_info_p->pMimeInfo->ContentData.pBuffer = NULL;
- media_info_p->pMimeInfo->ContentData.uiCurSize = 0;
- media_info_p->pMimeInfo->ContentData.uiTotalSize = file_size;
- media_info_p->pMimeInfo->ContentData.cbReadCallback = mmi_jmms_read_callback;
- media_info_p->pMimeInfo->ContentData.cbWriteCallback = NULL;
- media_info_p->pMimeInfo->ContentData.uiStartOffset = 0;
- media_info_p->pMimeInfo->ContentData.pFileName =
- (JC_CHAR*) jdd_MemAlloc((jc_tcslen((JC_CHAR*) path_p) + 1), sizeof(JC_CHAR));
- if (media_info_p->pMimeInfo->ContentData.pFileName == NULL)
- {
- ret_code = JC_ERR_MEMORY_ALLOCATION;
- goto ERROR_HANDLE;
- }
- jc_tcscpy((UI_character_type*) media_info_p->pMimeInfo->ContentData.pFileName, (UI_character_type*) path_p);
- media_info_p->pMimeInfo->ContentData.pStream = media_info_p->pMimeInfo->ContentData.pFileName;
- media_info_p->pMimeInfo->MimeHeaders.bIsAttachment = is_attachment;
- if ((GetUCS2Flag((S8*) file_name_p) == FALSE )&& (IsExtendedCharPresent((S8*) file_name_p)== FALSE))
- {
- media_info_p->pMimeInfo->MimeHeaders.pObjectName =
- (JC_CHAR*) jdd_MemAlloc((jc_tcslen((JC_CHAR*) file_name_p) + 1), sizeof(JC_CHAR));
- if (media_info_p->pMimeInfo->MimeHeaders.pObjectName == NULL)
- {
- ret_code = JC_ERR_MEMORY_ALLOCATION;
- goto ERROR_HANDLE;
- }
- jc_tcscpy((JC_CHAR*) media_info_p->pMimeInfo->MimeHeaders.pObjectName, (JC_CHAR*) file_name_p);
- }
- else
- {
- ret_code = mmi_jmms_convert_chinese_english_filename(
- (JC_CHAR **) & (media_info_p->pMimeInfo->MimeHeaders.pObjectName),
- (JC_CHAR*) file_name_p);
- if (ret_code != JC_OK)
- {
- goto ERROR_HANDLE;
- }
- }
- #ifdef __DRM_SUPPORT__
- if(jMMS_is_sep_delivery_content(path_p))/* && (mmi_jmms_compose_settings_creation_mode() == E_CREATION_MODE_RESTRICTED))*/
- {
- media_info_p->pMimeInfo->MimeHeaders.pContentType = jdi_UtilsStrdup("application/vnd.oma.drm.content");
- }
- else
- {
- #endif /* __DRM_SUPPORT__ */
- media_info_p->pMimeInfo->MimeHeaders.pContentType =
- (JC_INT8*) mmi_mms_get_mms_content_type_file((UI_character_type*) file_name_p);
- #ifdef __DRM_SUPPORT__
- }
- #endif
- if (media_info_p->pMimeInfo->MimeHeaders.pContentType == NULL)
- {
- ret_code = JC_ERR_MEMORY_ALLOCATION;
- goto ERROR_HANDLE;
- }
- /* add media */
- ret_code = mmi_jmms_jdi_add_media(g_jmms_context->msg_handle, media_info_p, page_index, &media_id);
- if(ret_code != JC_OK)
- {
- goto ERROR_HANDLE;
- }
- #ifdef __DRM_SUPPORT__
- if(is_add_media_as_drm)
- {
- ret_code = jdi_MsgSetMediaDRMType (g_jmms_context->msg_handle, page_index,
- media_id, E_DRM_FWD_LOCK,
- media_info_p->pMimeInfo->MimeHeaders.bIsAttachment);
- mmi_jmms_jdi_msg_register_callback(g_jmms_context->msg_handle,
- E_CB_DRM_COMPOSE,
- (void*)jMMS_drm_compose_handler);
- is_add_media_as_drm = MMI_FALSE;
- }
- else
- {
- ret_code = jdi_MsgSetMediaDRMType (g_jmms_context->msg_handle, page_index,
- media_id, E_DRM_NONE,
- media_info_p->pMimeInfo->MimeHeaders.bIsAttachment);
- }
- #endif
- ERROR_HANDLE:
- err_code = mmi_jmms_compose_handle_error(ret_code, 0);
- switch (err_code)
- {
- case JMMS_COMP_OK:
- case JMMS_COMP_POPUP_OK:
- {
- if (is_attachment == E_FALSE)
- {
- U32 start_time = 0;
- U32 duration = 0, audio_duration = 0;
- U32 max = 999;
- #ifdef __MMI_VIDEO_PLAYER__
- U64 video_duration = 0;
- #endif
- switch (type)
- {
- case E_MEDIA_IMAGE:
- {
- g_jmms_context->compose_context->curr_slide_info.image_ID = media_id;
- g_jmms_context->compose_context->curr_slide_info.img_info.pFileName =
- (U8*) media_info_p->pMimeInfo->ContentData.pFileName;
- break;
- }
- case E_MEDIA_AUDIO:
- g_jmms_context->compose_context->curr_slide_info.audio_ID = media_id;
- mdi_audio_get_duration((S8*) path_p, &audio_duration);
- duration = audio_duration / 1000;
- duration = (duration >= max)? max : ((audio_duration % 1000) > 0)?(duration + 1) : duration;
- err_code = mmi_jmms_set_media_time(
- start_time,
- duration,
- g_jmms_context->compose_context->curr_slide_info.audio_ID,
- g_jmms_context->compose_context->curr_page_index);
- break;
- case E_MEDIA_VIDEO:
- g_jmms_context->compose_context->curr_slide_info.video_ID = media_id;
- g_jmms_context->compose_context->curr_slide_info.img_info.pFileName =
- (U8*) media_info_p->pMimeInfo->ContentData.pFileName;
- #ifdef __MMI_VIDEO_PLAYER__
- video_duration = mmi_jdd_videoapp_get_video_file_duration_info((S8*) path_p);
- duration = (U32)( video_duration / 1000);
- duration = (duration >= max)? max : ((video_duration % 1000) > 0)?(duration + 1) : duration;
- err_code = mmi_jmms_set_media_time(
- start_time,
- duration,
- g_jmms_context->compose_context->curr_slide_info.video_ID,
- g_jmms_context->compose_context->curr_page_index);
- #endif
- break;
- }
- }
- else
- {
- g_jmms_context->num_attachments++;
- }
- }
- break;
- case JMMS_COMP_FAIL:
- case JMMS_COMP_OUT_MEMORY: /* deallocate memory for new slide and out of mmeory case. */
- {
- if (media_info_p != NULL)
- {
- if (media_info_p->pMimeInfo != NULL)
- {
- if (media_info_p->pMimeInfo->ContentData.pFileName != NULL)
- {
- jdd_MemFree(media_info_p->pMimeInfo->ContentData.pFileName);
- }
- if (media_info_p->pMimeInfo->MimeHeaders.pContentType != NULL)
- {
- jdd_MemFree(media_info_p->pMimeInfo->MimeHeaders.pContentType);
- }
- if (media_info_p->pMimeInfo->MimeHeaders.pObjectName != NULL)
- {
- jdd_MemFree(media_info_p->pMimeInfo->MimeHeaders.pObjectName);
- }
- jdd_MemFree(media_info_p->pMimeInfo);
- }
- if (media_info_p->PresentationInfo.pRegionName != NULL)
- {
- jdd_MemFree(media_info_p->PresentationInfo.pRegionName);
- }
- jdd_MemFree(media_info_p);
- media_info_p = NULL;
- }
- }
- err_code = JMMS_COMP_FAIL;
- break;
- case JMMS_COMP_NEW_SLIDE:
- {
- JMMS_COMP_ERRCODE temp_err_code;
- if (media_info_p != NULL)
- {
- if (media_info_p->pMimeInfo != NULL)
- {
- if (media_info_p->pMimeInfo->ContentData.pFileName != NULL)
- {
- jdd_MemFree(media_info_p->pMimeInfo->ContentData.pFileName);
- }
- if (media_info_p->pMimeInfo->MimeHeaders.pContentType != NULL)
- {
- jdd_MemFree(media_info_p->pMimeInfo->MimeHeaders.pContentType);
- }
- if (media_info_p->pMimeInfo->MimeHeaders.pObjectName != NULL)
- {
- jdd_MemFree(media_info_p->pMimeInfo->MimeHeaders.pObjectName);
- }
- jdd_MemFree(media_info_p->pMimeInfo);
- }
- if (media_info_p->PresentationInfo.pRegionName != NULL)
- {
- jdd_MemFree(media_info_p->PresentationInfo.pRegionName);
- }
- jdd_MemFree(media_info_p);
- media_info_p = NULL;
- }
- temp_err_code = mmi_jmms_compose_insert_slide();
- if (temp_err_code == JMMS_COMP_OK)
- {
- HistoryReplace(SCR_ID_JMMS_EDIT_CONTENT, SCR_ID_JMMS_EDIT_CONTENT, mmi_jmms_entry_edit_content_screen); /* to delete guibuffer details as entering new slide. */
- temp_err_code = mmi_jmms_compose_add_media(path_p, type, is_attachment, (U8) (page_index + 1));
- }
- if (temp_err_code != JMMS_COMP_OK)
- {
- err_code = temp_err_code;
- }
- else
- {
- err_code = JMMS_COMP_POPUP_OK;
- }
- }
- break;
- }
- mmi_jmms_set_region_list();
- if (g_jmms_context->jmms_fs_handle != NULL)
- {
- jdd_FSDeinitialize(g_jmms_context->jmms_fs_handle);
- g_jmms_context->jmms_fs_handle = NULL;
- }
- if (media_info_p != NULL)
- {
- jdd_MemFree(media_info_p);
- media_info_p = NULL;
- }
- return err_code;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_compose_add_media_template
- * DESCRIPTION
- * fn to add media.
- * PARAMETERS
- * buffer [?] [?]
- * content_type [?] [?]
- * size [IN]
- * type [IN]
- * is_attachment [IN]
- * page_index [IN]
- * a(?) [IN/OUT] Nil(?)
- * b(?) [IN] Nil(?)
- * RETURNS
- * void
- *****************************************************************************/
- JMMS_COMP_ERRCODE mmi_jmms_compose_add_media_template(
- U8 *buffer,
- U8 *content_type,
- U32 size,
- U8 type,
- U8 is_attachment,
- U8 page_index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MEDIA_INFO *media_info_p;
- JC_RETCODE ret_code = JC_OK;
- JMMS_COMP_ERRCODE err_code;
- U32 media_id;
- U8 *media_buffer_p = NULL;
- U8 region_size = 0;
- U8 object_name_size = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_jmms_compose_add_media_template"));
- media_info_p = (MEDIA_INFO*) jdd_MemAlloc(sizeof(MEDIA_INFO), sizeof(U8));
- if (media_info_p == NULL)
- {
- ret_code = JC_ERR_MEMORY_ALLOCATION;
- goto ERROR_HANDLE;
- }
- media_info_p->pMimeInfo = (MEDIA_MIME_INFO*) jdd_MemAlloc(sizeof(MEDIA_MIME_INFO), sizeof(U8));
- if (media_info_p->pMimeInfo == NULL)
- {
- ret_code = JC_ERR_MEMORY_ALLOCATION;
- goto ERROR_HANDLE;
- }
- media_info_p->eMediaType = type;
- if (is_attachment == E_FALSE && (type == E_MEDIA_IMAGE || type == E_MEDIA_VIDEO))
- {
- region_size = strlen(STRING_IMAGE);
- media_info_p->PresentationInfo.pRegionName = (JC_CHAR*) jdd_MemAlloc(sizeof(JC_CHAR), region_size + 1);
- if (media_info_p->PresentationInfo.pRegionName == NULL)
- {
- ret_code = JC_ERR_MEMORY_ALLOCATION;
- goto ERROR_HANDLE;
- }
- AnsiiToUnicodeString((PS8)(media_info_p->PresentationInfo.pRegionName), (PS8) (STRING_IMAGE));
- }
- media_info_p->pMimeInfo->ContentData.bIsStream = E_FALSE;
- media_info_p->pMimeInfo->ContentData.eCopyMemory = E_FALSE;
- media_buffer_p = (U8*) jdd_MemAlloc(size, sizeof(U8));
- if (media_buffer_p == NULL)
- {
- ret_code = JC_ERR_MEMORY_ALLOCATION;
- goto ERROR_HANDLE;
- }
- memcpy(media_buffer_p, buffer, size);
- media_info_p->pMimeInfo->ContentData.pBuffer = media_buffer_p;
- media_info_p->pMimeInfo->ContentData.uiCurSize = size;
- media_info_p->pMimeInfo->ContentData.uiTotalSize = size;
- media_info_p->pMimeInfo->ContentData.cbReadCallback = NULL;
- media_info_p->pMimeInfo->ContentData.cbWriteCallback = NULL;
- media_info_p->pMimeInfo->ContentData.uiStartOffset = 0;
- media_info_p->pMimeInfo->ContentData.pFileName = NULL;
- media_info_p->pMimeInfo->MimeHeaders.bIsAttachment = is_attachment;
- if (is_attachment == E_FALSE && (type == E_MEDIA_IMAGE || type == E_MEDIA_VIDEO))
- {
- object_name_size = strlen(STRING_IMAGE);
- }
- else if (is_attachment == E_FALSE)
- {
- object_name_size = strlen(STRING_AUDIO);
- }
- else
- {
- object_name_size = strlen(STRING_ATTACHMENT);
- }
- media_info_p->pMimeInfo->MimeHeaders.pObjectName = (JC_CHAR*) jdd_MemAlloc(sizeof(JC_CHAR), object_name_size + 1);
- if (media_info_p->pMimeInfo->MimeHeaders.pObjectName == NULL)
- {
- ret_code = JC_ERR_MEMORY_ALLOCATION;
- goto ERROR_HANDLE;
- }
- if (is_attachment == E_FALSE && (type == E_MEDIA_IMAGE || type == E_MEDIA_VIDEO))
- {
- AnsiiToUnicodeString((PS8)(media_info_p->pMimeInfo->MimeHeaders.pObjectName), (PS8) (STRING_IMAGE));
- }
- else if (is_attachment == E_FALSE)
- {
- AnsiiToUnicodeString((PS8)(media_info_p->pMimeInfo->MimeHeaders.pObjectName), (PS8) (STRING_AUDIO));
- }
- else
- {
- AnsiiToUnicodeString((PS8)(media_info_p->pMimeInfo->MimeHeaders.pObjectName), (PS8) (STRING_ATTACHMENT));
- }
- media_info_p->pMimeInfo->MimeHeaders.pContentType =
- (JC_INT8*) jdd_MemAlloc(sizeof(JC_INT8), strlen((S8*) content_type) + 1);
- if (media_info_p->pMimeInfo->MimeHeaders.pContentType == NULL)
- {
- ret_code = JC_ERR_MEMORY_ALLOCATION;
- goto ERROR_HANDLE;
- }
- strcpy((S8*) media_info_p->pMimeInfo->MimeHeaders.pContentType, (S8*) content_type);
- /* add media */
- ret_code = mmi_jmms_jdi_add_media(g_jmms_context->msg_handle, media_info_p, page_index, &media_id);
- ERROR_HANDLE:
- err_code = mmi_jmms_compose_handle_error(ret_code, 0);
- switch (err_code)
- {
- case JMMS_COMP_FAIL:
- case JMMS_COMP_OUT_MEMORY: /* deallocate memory for new slide and out of mmeory case. */
- {
- if (media_info_p != NULL)
- {
- if (media_info_p->pMimeInfo != NULL)
- {
- if (media_info_p->pMimeInfo->ContentData.pFileName != NULL)
- {
- jdd_MemFree(media_info_p->pMimeInfo->ContentData.pFileName);
- }
- if (media_info_p->pMimeInfo->MimeHeaders.pContentType != NULL)
- {
- jdd_MemFree(media_info_p->pMimeInfo->MimeHeaders.pContentType);
- }
- if (media_info_p->pMimeInfo->MimeHeaders.pObjectName != NULL)
- {
- jdd_MemFree(media_info_p->pMimeInfo->MimeHeaders.pObjectName);
- }
- jdd_MemFree(media_info_p->pMimeInfo);
- }
- if (media_info_p->PresentationInfo.pRegionName != NULL)
- {
- jdd_MemFree(media_info_p->PresentationInfo.pRegionName);
- }
- jdd_MemFree(media_info_p);
- media_info_p = NULL;
- }
- }
- err_code = JMMS_COMP_FAIL;
- break;
- }
- mmi_jmms_set_region_list();
- if (media_info_p != NULL)
- {
- jdd_MemFree(media_info_p);
- media_info_p = NULL;
- }
- return err_code;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_compose_add_text
- * DESCRIPTION
- * fn to add text.
- * PARAMETERS
- * page_index [IN]
- * text_font [IN]
- * txt_color [IN]
- * a(?) [IN/OUT] Nil(?)
- * b(?) [IN] Nil(?)
- * RETURNS
- * void
- *****************************************************************************/
- /* U8 media_buffer_p[3000]; */
- JMMS_COMP_ERRCODE mmi_jmms_compose_add_text(U8 page_index, UI_font_type text_font, U32 txt_color, S32 update_text_id)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MEDIA_INFO *media_info_p;
- JC_RETCODE ret_code = JC_OK;
- JMMS_COMP_ERRCODE err_code;
- U32 media_id;
- U32 buffer_size;
- U8 size;
- U8 *media_buffer_p = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_jmms_compose_add_text"));
- media_info_p = (MEDIA_INFO*) jdd_MemAlloc(sizeof(MEDIA_INFO), sizeof(U8));
- if (media_info_p == NULL)
- {
- ret_code = JC_ERR_MEMORY_ALLOCATION;
- goto ERROR_HANDLE;
- }
- media_info_p->pMimeInfo = (MEDIA_MIME_INFO*) jdd_MemAlloc(sizeof(MEDIA_MIME_INFO), sizeof(U8));
- if (media_info_p->pMimeInfo == NULL)
- {
- ret_code = JC_ERR_MEMORY_ALLOCATION;
- goto ERROR_HANDLE;
- }
- media_info_p->eMediaType = E_MEDIA_TEXT;
- media_info_p->PresentationInfo.pTextAttributes =
- (TEXT_ATTRIBUTES*) jdd_MemAlloc(sizeof(TEXT_ATTRIBUTES), sizeof(U8));
- if (media_info_p->PresentationInfo.pTextAttributes == NULL)
- {
- ret_code = JC_ERR_MEMORY_ALLOCATION;
- goto ERROR_HANDLE;
- }
- if (text_font->bold == 1)
- {
- media_info_p->PresentationInfo.pTextAttributes->bIsBold = E_TRUE;
- }
- if (text_font->italic == 1)
- {
- media_info_p->PresentationInfo.pTextAttributes->bIsItalic = E_TRUE;
- }
- media_info_p->PresentationInfo.pTextAttributes->pFontColor =
- (JC_INT8*) jdd_MemAlloc((strlen("#rrggbb") + 1), sizeof(JC_INT8));
- if (media_info_p->PresentationInfo.pTextAttributes->pFontColor == NULL)
- {
- ret_code = JC_ERR_MEMORY_ALLOCATION;
- goto ERROR_HANDLE;
- }
- mmi_jmms_convert_u32To_hash_col_string(txt_color, media_info_p->PresentationInfo.pTextAttributes->pFontColor);
- switch (text_font->size)
- {
- case SMALL_FONT:
- media_info_p->PresentationInfo.pTextAttributes->uiFontSize = MMS_SIZE_SMALL;
- break;
- case LARGE_FONT:
- media_info_p->PresentationInfo.pTextAttributes->uiFontSize = MMS_SIZE_LARGE;
- break;
- case MEDIUM_FONT:
- media_info_p->PresentationInfo.pTextAttributes->uiFontSize = MMS_SIZE_NORMAL;
- break;
- }
- media_info_p->pMimeInfo->MimeHeaders.pContentType =
- (JC_INT8*) jdd_MemAlloc(jc_strlen("text/plain") + 1, sizeof(JC_INT8));
- if (media_info_p->pMimeInfo->MimeHeaders.pContentType == NULL)
- {
- ret_code = JC_ERR_MEMORY_ALLOCATION;
- goto ERROR_HANDLE;
- }
- jc_strcpy(media_info_p->pMimeInfo->MimeHeaders.pContentType, "text/plain");
- size = strlen(STRING_TEXT);
- media_info_p->PresentationInfo.pRegionName = (JC_CHAR*) jdd_MemAlloc(sizeof(JC_CHAR), size + 1);
- if (media_info_p->PresentationInfo.pRegionName == NULL)
- {
- ret_code = JC_ERR_MEMORY_ALLOCATION;
- goto ERROR_HANDLE;
- }
- AnsiiToUnicodeString((PS8)(media_info_p->PresentationInfo.pRegionName), (PS8) (STRING_TEXT));
- buffer_size = jc_tcslen((UI_character_type*) g_jmms_context->compose_context->curr_slide_info.edit_content_buffer) *
- sizeof(JC_CHAR);
- media_info_p->pMimeInfo->ContentData.uiTotalSize = buffer_size;
- media_info_p->pMimeInfo->ContentData.uiCurSize = buffer_size;
- media_buffer_p = (U8*) jdd_MemAlloc(buffer_size + 1, sizeof(U16));
- if (media_buffer_p == NULL)
- {
- ret_code = JC_ERR_MEMORY_ALLOCATION;
- goto ERROR_HANDLE;
- }
- jc_tcscpy(
- (UI_character_type*) media_buffer_p,
- (UI_character_type*) g_jmms_context->compose_context->curr_slide_info.edit_content_buffer);
- media_info_p->pMimeInfo->ContentData.pBuffer = media_buffer_p;
- ret_code = mmi_jmms_jdi_add_media(g_jmms_context->msg_handle, media_info_p, page_index, &media_id);
- ERROR_HANDLE:
- err_code = mmi_jmms_compose_handle_error(ret_code, 0);
- switch (err_code)
- {
- case JMMS_COMP_OK:
- case JMMS_COMP_POPUP_OK:
- if(update_text_id)
- g_jmms_context->compose_context->curr_slide_info.text_ID = media_id;
- break;
- case JMMS_COMP_FAIL:
- case JMMS_COMP_OUT_MEMORY: /* deallocate memory for new slide and out of mmeory case. */
- {
- if (media_info_p != NULL)
- {
- if (media_info_p->pMimeInfo != NULL)
- {
- if (media_info_p->pMimeInfo->MimeHeaders.pContentType != NULL)
- {
- jdd_MemFree(media_info_p->pMimeInfo->MimeHeaders.pContentType);
- }
- jdd_MemFree(media_info_p->pMimeInfo);
- }
- if (media_info_p->PresentationInfo.pRegionName != NULL)
- {
- jdd_MemFree(media_info_p->PresentationInfo.pRegionName);
- }
- if (media_info_p->PresentationInfo.pTextAttributes != NULL)
- {
- jdd_MemFree(media_info_p->PresentationInfo.pTextAttributes);
- }
- jdd_MemFree(media_info_p);
- media_info_p = NULL;
- }
- if (media_buffer_p != NULL)
- {
- jdd_MemFree(media_buffer_p);
- }
- }
- err_code = JMMS_COMP_FAIL;
- break;
- }
- mmi_jmms_set_region_list();
- if (media_info_p != NULL)
- {
- jdd_MemFree(media_info_p);
- media_info_p = NULL;
- }
- return err_code;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_compose_update_text
- * DESCRIPTION
- * fn to update text media.
- * PARAMETERS
- * page_index [IN]
- * media_id [IN]
- * a(?) [IN/OUT] Nil(?)
- * b(?) [IN] Nil(?)
- * RETURNS
- * void
- *****************************************************************************/
- /* U8 media_buffer_p[3000]; */
- JMMS_COMP_ERRCODE mmi_jmms_compose_update_text(U8 page_index, U32 media_id)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_UINT8 *media_buffer_p;
- U32 buffer_size;
- JC_RETCODE ret_code = JC_OK;
- JMMS_COMP_ERRCODE err_code;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_jmms_compose_update_text"));
- buffer_size = jc_tcslen((JC_CHAR*) g_jmms_context->compose_context->curr_slide_info.edit_content_buffer) * sizeof(JC_CHAR);
- media_buffer_p = (U8*) jdd_MemAlloc(buffer_size + 1, sizeof(JC_CHAR));
- if (media_buffer_p == NULL)
- {
- ret_code = JC_ERR_MEMORY_ALLOCATION;
- goto ERROR_HANDLE;
- }
- jc_tcscpy(
- (JC_CHAR*) media_buffer_p,
- (JC_CHAR*) g_jmms_context->compose_context->curr_slide_info.edit_content_buffer);
- ret_code = mmi_jmms_jdi_update_inline_text(
- g_jmms_context->msg_handle,
- (JC_UINT8*) media_buffer_p,
- buffer_size,
- page_index,
- media_id);
- ERROR_HANDLE:
- err_code = mmi_jmms_compose_handle_error(ret_code, 0);
- switch (err_code)
- {
- case JMMS_COMP_FAIL:
- case JMMS_COMP_OUT_MEMORY: /* deallocate memory for new slide and out of mmeory case. */
- if (media_buffer_p != NULL)
- {
- jdd_MemFree(media_buffer_p);
- }
- err_code = JMMS_COMP_FAIL;
- break;
- }
- return err_code;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_mms_get_mms_content_type_file
- * DESCRIPTION
- * returns the content type of media file.
- * PARAMETERS
- * file_name_p [?] [?]
- * a(?) [IN/OUT] Nil(?)
- * b(?) [IN] Nil(?)
- * RETURNS
- * void
- *****************************************************************************/
- U8 *mmi_mms_get_mms_content_type_file(JC_CHAR *file_name_p)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 *content_type_p = NULL;
- JC_CHAR *tmp_file_name = NULL;
- applib_mime_type_struct *mime_info = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_mms_get_mms_content_type_file"));
- if (file_name_p)
- {
- U32 iIndex = 0;
- tmp_file_name = jdi_UtilsTcsDup(file_name_p);
- tmp_file_name = jdi_UtilsTcsUpperToLower((JC_CHAR*) tmp_file_name);
- iIndex = jdi_UtilsLastIndexOfTchar('.', tmp_file_name, jc_tcslen(tmp_file_name) - 1);
- if (iIndex > 0 && jc_tcslen(tmp_file_name) != (U32) iIndex)
- {
- U16 uhCounter = 0;
- iIndex++;
- while (*(g_content_type_list[uhCounter][0]) != 0)
- {
- if (jdi_UtilsTcsStrCmp(tmp_file_name + iIndex, g_content_type_list[uhCounter][1]) == 0)
- {
- content_type_p = (U8*) jdi_UtilsStrdup(g_content_type_list[uhCounter][0]);
- break;
- }
- uhCounter++;
- }
- }
- }
- if (tmp_file_name)
- {
- jdd_MemFree(tmp_file_name);
- }
- if (content_type_p == NULL)
- {
- if(mime_get_extension(file_name_p) != NULL)
- {
- mime_info = mime_get_file_type(file_name_p);
- }
- if (mime_info == NULL)
- {
- content_type_p = (U8*) jdi_UtilsStrdup("application/octet-stream");
- }
- else
- {
- content_type_p = (U8*) jdi_UtilsStrdup(mime_info->mime_string);
- }
- }
- return content_type_p;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_is_mime_found_in_g_content_type_list
- * DESCRIPTION
- * returns the content type of media file.
- * PARAMETERS
- * pszContentType [IN]
- * RETURNS
- * JC_BOOLEAN
- *****************************************************************************/
- JC_BOOLEAN mmi_jmms_is_mime_found_in_g_content_type_list(JC_INT8 *pszContentType)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 uhCounter = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (*(g_content_type_list[uhCounter][0]) != 0)
- {
- if (strcmp(pszContentType, (PS8)(g_content_type_list[uhCounter][0])) == 0)
- {
- return E_TRUE;
- }
- uhCounter++;
- }
- return E_FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_compose_delete_media
- * DESCRIPTION
- * fn to delete media.
- * PARAMETERS
- * media_id [IN]
- * page_index [IN]
- * is_attachment [IN]
- * a(?) [IN/OUT] Nil(?)
- * b(?) [IN] Nil(?)
- * RETURNS
- * void
- *****************************************************************************/
- /* U8 media_buffer_p[3000]; */
- JMMS_COMP_ERRCODE mmi_jmms_compose_delete_media(U32 media_id, U8 page_index, U8 is_attachment)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE ret_code = JC_OK;
- JMMS_COMP_ERRCODE err_code;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_jmms_compose_delete_media"));
- ret_code = mmi_jmms_jdi_delete_media(g_jmms_context->msg_handle, page_index, media_id, is_attachment);
- err_code = mmi_jmms_compose_handle_error(ret_code, 0);
- return err_code;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_compose_delete_page
- * DESCRIPTION
- * fn to delete media.
- * PARAMETERS
- * page_index [IN]
- * a(?) [IN/OUT] Nil(?)
- * b(?) [IN] Nil(?)
- * RETURNS
- * void
- *****************************************************************************/
- /* U8 media_buffer_p[3000]; */
- JMMS_COMP_ERRCODE mmi_jmms_compose_delete_page(U8 page_index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE ret_code = JC_OK;
- JMMS_COMP_ERRCODE err_code;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_jmms_compose_delete_page"));
- ret_code = mmi_jmms_jdi_delete_page(g_jmms_context->msg_handle, page_index);
- err_code = mmi_jmms_compose_handle_error(ret_code, 1);
- return err_code;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_compose_get_media_list
- * DESCRIPTION
- * fn to delete media.
- * PARAMETERS
- * page_index [IN]
- * media_info_p [IN]
- * media_count [?] [?]
- * is_attachment [IN]
- * a(?) [IN/OUT] Nil(?)
- * b(?) [IN] Nil(?)
- * RETURNS
- * void
- *****************************************************************************/
- /* U8 media_buffer_p[3000]; */
- JMMS_COMP_ERRCODE mmi_jmms_compose_get_media_list(
- U8 page_index,
- MEDIA_INFO **media_info_p,
- U8 *media_count,
- U8 is_attachment)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE ret_code = JC_OK;
- JMMS_COMP_ERRCODE err_code;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_jmms_compose_get_media_list"));
- ret_code = mmi_jmms_jdi_get_media_list(g_jmms_context->msg_handle, page_index, media_info_p, media_count, is_attachment);
- err_code = mmi_jmms_compose_handle_error(ret_code, 0);
- if (*media_count == 0)
- {
- err_code = JMMS_COMP_FAIL;
- }
- return err_code;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_compose_insert_slide
- * DESCRIPTION
- * This fn inserts a slide.
- * PARAMETERS
- * void
- * a(?) [IN/OUT] Nil(?)
- * b(?) [IN] Nil(?)
- * RETURNS
- * void
- *****************************************************************************/
- JMMS_COMP_ERRCODE mmi_jmms_compose_insert_slide(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE ret_code = JC_OK;
- JMMS_COMP_ERRCODE err_code;
- U8 max_page = 0, count = 0;
- U32 slide_time = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_jmms_compose_insert_slide"));
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d %d", "Previous Set Values: Text Size of compose context and inline item is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.size, g_jmms_context->jmms_inline_items.text_settings_items.size_selected));
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d %d", "Previous Set Values: Italic Selection of compose context and inline item is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.italic, g_jmms_context->jmms_inline_items.text_settings_items.italic_selected));
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d %d", "Previous Set Values: Bold Selection of compose context and inline item is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.bold, g_jmms_context->jmms_inline_items.text_settings_items.bold_selected));
- max_page = (U8) mmi_jmms_compose_settings_max_no_pages();
- if (max_page > g_jmms_context->compose_context->curr_page_index)
- {
- ret_code = mmi_jmms_jdi_add_page(
- g_jmms_context->msg_handle,
- (U8) (g_jmms_context->compose_context->curr_page_index + 1));
- }
- else
- {
- ret_code = JC_ERR_MSG_MAX_REACHED;
- }
- err_code = mmi_jmms_compose_handle_error(ret_code, 1);
- switch (err_code)
- {
- case JMMS_COMP_OK:
- {
- g_jmms_context->compose_context->curr_page_index++;
- /* shuffling of compose_context->duration handling array */
- for(count = MAX_POSSIBLE_SLIDES - 1; count >= g_jmms_context->compose_context->curr_page_index ; count-- )
- {
- g_jmms_context->compose_context->duration[count].txt_dur_max_set = g_jmms_context->compose_context->duration[count - 1].txt_dur_max_set;
- g_jmms_context->compose_context->duration[count].img_dur_max_set = g_jmms_context->compose_context->duration[count - 1].img_dur_max_set;
- g_jmms_context->compose_context->duration[count].audio_dur_max_set = g_jmms_context->compose_context->duration[count - 1].audio_dur_max_set;
- g_jmms_context->compose_context->duration[count].video_dur_max_set = g_jmms_context->compose_context->duration[count - 1].video_dur_max_set;
- }
- mmi_jmms_compose_fill_default_values_slide_settings();
- slide_time = mmi_jmms_compose_settings_default_slide_time();
- err_code = mmi_jmms_save_page_time(slide_time);
- if (err_code == JMMS_COMP_OK)
- {
- g_jmms_context->compose_context->curr_slide_info.slide_prop.slide_time = slide_time;
- }
- memset(
- g_jmms_context->compose_context->curr_slide_info.edit_content_buffer,
- 0,
- (JMMS_COMPOSE_TEXT_LENGTH + 1) * ENCODING_LENGTH);
- g_jmms_context->compose_context->curr_slide_info.text_ID = 0;
- g_jmms_context->compose_context->curr_slide_info.image_ID = 0;
- g_jmms_context->compose_context->curr_slide_info.audio_ID = 0;
- g_jmms_context->compose_context->curr_slide_info.video_ID = 0;
- /* shuffling of is_image_first handling array */
- for(count = MAX_POSSIBLE_SLIDES - 1; count >= g_jmms_context->compose_context->curr_page_index ; count-- )
- {
- g_jmms_context->compose_context->is_image_first[ count ] = g_jmms_context->compose_context->is_image_first[ count - 1 ];
- }
- g_jmms_context->compose_context->is_image_first[ g_jmms_context->compose_context->curr_page_index - 1 ] = 0;
- }
- break;
- }
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d %d", "After Set Values: Text Size of compose context and inline item is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.size, g_jmms_context->jmms_inline_items.text_settings_items.size_selected));
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d %d", "After Set Values: Italic Selection of compose context and inline item is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.italic, g_jmms_context->jmms_inline_items.text_settings_items.italic_selected));
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d %d", "After Set Values: Bold Selection of compose context and inline item is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.bold, g_jmms_context->jmms_inline_items.text_settings_items.bold_selected));
- return err_code;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_exit_curr_slide
- * DESCRIPTION
- * This fn inserts a slide.
- * PARAMETERS
- * void
- * a(?) [IN/OUT] Nil(?)
- * b(?) [IN] Nil(?)
- * RETURNS
- * JMMS_COMP_ERRCODE
- *****************************************************************************/
- JMMS_COMP_ERRCODE mmi_jmms_exit_curr_slide(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JMMS_COMP_ERRCODE err_code = JMMS_COMP_OK;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_jmms_exit_curr_slide"));
- if (g_jmms_context->compose_context->exit_conpose_screen == 0 &&
- g_jmms_context->compose_context->curr_page_index > 0)
- {
- /* Deepali: If while adding or deleting the text media some poup comes then this is done to prevent re-entry in infinite loop for this fn. */
- g_jmms_context->compose_context->exit_conpose_screen = 1;
- if ((jc_tcslen((UI_character_type*) g_jmms_context->compose_context->curr_slide_info.edit_content_buffer) != 0)
- && g_jmms_context->compose_context->curr_slide_info.text_ID == 0)
- {
- err_code = mmi_jmms_compose_add_text(
- g_jmms_context->compose_context->curr_page_index,
- &(g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font),
- g_jmms_context->compose_context->curr_slide_info.slide_prop.text_color,1);
- }
- else if ((jc_tcslen((UI_character_type*) g_jmms_context->compose_context->curr_slide_info.edit_content_buffer)
- != 0) && g_jmms_context->compose_context->curr_slide_info.text_ID != 0)
- {
- err_code = mmi_jmms_compose_update_text(
- g_jmms_context->compose_context->curr_page_index,
- g_jmms_context->compose_context->curr_slide_info.text_ID);
- }
- else if ((jc_tcslen((UI_character_type*) g_jmms_context->compose_context->curr_slide_info.edit_content_buffer)
- == 0) && g_jmms_context->compose_context->curr_slide_info.text_ID != 0)
- {
- err_code = mmi_jmms_compose_delete_media(
- g_jmms_context->compose_context->curr_slide_info.text_ID,
- g_jmms_context->compose_context->curr_page_index,
- E_FALSE);
- if (err_code == JMMS_COMP_OK || err_code == JMMS_COMP_POPUP_OK)
- {
- g_jmms_context->compose_context->curr_slide_info.text_ID = 0;
- mmi_jmms_set_region_list();
- }
- }
- g_jmms_context->compose_context->exit_conpose_screen = 0;
- }
- return err_code;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_extract_slide_media_info
- * DESCRIPTION
- * extract curretn slide media info..
- * PARAMETERS
- * page_index [IN]
- * a(?) [IN/OUT] Nil(?)
- * b(?) [IN] Nil(?)
- * RETURNS
- * void
- *****************************************************************************/
- JMMS_COMP_ERRCODE mmi_jmms_extract_slide_media_info(U8 page_index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MEDIA_INFO *media_info_p;
- U8 media_count, is_image_first = 0;
- JC_RETCODE ret_code;
- JMMS_COMP_ERRCODE err_code;
- U8 count = 0;
- jmms_context_slide_node_struct *slide_info;
- JC_UINT32 slide_time;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_jmms_extract_slide_media_info"));
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d %d", "Previous Set Values: Text Size of compose context and inline item is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.size, g_jmms_context->jmms_inline_items.text_settings_items.size_selected));
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d %d", "Previous Set Values: Italic Selection of compose context and inline item is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.italic, g_jmms_context->jmms_inline_items.text_settings_items.italic_selected));
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d %d", "Previous Set Values: Bold Selection of compose context and inline item is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.bold, g_jmms_context->jmms_inline_items.text_settings_items.bold_selected));
- ret_code = mmi_jmms_jdi_get_media_list(g_jmms_context->msg_handle, page_index, &media_info_p, &media_count, E_FALSE);
- err_code = mmi_jmms_compose_handle_error(ret_code, 0);
- if (err_code == JMMS_COMP_OK)
- {
- memset(
- g_jmms_context->compose_context->curr_slide_info.edit_content_buffer,
- 0,
- (JMMS_COMPOSE_TEXT_LENGTH + 1) * ENCODING_LENGTH);
- g_jmms_context->compose_context->curr_slide_info.text_ID = 0;
- g_jmms_context->compose_context->curr_slide_info.image_ID = 0;
- g_jmms_context->compose_context->curr_slide_info.audio_ID = 0;
- g_jmms_context->compose_context->curr_slide_info.video_ID = 0;
- slide_info = &(g_jmms_context->compose_context->curr_slide_info);
- mmi_jmms_jdi_get_page_timer(g_jmms_context->msg_handle, page_index, &slide_time);
- slide_info->slide_prop.slide_time = slide_time / 1000;
- slide_info->slide_prop.text_font.italic = 0;
- slide_info->slide_prop.text_font.bold = 0;
- slide_info->slide_prop.text_font.size = MEDIUM_FONT;
- slide_info->slide_prop.text_color = g_jmms_color_RGB_list[COLOR_BLACK];
- mmi_jmms_get_region_list(page_index, &is_image_first);
- for (count = 0; count < media_count; count++)
- {
- switch (media_info_p->eMediaType)
- {
- case E_MEDIA_TEXT:
- slide_info->text_ID = media_info_p->uiMediaID;
- /* sandeep start to fix MAUI_00227858 */
- if(jc_tcslen((UI_character_type*)media_info_p->pMimeInfo->ContentData.pBuffer) < JMMS_COMPOSE_TEXT_LENGTH)
- {
- jc_tcscpy(
- (UI_character_type*) slide_info->edit_content_buffer,
- (UI_character_type*) media_info_p->pMimeInfo->ContentData.pBuffer);
- }
- else
- {
- jc_tcsncpy(
- (UI_character_type*) slide_info->edit_content_buffer,
- (UI_character_type*) media_info_p->pMimeInfo->ContentData.pBuffer,
- JMMS_COMPOSE_TEXT_LENGTH);
- }
- /* sandeep end to fix MAUI_00227858 */
- if (media_info_p->PresentationInfo.pTextAttributes != NULL)
- {
- slide_info->slide_prop.text_font.bold = media_info_p->PresentationInfo.pTextAttributes->bIsBold;
- slide_info->slide_prop.text_font.italic =
- media_info_p->PresentationInfo.pTextAttributes->bIsItalic;
- switch (media_info_p->PresentationInfo.pTextAttributes->uiFontSize)
- {
- case MMS_SIZE_SMALL:
- slide_info->slide_prop.text_font.size = SMALL_FONT;
- break;
- case MMS_SIZE_NORMAL:
- slide_info->slide_prop.text_font.size = MEDIUM_FONT;
- break;
- case MMS_SIZE_LARGE:
- slide_info->slide_prop.text_font.size = LARGE_FONT;
- break;
- }
- mmi_jmms_convert_hash_col_string_toU32((PS8) media_info_p->PresentationInfo.pTextAttributes->pFontColor, &slide_info->slide_prop.text_color, 16); /* deepali: put correct values. */
- }
- break;
- case E_MEDIA_IMAGE:
- slide_info->image_ID = media_info_p->uiMediaID;
- g_jmms_context->compose_context->is_image_first[page_index - 1] = is_image_first;
- if (media_info_p->pMimeInfo->ContentData.pFileName != NULL)
- {
- slide_info->img_info.pFileName =
- (PU8) media_info_p->pMimeInfo->ContentData.pFileName;
- }
- break;
- case E_MEDIA_AUDIO:
- slide_info->audio_ID = media_info_p->uiMediaID;
- break;
- case E_MEDIA_VIDEO:
- slide_info->video_ID = media_info_p->uiMediaID;
- g_jmms_context->compose_context->is_image_first[page_index - 1] = is_image_first;
- if (media_info_p->pMimeInfo->ContentData.pFileName != NULL)
- {
- slide_info->img_info.pFileName =
- (PU8) media_info_p->pMimeInfo->ContentData.pFileName;
- }
- break;
- }
- media_info_p = media_info_p->pNext;
- };
- }
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d %d", "After Set Values: Text Size of compose context and inline item is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.size, g_jmms_context->jmms_inline_items.text_settings_items.size_selected));
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d %d", "After Set Values: Italic Selection of compose context and inline item is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.italic, g_jmms_context->jmms_inline_items.text_settings_items.italic_selected));
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s %d %d", "After Set Values: Bold Selection of compose context and inline item is: ", g_jmms_context->compose_context->curr_slide_info.slide_prop.text_font.bold, g_jmms_context->jmms_inline_items.text_settings_items.bold_selected));
- return err_code;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_save_page_time
- * DESCRIPTION
- * set page time in message handle.
- * PARAMETERS
- * slide_time [IN]
- * RETURNS
- * void
- *****************************************************************************/
- JMMS_COMP_ERRCODE mmi_jmms_save_page_time(U32 slide_time)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE ret_code;
- JMMS_COMP_ERRCODE err_code;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ret_code = mmi_jmms_jdi_set_page_timer(
- g_jmms_context->msg_handle,
- g_jmms_context->compose_context->curr_page_index,
- slide_time * 1000);
- err_code = mmi_jmms_compose_handle_error(ret_code, 1);
- return err_code;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_set_text_attributes
- * DESCRIPTION
- * set text attributes
- * PARAMETERS
- * media_id [IN]
- * page_index [IN]
- * curr_slide_prop [?] [?]
- * RETURNS
- * void
- *****************************************************************************/
- JMMS_COMP_ERRCODE mmi_jmms_set_text_attributes(U32 media_id, U8 page_index, slide_prop_struct *curr_slide_prop)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE ret_code;
- JMMS_COMP_ERRCODE err_code;
- MEDIA_PRESENTATION_INFO media_presentation_p;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_jmms_jdi_get_presentation_info(g_jmms_context->msg_handle, page_index, media_id, &media_presentation_p);
- if (media_presentation_p.pTextAttributes == NULL)
- {
- media_presentation_p.pTextAttributes = (TEXT_ATTRIBUTES*) jdd_MemAlloc(sizeof(TEXT_ATTRIBUTES), sizeof(U8));
- if (media_presentation_p.pTextAttributes == NULL)
- {
- ret_code = JC_ERR_MEMORY_ALLOCATION;
- goto ERROR_HANDLE;
- }
- }
- if (curr_slide_prop->text_font.bold == 1)
- {
- media_presentation_p.pTextAttributes->bIsBold = E_TRUE;
- }
- else
- {
- media_presentation_p.pTextAttributes->bIsBold = E_FALSE;
- }
- if (curr_slide_prop->text_font.italic == 1)
- {
- media_presentation_p.pTextAttributes->bIsItalic = E_TRUE;
- }
- else
- {
- media_presentation_p.pTextAttributes->bIsItalic = E_FALSE;
- }
- if (media_presentation_p.pTextAttributes->pFontColor == NULL)
- {
- media_presentation_p.pTextAttributes->pFontColor =
- (JC_INT8*) jdd_MemAlloc((strlen("#rrggbb") + 1), sizeof(JC_INT8));
- if (media_presentation_p.pTextAttributes->pFontColor == NULL)
- {
- ret_code = JC_ERR_MEMORY_ALLOCATION;
- goto ERROR_HANDLE;
- }
- }
- mmi_jmms_convert_u32To_hash_col_string(
- curr_slide_prop->text_color,
- media_presentation_p.pTextAttributes->pFontColor);
- switch (curr_slide_prop->text_font.size)
- {
- case SMALL_FONT:
- media_presentation_p.pTextAttributes->uiFontSize = MMS_SIZE_SMALL;
- break;
- case LARGE_FONT:
- media_presentation_p.pTextAttributes->uiFontSize = MMS_SIZE_LARGE;
- break;
- case MEDIUM_FONT:
- media_presentation_p.pTextAttributes->uiFontSize = MMS_SIZE_NORMAL;
- break;
- }
- ret_code = mmi_jmms_jdi_set_media_presentation_info(
- g_jmms_context->msg_handle,
- page_index,
- media_id,
- &media_presentation_p);
- ERROR_HANDLE:
- err_code = mmi_jmms_compose_handle_error(ret_code, 0);
- return err_code;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_set_media_time
- * DESCRIPTION
- * set media time in message handle.
- * PARAMETERS
- * start_time [IN]
- * duration [IN]
- * media_id [IN]
- * page_index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- JMMS_COMP_ERRCODE mmi_jmms_set_media_time(U32 start_time, U32 duration, U32 media_id, U8 page_index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE ret_code;
- JMMS_COMP_ERRCODE err_code;
- MEDIA_TIMER media_timer_p;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- media_timer_p.uiBegin = start_time * 1000;
- media_timer_p.uiDuration = duration * 1000;
- ret_code = mmi_jmms_jdi_set_media_timer(g_jmms_context->msg_handle, page_index, media_id, media_timer_p);
- err_code = mmi_jmms_compose_handle_error(ret_code, 0);
- return err_code;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_get_media_time
- * DESCRIPTION
- * get media time in message handle.
- * PARAMETERS
- * start_time [?] [?]
- * duration [?] [?]
- * media_id [IN]
- * page_index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- JMMS_COMP_ERRCODE mmi_jmms_get_media_time(U32 *start_time, U32 *duration, U32 media_id, U8 page_index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE ret_code;
- JMMS_COMP_ERRCODE err_code;
- MEDIA_TIMER media_timer_p;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ret_code = mmi_jmms_jdi_get_media_timer(g_jmms_context->msg_handle, page_index, media_id, &media_timer_p);
- err_code = mmi_jmms_compose_handle_error(ret_code, 0);
- if (err_code == JMMS_COMP_OK)
- {
- *start_time = media_timer_p.uiBegin / 1000;
- *duration = media_timer_p.uiDuration / 1000;
- }
- return err_code;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_convert_u32To_hash_col_string
- * DESCRIPTION
- * Converts U32 value to Hash color string
- * PARAMETERS
- * ip_color [IN]
- * op_colstr [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jmms_convert_u32To_hash_col_string(U32 ip_color, PS8 op_colstr)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_INT8 temp_color_str[10];
- JC_INT8 color_list[3];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- color_list[0] = (U8) ((0xFF000000 & ip_color) >> 24);
- color_list[1] = (U8) ((0x00FF0000 & ip_color) >> 16);
- color_list[2] = (U8) ((0x0000FF00 & ip_color) >> 8);
- strcpy(op_colstr, "#");
- memset(temp_color_str, 0, 10);
- sprintf(temp_color_str, "%X", color_list[0]);
- if (strlen(temp_color_str) < 2)
- {
- sprintf(temp_color_str, "0%X", color_list[0]);
- }
- strncat(op_colstr, temp_color_str, 2);
- memset(temp_color_str, 0, 10);
- sprintf(temp_color_str, "%X", color_list[1]);
- if (strlen(temp_color_str) < 2)
- {
- sprintf(temp_color_str, "0%X", color_list[1]);
- }
- strncat(op_colstr, temp_color_str, 2);
- memset(temp_color_str, 0, 10);
- sprintf(temp_color_str, "%X", color_list[2]);
- if (strlen(temp_color_str) < 2)
- {
- sprintf(temp_color_str, "0%X", color_list[2]);
- }
- strncat(op_colstr, temp_color_str, 2);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_convert_hash_col_string_toU32
- * DESCRIPTION
- * Converts Hash color string to U32 value
- * PARAMETERS
- * ip_colstr [IN]
- * op_color [?] [?]
- * base [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jmms_convert_hash_col_string_toU32(PS8 ip_colstr, U32 *op_color, U8 base)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_INT8 tempStr[10];
- JC_INT32 color_list[3];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset(tempStr, 0, 10);
- jc_strncpy(tempStr, (ip_colstr + 1), 2);
- color_list[0] = (U8) jc_strtol(tempStr, NULL, base);
- memset(tempStr, 0, 10);
- jc_strncpy(tempStr, (ip_colstr + 3), 2);
- color_list[1] = (U8) jc_strtol(tempStr, NULL, base);
- memset(tempStr, 0, 10);
- jc_strncpy(tempStr, (ip_colstr + 5), 2);
- color_list[2] = (U8) jc_strtol(tempStr, NULL, base);
- *op_color = 0;
- *op_color |= 0x00000064;
- *op_color |= (((U32) color_list[0]) << 24);
- *op_color |= (((U32) color_list[1]) << 16);
- *op_color |= (((U32) color_list[2]) << 8);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_set_bg_color
- * DESCRIPTION