JMMSComposeUtils.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:174k
源码类别:
MTK
开发平台:
C/C++
- * set mms bg color in message handle.
- * PARAMETERS
- * bg_color [IN]
- * RETURNS
- * void
- *****************************************************************************/
- JMMS_COMP_ERRCODE mmi_jmms_set_bg_color(U32 bg_color)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_INT8 bg_color_str[10];
- U32 height, width;
- JC_RETCODE ret_code;
- JMMS_COMP_ERRCODE err_code;
- DeviceCharacteristics dev_ch = {0};
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- jdd_MMIGetDeviceCharacteristics(&dev_ch);
- height = dev_ch.uiRenderingWidth;
- width = dev_ch.uiRenderingHeight;
- mmi_jmms_convert_u32To_hash_col_string(bg_color, bg_color_str);
- ret_code = mmi_jmms_jdi_set_smil_root_layout(g_jmms_context->msg_handle, height, width, bg_color_str);
- err_code = mmi_jmms_compose_handle_error(ret_code, 0);
- return err_code;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_get_bg_color
- * DESCRIPTION
- * set mms bg color in message handle.
- * PARAMETERS
- * bg_color [?] [?]
- * RETURNS
- * void
- *****************************************************************************/
- JMMS_COMP_ERRCODE mmi_jmms_get_bg_color(JC_INT32 *bg_color)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_INT8 *bg_color_str;
- U32 height, width;
- JC_RETCODE ret_code;
- JMMS_COMP_ERRCODE err_code;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ret_code = mmi_jmms_jdi_get_smil_root_layout(g_jmms_context->msg_handle, &height, &width, &bg_color_str);
- err_code = mmi_jmms_compose_handle_error(ret_code, 0);
- if (err_code == JMMS_COMP_OK && bg_color_str != NULL)
- {
- *bg_color = GetColorValue(bg_color_str);
- if (*bg_color > 0)
- {
- *bg_color <<= 8;
- *bg_color |= 0x00000064;
- }
- }
- else
- {
- *bg_color = g_jmms_color_RGB_list[COLOR_WHITE];
- }
- return JMMS_COMP_OK;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_set_region_list
- * DESCRIPTION
- * set mms bg color in message handle.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- JMMS_COMP_ERRCODE mmi_jmms_set_region_list(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE ret_code = JC_OK;
- JMMS_COMP_ERRCODE err_code = JMMS_COMP_OK;
- REGION_LAYOUT region_layout1, region_layout2;
- DeviceCharacteristics dev_ch = {0};
- U8 size;
- JC_RECT display_rect;
- media_type_enum first_region_media = MEDIA_AUDIO;
- MEDIA_INFO *media_info_p;
- U8 media_count = 0, page_count = 0, temp_page_count;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_jmms_set_region_list"));
- region_layout1.pRegionName = NULL;
- region_layout2.pRegionName = NULL;
- /* Check that any media exists on slide other then audio */
- mmi_jmms_jdi_get_total_pages(g_jmms_context->msg_handle, &page_count);
- for(temp_page_count=1;(media_count==0 && temp_page_count <= page_count);temp_page_count++)
- {
- mmi_jmms_compose_get_media_list(temp_page_count, &media_info_p, &media_count, MMI_FALSE);
- if(media_count !=0 )
- {
- if (media_info_p != NULL)
- {
- first_region_media = media_info_p->eMediaType;
- if ( media_info_p->eMediaType == MEDIA_AUDIO && media_count > 1)
- {
- first_region_media = media_info_p->pNext->eMediaType;
- }
- }
- break;
- }
- }
- if ((media_count != 0 && first_region_media != MEDIA_AUDIO ) && temp_page_count >= g_jmms_context->compose_context->curr_page_index)
- {
- jdd_MMIGetDeviceCharacteristics(&dev_ch);
- display_rect.iLeft = dev_ch.uiLeftMargin;
- display_rect.iTop = dev_ch.uiTopMargin;
- /* Deepali: Here they want regions as rendering area, excluding scroll bar. */
- display_rect.uiHeight = dev_ch.uiRenderingHeight;
- display_rect.uiWidth = dev_ch.uiRenderingWidth;
- /* Now Template will always be Viewed in PORTRAIT mode */
- if (IsScreenPresent(SCR_ID_JMMS_TEMPLATES) ||(g_jmms_context->layout==CUSTOM_LAYOUT)|| (U8) mmi_jmms_compose_settings_layout() == (U8) E_MMS_LAYOUT_POTRAIT)
- {
- region_layout1.uiTop = display_rect.iTop;
- region_layout1.uiLeft = display_rect.iLeft;
- region_layout1.uiWidth = (JC_UINT32) (display_rect.uiWidth) - (2 * display_rect.iLeft);
- region_layout1.uiHeight =
- (JC_UINT32) ((display_rect.uiHeight - (2 * display_rect.iTop) -
- JMMS_VIEW_DEFAULT_MEDIA_SPACING) * 0.5);
- region_layout1.eFit = E_CONFIG_REGION_MEET;
- region_layout2.uiTop = region_layout1.uiHeight + JMMS_VIEW_DEFAULT_MEDIA_SPACING;
- region_layout2.uiLeft = display_rect.iLeft;
- region_layout2.uiWidth = (JC_UINT32) (display_rect.uiWidth) - (2 * display_rect.iLeft);
- region_layout2.uiHeight =
- (JC_UINT32) (display_rect.uiHeight - region_layout2.uiTop - display_rect.iTop);
- region_layout2.eFit = E_CONFIG_REGION_MEET;
- }
- else
- {
- region_layout1.uiTop = display_rect.iTop;
- region_layout1.uiLeft = display_rect.iLeft;
- region_layout1.uiWidth =
- (JC_UINT32) ((display_rect.uiWidth - (2 * display_rect.iLeft) -
- JMMS_VIEW_DEFAULT_MEDIA_SPACING) * 0.5);
- region_layout1.uiHeight = (JC_UINT32) ((display_rect.uiHeight - (2 * display_rect.iTop)) * 10);
- region_layout1.eFit = E_CONFIG_REGION_MEET;
- region_layout2.uiTop = display_rect.iTop;
- region_layout2.uiLeft =
- region_layout1.uiLeft + region_layout1.uiWidth + JMMS_VIEW_DEFAULT_MEDIA_SPACING;
- region_layout2.uiWidth =
- (JC_UINT32) (display_rect.uiWidth - region_layout2.uiLeft - display_rect.iLeft);
- region_layout2.uiHeight = (JC_UINT32) ((display_rect.uiHeight - (2 * display_rect.iTop)) * 10);
- region_layout2.eFit = E_CONFIG_REGION_MEET;
- }
- if ((g_jmms_context->compose_context->
- is_image_first[temp_page_count - 1] == 0) && first_region_media == MEDIA_TEXT)
- {
- /* Text is first */
- size = strlen(STRING_TEXT);
- region_layout1.pRegionName = (JC_CHAR*) jdd_MemAlloc(sizeof(JC_CHAR), size + 1);
- if (region_layout1.pRegionName == NULL)
- {
- ret_code = JC_ERR_MEMORY_ALLOCATION;
- goto ERROR_HANDLE;
- }
- AnsiiToUnicodeString((PS8)(region_layout1.pRegionName), (PS8) (STRING_TEXT));
- size = strlen(STRING_IMAGE);
- region_layout2.pRegionName = (JC_CHAR*) jdd_MemAlloc(sizeof(JC_CHAR), size + 1);
- if (region_layout2.pRegionName == NULL)
- {
- ret_code = JC_ERR_MEMORY_ALLOCATION;
- goto ERROR_HANDLE;
- }
- AnsiiToUnicodeString((PS8)(region_layout2.pRegionName), (PS8) (STRING_IMAGE));
- }
- else
- {
- /* Image/Video is first */
- size = strlen(STRING_IMAGE);
- region_layout1.pRegionName = (JC_CHAR*) jdd_MemAlloc(sizeof(JC_CHAR), size + 1);
- if (region_layout1.pRegionName == NULL)
- {
- ret_code = JC_ERR_MEMORY_ALLOCATION;
- goto ERROR_HANDLE;
- }
- AnsiiToUnicodeString((PS8)(region_layout1.pRegionName), (PS8) (STRING_IMAGE));
- size = strlen(STRING_TEXT);
- region_layout2.pRegionName = (JC_CHAR*) jdd_MemAlloc(sizeof(JC_CHAR), size + 1);
- if (region_layout2.pRegionName == NULL)
- {
- ret_code = JC_ERR_MEMORY_ALLOCATION;
- goto ERROR_HANDLE;
- }
- AnsiiToUnicodeString((PS8)(region_layout2.pRegionName), (PS8) (STRING_TEXT));
- }
- ret_code = mmi_jmms_jdi_add_smil_region_layout(g_jmms_context->msg_handle, ®ion_layout1);
- if (ret_code == JC_OK)
- {
- ret_code = mmi_jmms_jdi_add_smil_region_layout(g_jmms_context->msg_handle, ®ion_layout2);
- }
- }
- ERROR_HANDLE:
- err_code = mmi_jmms_compose_handle_error(ret_code, 0);
- if (region_layout1.pRegionName != NULL)
- {
- jdd_MemFree(region_layout1.pRegionName);
- region_layout1.pRegionName = NULL;
- }
- if (region_layout2.pRegionName != NULL)
- {
- jdd_MemFree(region_layout2.pRegionName);
- region_layout2.pRegionName = NULL;
- }
- return err_code;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_get_region_list
- * DESCRIPTION
- * get smil region list.
- * PARAMETERS
- * page_index [IN]
- * isImageFirst [?] [?]
- * RETURNS
- * void
- *****************************************************************************/
- JMMS_COMP_ERRCODE mmi_jmms_get_region_list(U8 page_index, U8 *isImageFirst)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE ret_code = JC_OK;
- S8 temp_string[25] = {0, };
- /* JMMS_COMP_ERRCODE err_code = JMMS_COMP_OK; */
- REGION_LAYOUT *region_layout1;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_jmms_get_region_list"));
- ret_code = mmi_jmms_jdi_get_smil_region_layout(g_jmms_context->msg_handle, ®ion_layout1);
- // if(ret_code == JC_OK)
- // ret_code = mmi_jmms_jdi_get_smil_region_layout(g_jmms_context->msg_handle,®ion_layout2);
- if (ret_code == JC_OK)
- {
- AnsiiToUnicodeString((PS8)(temp_string), (PS8) (STRING_IMAGE));
- if (pfnUnicodeStrcmp((S8*) region_layout1->pRegionName, (S8*) temp_string) == 0)
- {
- *isImageFirst = 1;
- }
- else
- {
- *isImageFirst = 0;
- }
- }
- else
- {
- *isImageFirst = 0;
- }
- /* err_code = mmi_jmms_compose_handle_error(ret_code, 0); */
- return JMMS_COMP_OK;
- }
- /* PMT VIKAS START 20060405 */
- //#ifdef __MMI_MMS_SIGNATURE__
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_insert_auto_signature
- * DESCRIPTION
- * insert the auto signature slide
- * PARAMETERS
- * void
- * a(?) [IN/OUT] Nil(?)
- * b(?) [IN] Nil(?)
- * RETURNS
- * JMMS_COMP_ERRCODE.(?)(?)
- *****************************************************************************/
- void mmi_jmms_insert_auto_signature(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 page_count;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_jmms_insert_auto_signature"));
- if (mmi_jmms_compose_settings_auto_sign_status() == E_ON &&
- ((g_jmms_context->store_context->current_folder_name == E_JMMS_INBOX &&
- mmi_jmms_is_fw_from_inbox() == MMI_FALSE) ||
- g_jmms_context->store_context->current_folder_name == E_JMMS_SENT ||
- g_jmms_context->store_context->current_folder_name == E_JMMS_WRITE_MMS ||
- g_jmms_context->store_context->current_folder_name == E_JMMS_TEMPLATES ||
- g_jmms_context->store_context->current_folder_name == E_JMMS_DRAFTS))
- {
- mmi_jmms_jdi_get_total_pages(g_jmms_context->msg_handle, &page_count);
- if (page_count < mmi_jmms_compose_settings_max_no_pages())
- {
- mmi_jmms_insert_auto_signature_slide(page_count);
- }
- else
- {
- DisplayPopup(
- (U8*) GetString(STR_ID_AUTO_SIGNATURE_ERROR_TOO_MANY_SLIDES),
- IMG_GLOBAL_WARNING,
- 1,
- JMMS_POPUP_TIME,
- (U8) WARNING_TONE);
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_compose_auto_signature_mms
- * DESCRIPTION
- * function of writing a new signature MMS
- * PARAMETERS
- * void
- * a(?) [IN/OUT] Nil(?)
- * b(?) [IN] Nil(?)
- * RETURNS
- * void
- *****************************************************************************/
- JMMS_COMP_ERRCODE mmi_jmms_compose_auto_signature_mms(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /* Deepali: use setting API's */
- JC_RETCODE ret_code = JC_OK;
- JMMS_COMP_ERRCODE err_code;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_jmms_compose_auto_signature_mms"));
- 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);
- }
- err_code = mmi_jmms_compose_handle_error(ret_code, 0);
- return err_code;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_insert_auto_signature_slide
- * DESCRIPTION
- * insert the auto signature slide
- * PARAMETERS
- * page_count [IN]
- * a(?) [IN/OUT] Nil(?)
- * b(?) [IN] Nil(?)
- * RETURNS
- * JMMS_COMP_ERRCODE.
- *****************************************************************************/
- JMMS_COMP_ERRCODE mmi_jmms_insert_auto_signature_slide(U8 page_count)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_RETCODE ret_code = JC_OK;
- U8 *orig_edit_content_buffer;
- JMMS_COMP_ERRCODE err_code = JMMS_COMP_OK;
- stFontAttribute text_font;
- MMI_BOOL context_to_free = MMI_FALSE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_jmms_insert_auto_signature_slide"));
- text_font.italic = 0;
- text_font.bold = 0;
- text_font.size = MEDIUM_FONT;
- if (g_jmms_context->compose_context == NULL)
- {
- context_to_free = MMI_TRUE;
- g_jmms_context->compose_context =
- (jmms_compose_context_struct*) jdd_MemAlloc(sizeof(jmms_compose_context_struct), 1);
- if (g_jmms_context->compose_context == NULL)
- {
- DisplayPopup((PU8) GetString(STR_ID_JMMS_OUT_OF_MEMORY), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE);
- return err_code;
- }
- }
- orig_edit_content_buffer =
- (U8 *) jdd_MemAlloc(sizeof(U8), (JMMS_COMPOSE_TEXT_LENGTH + 1) * ENCODING_LENGTH);
- memcpy(
- orig_edit_content_buffer,
- g_jmms_context->compose_context->curr_slide_info.edit_content_buffer,
- (JMMS_COMPOSE_TEXT_LENGTH + 1) * ENCODING_LENGTH);
- if (page_count == 0)
- {
- if (JMMS_COMP_OK == mmi_jmms_compose_auto_signature_mms())
- {
- g_jmms_context->compose_context->mms_bg_color = g_jmms_color_RGB_list[COLOR_WHITE];
- /* PMT HIMANSHU START 20060425 */
- /* Added by Deepali for root layout. */
- err_code = mmi_jmms_set_bg_color(g_jmms_context->compose_context->mms_bg_color);
- if ((err_code == JMMS_COMP_OUT_MEMORY) || (err_code == JMMS_COMP_FAIL))
- {
- mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
- return JMMS_COMP_OUT_MEMORY;
- }
- /* PMT HIMANSHU END 20060425 */
- ret_code = mmi_jmms_jdi_add_page(g_jmms_context->msg_handle, (U8) (page_count + 1)); /* mmi_jmms_compose_insert_slide(); */
- err_code = mmi_jmms_compose_handle_error(ret_code, 1);
- if ((err_code == JMMS_COMP_OUT_MEMORY) || (err_code == JMMS_COMP_FAIL))
- {
- mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
- return JMMS_COMP_OUT_MEMORY;
- }
- else
- {
- /* Added By RAJ KUMAR GUPTA on Augest 26, 2006 */
- /* Changes are made to add the default slide time with Signature slide */
- U32 slide_time = 0;
- g_jmms_context->compose_context->curr_page_index = page_count + 1;
- 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;
- }
- g_jmms_context->auto_signature_added = MMI_TRUE;
- pfnUnicodeStrcpy(
- (S8*) g_jmms_context->compose_context->curr_slide_info.edit_content_buffer,
- (S8*) g_jmms_context->nvram_compose_settings.auto_signature_content);
- g_jmms_context->disable_warning_popup = 1;
- mmi_jmms_compose_add_text((U8) (page_count + 1), &(text_font), g_jmms_color_RGB_list[COLOR_BLACK],0);
- g_jmms_context->disable_warning_popup = 0;
- }
- }
- }
- else
- {
- ret_code = mmi_jmms_jdi_add_page(g_jmms_context->msg_handle, (U8) (page_count + 1));
- err_code = mmi_jmms_compose_handle_error(ret_code, 1);
- if ((err_code == JMMS_COMP_OUT_MEMORY) || (err_code == JMMS_COMP_FAIL))
- {
- mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
- return JMMS_COMP_OUT_MEMORY;
- }
- else
- {
- /* Added By RAJ KUMAR GUPTA on Augest 26, 2006 */
- /* Changes are made to add the default slide time with Signature slide */
- U32 slide_time = 0;
- g_jmms_context->compose_context->curr_page_index = page_count + 1;
- 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;
- }
- g_jmms_context->auto_signature_added = MMI_TRUE;
- pfnUnicodeStrcpy(
- (S8*) g_jmms_context->compose_context->curr_slide_info.edit_content_buffer,
- (S8*) g_jmms_context->nvram_compose_settings.auto_signature_content);
- g_jmms_context->disable_warning_popup = 1;
- mmi_jmms_compose_add_text((U8) (page_count + 1), &(text_font), g_jmms_color_RGB_list[COLOR_BLACK],0);
- g_jmms_context->disable_warning_popup = 0;
- }
- }
- memcpy(
- g_jmms_context->compose_context->curr_slide_info.edit_content_buffer,
- orig_edit_content_buffer,
- (JMMS_COMPOSE_TEXT_LENGTH + 1) * ENCODING_LENGTH);
- jdd_MemFree(orig_edit_content_buffer);
- if (context_to_free == MMI_TRUE)
- {
- context_to_free = MMI_FALSE;
- if (g_jmms_context->compose_context != NULL)
- {
- jdd_MemFree(g_jmms_context->compose_context);
- g_jmms_context->compose_context = NULL;
- }
- }
- return err_code;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_del_inserted_auto_signature_slide
- * DESCRIPTION
- * delete the auto signature slide
- * PARAMETERS
- * void
- * a(?) [IN/OUT] Nil(?)
- * b(?) [IN] Nil(?)
- * RETURNS
- * JMMS_COMP_ERRCODE.
- *****************************************************************************/
- JMMS_COMP_ERRCODE mmi_jmms_del_inserted_auto_signature_slide(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MEDIA_INFO *media_info_p;
- U8 media_count, page_count = 0;
- JMMS_COMP_ERRCODE err_code = JC_OK;
- MMI_BOOL is_sig_existed = E_FALSE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_jmms_del_inserted_auto_signature_slide"));
- if (mmi_jmms_compose_settings_auto_sign_status() == E_ON && g_jmms_context->auto_signature_added == MMI_TRUE &&
- ((g_jmms_context->store_context->current_folder_name == E_JMMS_INBOX &&
- mmi_jmms_is_fw_from_inbox() == MMI_FALSE) ||
- g_jmms_context->store_context->current_folder_name == E_JMMS_WRITE_MMS ||
- g_jmms_context->store_context->current_folder_name == E_JMMS_TEMPLATES ||
- g_jmms_context->store_context->current_folder_name == E_JMMS_DRAFTS))
- {
- /* Check that any slide exists */
- mmi_jmms_jdi_get_total_pages(g_jmms_context->msg_handle, &page_count);
- if (page_count != 0)
- {
- /* Check if the last slide is signature */
- err_code = mmi_jmms_compose_get_media_list(page_count, &media_info_p, &media_count, MMI_FALSE);
- if (media_count == 1 && media_info_p->eMediaType == E_MEDIA_TEXT)
- {
- if (pfnUnicodeStrcmp
- ((S8*) (UI_character_type*) media_info_p->pMimeInfo->ContentData.pBuffer,
- (S8*) g_jmms_context->nvram_compose_settings.auto_signature_content) == 0)
- {
- is_sig_existed = TRUE;
- }
- }
- /* Delete signature slide */
- if (is_sig_existed)
- {
- /* Free all data in the slide */
- mmi_jmms_compose_delete_page(page_count);
- /* g_jmms_context->compose_context will be NULL in case of Drafts->Option->Send */
- if(g_jmms_context->compose_context)
- {
- g_jmms_context->compose_context->curr_page_index--;
- }
- }
- }
- g_jmms_context->auto_signature_added = MMI_FALSE;
- }
- return err_code;
- }
- //#endif /* __MMI_MMS_SIGNATURE__ */
- //PMT VIKAS END 20060405
- //PMT VIKAS START 20060403
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_get_mms_media_type_from_file
- * DESCRIPTION
- * returns the content type of media file.
- * PARAMETERS
- * file_name_p [?] [?]
- * a(?) [IN/OUT] Nil(?)
- * b(?) [IN] Nil(?)
- * RETURNS
- * media_type_enum.
- *****************************************************************************/
- media_type_enum mmi_jmms_get_mms_media_type_from_file(JC_CHAR *file_name_p)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- media_type_enum media_type_p = MEDIA_OTHER;
- U8 i;
- JC_CHAR *temp_file_name = NULL;
- S8 media_string_ansi[5][10] = { "text", "image", "audio", "video", 0};
- applib_mime_type_struct *mime_info = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_jmms_get_mms_media_type_from_file"));
- if (file_name_p)
- {
- U32 iIndex = 0;
- iIndex = jdi_UtilsLastIndexOfTchar('.', file_name_p, jc_tcslen(file_name_p) - 1);
- if (iIndex > 0 && jc_tcslen(file_name_p) != (U32) iIndex)
- {
- U16 uhCounter = 0;
- iIndex++;
- temp_file_name =
- (JC_CHAR*) jdd_MemAlloc(pfnUnicodeStrlen((S8*) file_name_p) * ENCODING_LENGTH + ENCODING_LENGTH, 1);
- if (temp_file_name == NULL)
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "OUT OF MEMORY in file name generation"));
- DisplayPopup(
- (PU8) GetString(STR_ID_JMMS_OUT_OF_MEMORY),
- IMG_GLOBAL_ERROR,
- 1,
- JMMS_POPUP_TIME,
- ERROR_TONE);
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "media Type = %d", media_type_p));
- return media_type_p;
- }
- pfnUnicodeStrcpy((S8*) temp_file_name, (S8*) file_name_p);
- temp_file_name = jdi_UtilsTcsUpperToLower((JC_CHAR*) temp_file_name);
- while (*(g_content_type_list[uhCounter][0]) != 0)
- {
- if (jdi_UtilsTcsStrCmp(temp_file_name + iIndex, g_content_type_list[uhCounter][1]) == 0)
- {
- for (i = 0; i < MEDIA_OTHER; i++)
- {
- if (strncmp
- (media_string_ansi[i], g_content_type_list[uhCounter][0],
- strlen((PS8) media_string_ansi[i])) == 0)
- {
- media_type_p = i;
- if (temp_file_name != NULL)
- {
- jdd_MemFree(temp_file_name);
- temp_file_name = NULL;
- }
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "media Type = %d", media_type_p));
- return media_type_p;
- }
- }
- }
- uhCounter++;
- }
- }
- }
- if (temp_file_name != NULL)
- {
- jdd_MemFree(temp_file_name);
- temp_file_name = NULL;
- }
- if (mime_get_extension(file_name_p) != NULL)
- {
- mime_info = mime_get_file_type(file_name_p);
- }
- if (mime_info != NULL)
- {
- switch (mime_info->mime_type)
- {
- case MIME_TYPE_IMAGE:
- #if defined(SVG_SUPPORT)
- if(mime_info->mime_subtype == MIME_SUBTYPE_SVG)
- {
- media_type_p = MEDIA_OTHER;
- }
- else
- #endif
- media_type_p = MEDIA_IMAGE;
- break;
- case MIME_TYPE_AUDIO:
- media_type_p = MEDIA_AUDIO;
- break;
- case MIME_TYPE_VIDEO:
- media_type_p = MEDIA_VIDEO;
- break;
- case MIME_TYPE_TEXT:
- media_type_p = MEDIA_TEXT;
- break;
- }
- }
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "media Type = %d", media_type_p));
- return media_type_p;
- }
- /*Dilip Start 14th sept for slide time issue*/
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_save_post_entry_edit_content_slide_timing
- * DESCRIPTION
- * fn check the slide timings after user return from Media timing setting and try to reduce slide time.
- * We are setting as custom if media start time is made greater than equal to slide time and maximum is set for that media
- * PARAMETERS
- * void
- * a(?) [IN/OUT] Nil(?)
- * b(?) [IN] Nil(?)
- * RETURNS
- * void
- *****************************************************************************/
- JMMS_COMP_ERRCODE mmi_jmms_save_post_entry_edit_content_slide_timing(U32 slide_time)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JMMS_COMP_ERRCODE err_code = JMMS_COMP_OK;
- U32 start_time_text,start_time_image,start_time_audio,start_time_video;
- U32 text_duration,image_duration,audio_duration,video_duration;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if(slide_time==0)
- return err_code;
- if(g_jmms_context->compose_context->curr_slide_info.text_ID > 0)
- {
- err_code = mmi_jmms_get_media_time(
- &start_time_text,
- &text_duration,
- g_jmms_context->compose_context->curr_slide_info.text_ID,
- g_jmms_context->compose_context->curr_page_index);
- if(err_code == JMMS_COMP_OK)
- {
- if(start_time_text >= slide_time)
- {
- return -1;
- }
- }
- }
- if(g_jmms_context->compose_context->curr_slide_info.image_ID > 0)
- {
- err_code = mmi_jmms_get_media_time(
- &start_time_image,
- &image_duration,
- g_jmms_context->compose_context->curr_slide_info.image_ID,
- g_jmms_context->compose_context->curr_page_index);
- if(err_code == JMMS_COMP_OK)
- {
- if(start_time_image >= slide_time)
- {
- return -1;
- }
- }
- }
- if(g_jmms_context->compose_context->curr_slide_info.audio_ID > 0)
- {
- err_code = mmi_jmms_get_media_time(
- &start_time_audio,
- &audio_duration,
- g_jmms_context->compose_context->curr_slide_info.audio_ID,
- g_jmms_context->compose_context->curr_page_index);
- if(err_code == JMMS_COMP_OK)
- {
- if(start_time_audio >= slide_time)
- {
- return -1;
- }
- }
- }
- if(g_jmms_context->compose_context->curr_slide_info.video_ID > 0)
- {
- err_code = mmi_jmms_get_media_time(
- &start_time_video,
- &video_duration,
- g_jmms_context->compose_context->curr_slide_info.video_ID,
- g_jmms_context->compose_context->curr_page_index);
- if(err_code == JMMS_COMP_OK)
- {
- if(start_time_video >= slide_time)
- {
- return -1;
- }
- }
- }
- return err_code;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_create_mms_for_file
- * DESCRIPTION
- * Checks whether file need to be added as DRM fwd-lock
- * PARAMETERS
- * content_source [?] [?]
- * a(?) [IN/OUT] Nil(?)
- * b(?) [IN] JC_CHAR*(?)
- * RETURNS
- * void
- *****************************************************************************/
- static U8 g_media_type;
- static JC_CHAR *g_content_file_name;
- void mmi_jmms_create_mms_for_file(JC_CHAR *content_source)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 media_type = 0;
- JMMS_COMP_ERRCODE err_code = JMMS_COMP_OK;
- #ifdef __MMI_VIDEO_PLAYER__
- MDI_RESULT result_video = 0;
- #endif
- MMI_BOOL result_media = MMI_TRUE;
- GDI_RESULT image_result;
- S32 audio_result = 0;
- S32 img_widthv = 0, img_heightv = 0, audio_du;
- /* HIMANSHU 05122006 START */
- JC_CHAR *content_file_name = content_source;
- #ifdef __MMI_MMS_MEGA_PIXEL_SUPPORT__
- JC_CHAR *dest_fname = NULL;
- U32 resize_result = 0;
- #endif /* __MMI_MMS_MEGA_PIXEL_SUPPORT__ */
- /* HIMANSHU 05122006 END */
- #ifdef __DRM_SUPPORT__
- JC_BOOLEAN is_separate_DRM = E_FALSE;
- #endif
- U32 media_size = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_create_mms_for_file"));
- mmi_jmms_reset_fw_flag_of_message();
- is_add_media_as_drm = MMI_FALSE;
- if(g_jmms_context->init_done == JMMS_READY_WITHOUT_STORE)
- {
- DisplayPopup((U8*) GetString(STR_ID_JMMS_MEMORY_FULL), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "JMMS: Store is not ready"));
- return;
- }
- mmi_jmms_init_msg_context_struct(); /* this will different for different ways */
- if (g_jmms_context->compose_context == NULL)
- {
- g_jmms_context->compose_context =
- (jmms_compose_context_struct*) jdd_MemAlloc(sizeof(jmms_compose_context_struct), 1);
- if (g_jmms_context->compose_context == NULL)
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "OUT OF MEMORY: Fail to create compose Context"));
- DisplayPopup((PU8) GetString(STR_ID_JMMS_OUT_OF_MEMORY), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE);
- goto error;
- }
- }
- media_type = mmi_jmms_get_mms_media_type_from_file(content_file_name);
- #ifdef __DRM_SUPPORT__
- if ((is_separate_DRM = jMMS_is_sep_delivery_content((JC_CHAR*) content_file_name)) == E_FALSE)
- #endif
- {
- #ifdef __MMI_VIDEO_PLAYER__
- if(media_type == MEDIA_VIDEO)
- {
- result_video = mmi_jdd_videoapp_get_video_file_size_info((S8*) content_file_name, (JC_UINT32*)&img_widthv, (JC_UINT32*)&img_heightv);
- if(result_video == MDI_RES_VDOPLY_ERR_OPEN_FILE_FAILED)
- {
- result_media = MMI_FALSE;
- }
- }
- #endif
- if(media_type == MEDIA_IMAGE)
- {
- image_result = gdi_image_get_dimension_file((S8*) content_file_name, &img_widthv, &img_heightv);
- if(image_result != GDI_SUCCEED || (img_widthv * img_heightv) == 0)
- {
- result_media = MMI_FALSE;
- }
- }
- if (media_type == MEDIA_AUDIO)
- {
- audio_result = mdi_audio_get_duration((S8*) content_source,(U32*) &audio_du); // compiler warning removal
- if (audio_result != GDI_SUCCEED)
- {
- result_media = MMI_FALSE;
- }
- }
- if (result_media == MMI_FALSE)
- {
- DisplayPopup((PU8) GetString(STR_ID_JMMS_CORRUPTED_MEDIA_FILE), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE);
- goto error;
- }
- }
- if ((media_type == MEDIA_VIDEO || media_type == MEDIA_AUDIO) && mmi_jmms_selected_media_valid_size_check_for_mms((S8*) content_file_name, MMI_FALSE, &media_size, E_FALSE) != E_TRUE)
- {
- goto error;
- }
- else if ((media_type == MEDIA_IMAGE) && mmi_jmms_selected_media_valid_size_check_for_mms((S8*) content_file_name, MMI_FALSE, &media_size, E_TRUE) != E_TRUE)
- {
- goto error;
- }
- /* Himanshu Fix PMTSW00006527 START */
- if ((media_type == MEDIA_IMAGE) && (mmi_jmms_check_for_image_size_and_resolution((S8*)content_file_name, img_widthv, img_heightv, media_size) != E_TRUE))
- {
- goto error;
- }
- /* Himanshu Fix PMTSW00006527 END */
- /* HIMANSHU 05122006 START */
- #ifdef __MMI_MMS_MEGA_PIXEL_SUPPORT__
- #ifdef __DRM_SUPPORT__
- if ((is_separate_DRM == E_FALSE) && (media_type == MEDIA_IMAGE))
- #else
- if (media_type == MEDIA_IMAGE)
- #endif
- {
- /* Check if image resizing needs to be done. */
- resize_result = check_for_image_resize(content_file_name, &dest_fname);
- if (resize_result == JMMS_IMAGE_RESIZE_SUCCEED)
- {
- content_file_name = dest_fname;
- }
- else if (resize_result == JMMS_IMAGE_RESIZE_UNCHANGED)
- {
- /* content_file_name = content_source; */
- }
- else
- {
- goto error;
- }
- }
- #endif /* __MMI_MMS_MEGA_PIXEL_SUPPORT__ */
- /* HIMANSHU 05122006 END */
- g_media_type = media_type;
- g_content_file_name = jdi_UtilsTcsDup(content_file_name);
- if (g_content_file_name == NULL)
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "OUT OF MEMORY: Fail to create compose Context"));
- DisplayPopup((PU8) GetString(STR_ID_JMMS_OUT_OF_MEMORY), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE);
- goto error;
- }
- #ifdef __DRM_SUPPORT__
- if (mmi_jmms_is_compose_add_as_drm(content_source) && !jMMS_is_sep_delivery_content(content_source))
- {
- mmi_jmms_confirm_add_drm_media(mmi_jmms_fm_fwd_file_to_mms);
- goto error;
- }
- else
- #endif
- {
- mmi_jmms_fm_fwd_file_to_mms();
- }
- error:
- /* HIMANSHU 05122006 START */
- #ifdef __MMI_MMS_MEGA_PIXEL_SUPPORT__
- if (dest_fname != NULL)
- {
- jdd_MemFree(dest_fname);
- dest_fname = NULL;
- }
- DeleteScreenIfPresent(SCR_ID_JMMS_IMAGE_RESIZE_TRANSITION);
- #endif /* __MMI_MMS_MEGA_PIXEL_SUPPORT__ */
- /* HIMANSHU 05122006 END */
- return;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_fm_fwd_file_to_mms
- * DESCRIPTION
- * Add the file content to MMS according to their Media type.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jmms_fm_fwd_file_to_mms(void)
- {
- JMMS_COMP_ERRCODE err_code = JMMS_COMP_OK;
- ClearAllKeyHandler();
- g_jmms_context->g_use_local_send_setings = 0;
- mmi_jmms_fill_mms_sending_settings();
- g_jmms_context->store_context->current_folder_name = E_JMMS_WRITE_MMS;
- g_jmms_context->compose_context->curr_page_index = 0;
- if (JMMS_COMP_OK == mmi_jmms_compose_new_mms())
- {
- g_jmms_context->compose_context->mms_bg_color = g_jmms_color_RGB_list[COLOR_WHITE];
- err_code = mmi_jmms_set_bg_color(g_jmms_context->compose_context->mms_bg_color);
- err_code = mmi_jmms_compose_insert_slide();
- if ((err_code == JMMS_COMP_OUT_MEMORY) || (err_code == JMMS_COMP_FAIL))
- {
- mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
- jdd_MemFree(g_content_file_name);
- g_content_file_name = NULL;
- return;
- }
- else
- {
- switch (g_media_type)
- {
- case MEDIA_IMAGE:
- err_code = mmi_jmms_compose_add_media(
- g_content_file_name,
- E_MEDIA_IMAGE,
- 0,
- g_jmms_context->compose_context->curr_page_index);
- break;
- case MEDIA_AUDIO:
- err_code = mmi_jmms_compose_add_media(
- g_content_file_name,
- E_MEDIA_AUDIO,
- 0,
- g_jmms_context->compose_context->curr_page_index);
- break;
- case MEDIA_VIDEO:
- err_code = mmi_jmms_compose_add_media(
- g_content_file_name,
- E_MEDIA_VIDEO,
- 0,
- g_jmms_context->compose_context->curr_page_index);
- break;
- case MEDIA_OTHER:
- default:
- err_code = mmi_jmms_compose_add_media(g_content_file_name, E_MEDIA_OTHERS, E_TRUE, 0);
- mmi_jmms_compose_delete_page(g_jmms_context->compose_context->curr_page_index);
- g_jmms_context->compose_context->curr_page_index--;
- break;
- }
- }
- }
- if (err_code == JMMS_COMP_OK || err_code == JMMS_COMP_POPUP_OK)
- {
- /*Dilip start 26 aug 06 to overcome 200KB size file acting restricted mode media instead of warning mode*/
- if (g_media_type == E_MEDIA_IMAGE || g_media_type == E_MEDIA_VIDEO)
- {
- /*Dilip end 26 aug 06 to overcome 200KB size file acting restricted mode media instead of warning mode*/
- g_jmms_context->compose_context->curr_slide_info.img_info.custom_img_display = 1;
- if (pfnUnicodeStrlen((S8*) g_jmms_context->compose_context->curr_slide_info.edit_content_buffer) == 0)
- {
- g_jmms_context->compose_context->is_image_first[g_jmms_context->compose_context->curr_page_index - 1] =
- 1;
- }
- else
- {
- g_jmms_context->compose_context->is_image_first[g_jmms_context->compose_context->curr_page_index - 1] =
- 0;
- }
- }
- g_jmms_context->g_write_mms_right_soft_key = STR_GLOBAL_DONE;
- if (err_code == JMMS_COMP_POPUP_OK)
- {
- mmi_jmms_entry_write_message_screen_in_history();
- }
- else
- {
- mmi_jmms_entry_write_message_screen();
- }
- }
- else
- {
- mmi_jmms_deinit_mms_context(g_jmms_context);
- }
- if(g_content_file_name)
- {
- jdd_MemFree(g_content_file_name);
- g_content_file_name = NULL;
- }
- }
- /* HIMANSHU 05122006 START */
- #ifdef __MMI_MMS_MEGA_PIXEL_SUPPORT__
- /*****************************************************************************
- * FUNCTION
- * check_for_image_resize
- * DESCRIPTION
- * If the image resizing is being set to TRUE then it calls function to resize the
- * image.
- * tries to resize the image.
- * PARAMETERS
- * content_source [IN]
- * dest_fname [OUT]
- * RETURNS
- * JMMS_IMAGE_RESIZE_FAILED if image can't be resized
- * JMMS_IMAGE_RESIZE_UNCHANGED if iamge original size is less than the image resize settings
- * JMMS_IMAGE_RESIZE_SUCCEED otherwise.
- *****************************************************************************/
- S16 check_for_image_resize(JC_CHAR *content_source, JC_CHAR **dest_fname)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 image_resize_option = E_IMAGE_RESIZE_OFF;
- S32 resize_width = 0;
- S32 resize_height = 0;
- JC_RETCODE ret_code = JC_OK;
- JC_CHAR *temp_file = NULL;
- S16 resize_result = JMMS_IMAGE_RESIZE_UNCHANGED;
- JDD_FSHANDLE fs_handle = NULL;
- JDD_FILE fh = NULL;
- GDI_RESULT gdi_ret = GDI_FAILED;
- S32 img_width = 0, img_height = 0;
- S8 name[40] = {0, };
- kal_uint32 unique_value = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside check_for_image_resize"));
- image_resize_option = g_jmms_context->nvram_compose_settings.image_resize_option;
- if (image_resize_option != E_IMAGE_RESIZE_OFF)
- {
- switch (image_resize_option)
- {
- case E_IMAGE_RESIZE_160x120:
- resize_width = 160;
- resize_height = 120;
- break;
- case E_IMAGE_RESIZE_320x240:
- resize_width = 320;
- resize_height = 240;
- break;
- case E_IMAGE_RESIZE_640x480:
- resize_width = 640;
- resize_height = 480;
- break;
- default:
- ASSERT(0);
- }
- gdi_ret = gdi_image_get_dimension_file((PS8) content_source, &img_width, &img_height);
- if (img_width > resize_width || img_height > resize_height)
- {
- ret_code = jdd_FSInitialize(&fs_handle);
- if (ret_code != JC_OK)
- {
- /* return JMMS_IMAGE_RESIZE_FAILED; */
- resize_result = JMMS_IMAGE_RESIZE_FAILED;
- goto END;
- }
- /* Himanshu Fix PMTSW00006574 START */
- /* Creation of @mms\temp\resize folder */
- AnsiiToUnicodeString(name, "@mms\temp\resize\");
- fh = jdd_FSOpen(fs_handle, (U16*) name, E_OPEN_READ_MODE);
- if (fh == NULL) /* Folder Does Not Exist */
- {
- jdd_FSMakeDir(fs_handle, (U16*) name);
- }
- else
- {
- jdd_FSClose(fh);
- }
- kal_get_time(&unique_value);
- sprintf(name, "@mms\temp\resize\img%d.%s", unique_value, "jpg");
- jdi_UtilsCharToTchar((JC_CHAR **) & (temp_file), name);
- /* Himanshu Fix PMTSW00006574 END */
- *dest_fname = (JC_CHAR*) jdd_FSFileNameTranslate(fs_handle, temp_file);
- if (*dest_fname == NULL)
- {
- /* return JMMS_IMAGE_RESIZE_FAILED; */
- resize_result = JMMS_IMAGE_RESIZE_FAILED;
- goto END;
- }
- mmi_jmms_ext_display_image_animation();
- resize_result = mmi_jmms_ext_image_resizing(content_source, *dest_fname, resize_width, resize_height);
- //jdd_MemFree(temp_file);
- //jdd_FSDeinitialize(fs_handle);
- switch (resize_result)
- {
- case JMMS_IMAGE_RESIZE_UNCHANGED:
- case JMMS_IMAGE_RESIZE_SUCCEED:
- ClearKeyEvents(); /* Flush all the Key Events */
- break;
- case JMMS_IMAGE_RESIZING_FAILED_IN_GDI_ENCODER_ERR_DISK_FULL:
- DisplayPopup(
- (PU8) GetString(STR_ID_JMMS_STORAGE_FULL),
- IMG_GLOBAL_ERROR,
- 1,
- JMMS_POPUP_TIME,
- ERROR_TONE);
- /* GoBackHistory(); */
- break;
- case JMMS_IMAGE_RESIZING_FAILED_IN_INSUFFICIENT_DRAWING_BUF:
- case JMMS_IMAGE_RESIZING_FAILED_IN_NO_QUOTA:
- DisplayPopup(
- (PU8) GetString(STR_ID_JMMS_FAILED_RESOURCES_EXHAUSTED),
- IMG_GLOBAL_ERROR,
- 1,
- JMMS_POPUP_TIME,
- ERROR_TONE);
- /* GoBackHistory(); */
- break;
- case JMMS_IMAGE_RESIZING_FAILED_IN_UNKNOWN_DIMENSION:
- DisplayPopup(
- (PU8) GetString(STR_ID_JMMS_CORRUPTED_MEDIA_FILE),
- IMG_GLOBAL_ERROR,
- 1,
- JMMS_POPUP_TIME,
- ERROR_TONE);
- /* GoBackHistory(); */
- break;
- case JMMS_IMAGE_RESIZING_FAILED_IN_GDI_FAILED:
- case JMMS_IMAGE_RESIZING_FAILED_IN_GDI_ENCODER_ERR_NO_DISK:
- case JMMS_IMAGE_RESIZING_FAILED_IN_GDI_ENCODER_ERR_WRITE_PROTECTION:
- default:
- DisplayPopup(
- (PU8) GetString(STR_ID_JMMS_IMAGE_RESIZE_FAILED),
- IMG_GLOBAL_ERROR,
- 1,
- JMMS_POPUP_TIME,
- ERROR_TONE);
- /* GoBackHistory(); */
- break;
- }
- }
- }
- END:
- if (temp_file != NULL)
- {
- jdd_MemFree(temp_file);
- }
- if (fs_handle != NULL)
- {
- jdd_FSDeinitialize(fs_handle);
- }
- return resize_result;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_ext_display_image_animation
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jmms_ext_display_image_animation(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- resize_animation_disable_status = RESIZE_ANIMATION_DISABLE_ON;
- mmi_jmms_display_resize_image_animation();
- resize_animation_disable_status = RESIZE_ANIMATION_DISABLE_OFF;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_display_resize_image_animation
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jmms_display_resize_image_animation(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (IsScreenPresent(SCR_ID_JMMS_IMAGE_RESIZE_TRANSITION))
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, " %s(%d) DisplayImageTransitionAnimation() - already existn", __FILE__, __LINE__));
- return;
- }
- PRINT_INFORMATION_2((MMI_TRACE_INFO, " %s(%d) DisplayImageTransitionAnimation()n", __FILE__, __LINE__));
- mmi_jmms_entry_resize_image_animation();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_entry_resize_image_animation
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jmms_entry_resize_image_animation(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- EntryNewScreen(SCR_ID_JMMS_IMAGE_RESIZE_TRANSITION, NULL, mmi_jmms_entry_resize_image_animation, NULL);
- /* draw the blank softkey if no softkey button */
- show_softkey_background();
- ShowCategory66Screen(
- STR_MMS_MENUENTRY,
- GetRootTitleIcon(MAIN_MENU_MESSAGES_MENUID),
- 0,
- 0,
- 0,
- 0,
- (PU8) GetString(STR_ID_SETTINGS_IMAGE_RESIZE),
- SAT_WAIT_IMAGE_ID,
- 0);
- ClearAllKeyHandler(); /* End key is still valid */
- if (resize_animation_disable_status == RESIZE_ANIMATION_DISABLE_ON)
- {
- ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_ext_image_resizing
- * DESCRIPTION
- * This function does the resizing of image.
- * PARAMETERS
- * source_file [IN]
- * dest_file [IN]
- * resize_width [IN]
- * resize_height [IN]
- * RETURNS
- * JMMS_IMAGE_RESIZE_FAILED if image can't be resized
- * JMMS_IMAGE_RESIZE_UNCHANGED if iamge original size is less than the image resize settings
- * JMMS_IMAGE_RESIZE_SUCCEED otherwise.
- *****************************************************************************/
- S16 mmi_jmms_ext_image_resizing(JC_CHAR *source_file, JC_CHAR *dest_file, S32 resize_width, S32 resize_height)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 img_width = 0, img_height = 0;
- S32 temp_width = 0, temp_height = 0;
- GDI_RESULT gdi_ret = GDI_FAILED;
- S32 buf_size = 0;
- U8 *buf_ptr;
- S16 ret;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ASSERT(source_file != NULL);
- ASSERT(dest_file != NULL);
- PRINT_INFORMATION_2((MMI_TRACE_INFO, " %s(%d) Image Resizing Starts n", __FILE__, __LINE__));
- /* Get the image dimension */
- gdi_ret = gdi_image_get_dimension_file((PS8) source_file, &img_width, &img_height);
- if ((img_width >= 0) && (img_height >= 0))
- {
- /* calculate the dimension of the resize JPEG */
- if ((img_width > resize_width) || (img_height > resize_height))
- {
- /* need to resize */
- if ((img_width * resize_height) > (img_height * resize_width))
- {
- temp_width = resize_width;
- temp_height = img_height * resize_width / img_width;
- if (temp_height == 0)
- {
- temp_height = 1;
- }
- }
- else
- {
- temp_width = img_width * resize_height / img_height;
- temp_height = resize_height;
- if (temp_width == 0)
- {
- temp_width = 1;
- }
- }
- /* resize the image and encode to jpef file */
- buf_size = (temp_width * temp_height * 16) >> 3;
- buf_size = ((buf_size + 3) / 4) * 4;
- if (buf_size > 0)
- {
- media_get_ext_buffer(MOD_MMI, (void **)&buf_ptr, buf_size);
- if (buf_ptr != NULL)
- {
- gdi_ret = gdi_image_encode_file_to_jpeg(
- (PS8) source_file,
- (PS8) dest_file,
- temp_width,
- temp_height,
- buf_ptr,
- buf_size);
- media_free_ext_buffer(MOD_MMI, (void **)&buf_ptr);
- }
- switch (gdi_ret)
- {
- case GDI_SUCCEED:
- ret = JMMS_IMAGE_RESIZE_SUCCEED;
- break;
- case GDI_IMAGE_ENCODER_ERR_DISK_FULL:
- ret = JMMS_IMAGE_RESIZING_FAILED_IN_GDI_ENCODER_ERR_DISK_FULL;
- break;
- case GDI_IMAGE_ENCODER_ERR_WRITE_PROTECTION:
- ret = JMMS_IMAGE_RESIZING_FAILED_IN_GDI_ENCODER_ERR_WRITE_PROTECTION;
- break;
- case GDI_IMAGE_ENCODER_ERR_NO_DISK:
- ret = JMMS_IMAGE_RESIZING_FAILED_IN_GDI_ENCODER_ERR_NO_DISK;
- break;
- default:
- ret = JMMS_IMAGE_RESIZE_FAILED;
- }
- }
- else
- {
- ret = JMMS_IMAGE_RESIZING_FAILED_IN_INSUFFICIENT_DRAWING_BUF;
- }
- }
- else
- {
- /* the dimension of the original image is smaller */
- ret = JMMS_IMAGE_RESIZE_UNCHANGED;
- }
- }
- else
- {
- ret = JMMS_IMAGE_RESIZING_FAILED_IN_UNKNOWN_DIMENSION;
- }
- PRINT_INFORMATION_2((MMI_TRACE_INFO, " (%d) Image Resizing returns with code(%d) n", __LINE__, ret));
- return ret;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_delete_resized_temp_file
- * DESCRIPTION
- *
- * PARAMETERS
- * file_name [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jmms_delete_resized_temp_file(S8 *file_name)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JDD_FSHANDLE fs_handle = NULL;
- S8 *temp_file = NULL;
- JC_RETCODE ret_code = JC_OK;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- temp_file = (S8*) jdd_MemAlloc(pfnUnicodeStrlen((PS8) file_name) + 1, 1);
- if (temp_file != NULL)
- {
- UnicodeToAnsii((PS8) temp_file, (PS8) file_name);
- if ((strstr((PS8) temp_file, (PS8) "@mms\temp\resize")) != NULL)
- {
- ret_code = jdd_FSInitialize(&fs_handle);
- if (ret_code == JC_OK)
- {
- jdd_FSDelete(fs_handle, (JC_CHAR*) file_name);
- jdd_FSDeinitialize(fs_handle);
- }
- }
- jdd_MemFree(temp_file);
- }
- }
- #endif /* __MMI_MMS_MEGA_PIXEL_SUPPORT__ */
- /* HIMANSHU 05122006 END */
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_create_mms_to_address
- * DESCRIPTION
- * Add the file content to MMS according to their Media type.
- * PARAMETERS
- * address [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jmms_create_mms_to_address(JC_CHAR *address)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 ret = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_create_mms_to_address"));
- ClearAllKeyHandler();
- mmi_jmms_init_msg_context_struct(); /* this will different for different ways */
- if (g_jmms_context->compose_context == NULL)
- {
- g_jmms_context->compose_context =
- (jmms_compose_context_struct*) jdd_MemAlloc(sizeof(jmms_compose_context_struct), 1);
- if (g_jmms_context->compose_context == NULL)
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "OUT OF MEMORY: Fail to create compose Context"));
- DisplayPopup((PU8) GetString(STR_ID_JMMS_OUT_OF_MEMORY), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE);
- return;
- }
- }
- g_jmms_context->g_use_local_send_setings = 0;
- g_jmms_context->store_context->current_folder_name = E_JMMS_WRITE_MMS;
- g_jmms_context->compose_context->curr_page_index = 0;
- // mmi_jmms_init_msg_context_struct(); /* this will different for different ways */
- if (JMMS_COMP_OK == mmi_jmms_compose_new_mms())
- {
- g_jmms_context->address_list_flag = E_TO_ADDRESSES;
- ret = mmi_jmms_add_address_in_addresse_list((S8*) address);
- if (ret != 0)
- {
- DisplayPopup(
- (U8*) GetString(STR_ID_JMMS_MEMORY_FULL),
- IMG_GLOBAL_ERROR,
- 1,
- JMMS_POPUP_TIME,
- (U8) ERROR_TONE);
- mmi_jmms_deinit_mms_context(g_jmms_context);
- return;
- }
- /* /back to address list scren with newly added adress highlighted and rsk as DONE */
- g_jmms_context->g_write_mms_right_soft_key = STR_GLOBAL_DONE;
- mmi_jmms_entry_write_message_screen();
- }
- else
- {
- mmi_jmms_deinit_mms_context(g_jmms_context);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_create_mms_for_barcode
- * DESCRIPTION
- * This function is written to add the subject and text of 2D Barcode into
- * the new MMS.
- * PARAMETERS
- * subject [IN] JC_CHAR*
- * subject_len [IN] U8
- * text [IN] JC_CHAR*
- * text_len [OUT] U16
- * RETURNS
- * void
- *****************************************************************************/
- #ifdef __MMI_BARCODEREADER__
- void mmi_jmms_create_mms_for_barcode(JC_CHAR *subject, U8 subject_len, JC_CHAR *text, U16 text_len)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U32 slide_time = 0;
- JMMS_COMP_ERRCODE err_code = JMMS_COMP_OK;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_create_mms_for_barcode"));
- mmi_jmms_reset_fw_flag_of_message();
- if(g_jmms_context->init_done == JMMS_READY_WITHOUT_STORE)
- {
- DisplayPopup((U8*) GetString(STR_ID_JMMS_MEMORY_FULL), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, (U8) ERROR_TONE);
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "JMMS: Store is not ready"));
- return;
- }
- ClearAllKeyHandler();
- mmi_jmms_init_msg_context_struct(); /* this will different for different ways */
- if (g_jmms_context->compose_context == NULL)
- {
- g_jmms_context->compose_context =
- (jmms_compose_context_struct*) jdd_MemAlloc(sizeof(jmms_compose_context_struct), 1);
- if (g_jmms_context->compose_context == NULL)
- {
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "OUT OF MEMORY: Fail to create compose Context"));
- DisplayPopup((PU8) GetString(STR_ID_JMMS_OUT_OF_MEMORY), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE);
- return;
- }
- }
- g_jmms_context->g_use_local_send_setings = 0;
- mmi_jmms_fill_mms_sending_settings();
- g_jmms_context->store_context->current_folder_name = E_JMMS_WRITE_MMS;
- g_jmms_context->compose_context->curr_page_index = 0;
- // mmi_jmms_init_msg_context_struct(); /* this will different for different ways */
- if (JMMS_COMP_OK == mmi_jmms_compose_new_mms())
- {
- g_jmms_context->compose_context->mms_bg_color = g_jmms_color_RGB_list[COLOR_WHITE];
- /* PMT HIMANSHU START 20060425 */
- /* Added by Deepali for root layout. */
- err_code = mmi_jmms_set_bg_color(g_jmms_context->compose_context->mms_bg_color);
- if ((err_code == JMMS_COMP_OUT_MEMORY) || (err_code == JMMS_COMP_FAIL))
- {
- mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
- return;
- }
- err_code = mmi_jmms_compose_handle_error(mmi_jmms_jdi_add_page(g_jmms_context->msg_handle, 1), 1);
- if ((err_code == JMMS_COMP_OUT_MEMORY) || (err_code == JMMS_COMP_FAIL))
- {
- mmi_jmms_jdi_msg_deinit(g_jmms_context->msg_handle);
- return;
- }
- g_jmms_context->compose_context->curr_page_index++;
- 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;
- }
- subject_len *=ENCODING_LENGTH;
- /* To copy the subject content into the buffer */
- if (subject_len > (MAX_SUBJECT_LENGTH * ENCODING_LENGTH))
- {
- memcpy(g_jmms_context->subject_input_buffer, (S8*) subject, (MAX_SUBJECT_LENGTH * ENCODING_LENGTH));
- }
- else
- {
- memcpy(g_jmms_context->subject_input_buffer, (S8*) subject, subject_len);
- }
- /* To copy the MMS content into the buffer. */
- text_len *=ENCODING_LENGTH;
- if (text_len > (JMMS_COMPOSE_TEXT_LENGTH * ENCODING_LENGTH))
- {
- memcpy(
- g_jmms_context->compose_context->curr_slide_info.edit_content_buffer,
- (S8*) text,
- (JMMS_COMPOSE_TEXT_LENGTH * ENCODING_LENGTH));
- }
- else
- {
- memcpy(g_jmms_context->compose_context->curr_slide_info.edit_content_buffer, (S8*) text, text_len);
- }
- /* To add the text with the MMS */
- 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);
- g_jmms_context->g_write_mms_right_soft_key = STR_GLOBAL_DONE;
- if (err_code == JMMS_COMP_OK || err_code == JMMS_COMP_POPUP_OK)
- {
- g_jmms_context->g_write_mms_right_soft_key = STR_GLOBAL_DONE;
- if (err_code == JMMS_COMP_POPUP_OK)
- {
- mmi_jmms_entry_write_message_screen_in_history();
- }
- else
- {
- mmi_jmms_entry_write_message_screen();
- }
- return;
- }
- }
- mmi_jmms_deinit_mms_context(g_jmms_context);
- return;
- }
- #endif /* __MMI_BARCODEREADER__ */
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_convert_chinese_english_filename
- * DESCRIPTION
- *
- * PARAMETERS
- * dst_filename [IN]
- * src_filename [IN]
- * RETURNS
- *
- *****************************************************************************/
- JC_RETCODE mmi_jmms_convert_chinese_english_filename(JC_CHAR **dst_filename, JC_CHAR *src_filename)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- JC_CHAR *tmp_file_ext = NULL;
- JC_RETCODE ret_code = JC_OK;
- MESSAGING_HANDLER *msg_handle = g_jmms_context->msg_handle;
- MEDIA_MIME_LIST *pMimeList;
- MEDIA_MIME_INFO *pTargetMime = NULL;
- U8 isDuplicate = 1;
- U32 ch_transaction_id = mmi_jmms_get_chinese_file_name_id_from_nvram();
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (src_filename != NULL && isDuplicate == 1)
- {
- U32 index = 0;
- S8 temp_str[50];
- JC_CHAR *dst_temp_file_name = NULL;
- index = jdi_UtilsLastIndexOfTchar('.', src_filename, jc_tcslen(src_filename) - 1);
- tmp_file_ext = &src_filename[index];
- sprintf(temp_str, "%s%d", JMMS_CHINESE_FILE_NAME_PRE_STRING, ++ch_transaction_id);
- ret_code = jdi_UtilsCharToTchar(&dst_temp_file_name, temp_str);
- if (ret_code != JC_OK)
- {
- return ret_code;
- }
- *dst_filename =
- (JC_CHAR*) jdd_MemAlloc((jc_tcslen(dst_temp_file_name) + jc_tcslen(tmp_file_ext) + 1), sizeof(JC_CHAR));
- if (*dst_filename == NULL)
- {
- jdd_MemFree(dst_temp_file_name);
- return JC_ERR_MEMORY_ALLOCATION;
- }
- jc_tcscpy((JC_CHAR*) * dst_filename, (JC_CHAR*) dst_temp_file_name);
- jc_tcscat(*dst_filename, tmp_file_ext);
- jdd_MemFree(dst_temp_file_name);
- /* Check for duplicate filename */
- isDuplicate = 0;
- pMimeList = msg_handle->pMimeList;
- while (pMimeList != NULL)
- {
- pTargetMime = pMimeList->pMimeInfo;
- if (jc_tcscmp(pTargetMime->MimeHeaders.pObjectName, *dst_filename) == 0)
- {
- isDuplicate = 1;
- jdd_MemFree(*dst_filename);
- break;
- }
- pMimeList = pMimeList->pNext;
- }
- }
- mmi_jmms_set_chinese_file_name_id_to_nvram(ch_transaction_id);
- return ret_code;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_get_chinese_file_name_id_from_nvram
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- U32 mmi_jmms_get_chinese_file_name_id_from_nvram(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 error;
- U64 ch_file_num = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ReadValue(NVRAM_JMMS_CHINESE_TRANSACTION_ID, &ch_file_num, DS_DOUBLE, &error);
- if (ch_file_num > (0xFFFFFFFF)) // compiler warning removal
- {
- ch_file_num = 0;
- WriteValue(NVRAM_JMMS_CHINESE_TRANSACTION_ID, &ch_file_num, DS_DOUBLE, &error);
- }
- return (U32) ch_file_num;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_set_chinese_file_name_id_to_nvram
- * DESCRIPTION
- *
- * PARAMETERS
- * tr_id [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_jmms_set_chinese_file_name_id_to_nvram(U32 tr_id)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 error;
- U64 ch_file_num = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ch_file_num = tr_id;
- if (ch_file_num == 0x00000000FFFFFFFF)
- {
- ch_file_num = 0;
- }
- WriteValue(NVRAM_JMMS_CHINESE_TRANSACTION_ID, &ch_file_num, DS_DOUBLE, &error);
- }
- /*****************************************************************************
- * FUNCTION
- * IsExtendedCharPresent
- * DESCRIPTION
- *
- * PARAMETERS
- * tr_id [IN]
- * RETURNS
- * void
- *****************************************************************************/
- pBOOL IsExtendedCharPresent(S8* buffer)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- pBOOL isExtended = FALSE;
- U8 i=0, bufferLen=0;
- UI_character_type ch;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ch = 0x00FF & (UI_character_type)buffer[i];
- bufferLen = pfnUnicodeStrlen(buffer) * ENCODING_LENGTH;
- for (i = 0; i < bufferLen; i += 2)
- {
- if ((0x00FF & (UI_character_type)buffer[i]) >= 0x80 && (0x00FF & (UI_character_type)buffer[i+1]==0x00))
- {
- isExtended = TRUE;
- break;
- }
- }
- return isExtended;
- }
- #ifdef __DRM_SUPPORT__
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_is_drm_fwd_lock_media_in_mms
- * DESCRIPTION
- *
- * PARAMETERS
- * MESSAGING_HANDLER [IN]
- * JC_BOOLEAN [IN]
- * RETURNS
- * JC_BOOLEAN
- *****************************************************************************/
- JC_BOOLEAN mmi_jmms_is_drm_fwd_lock_media_in_mms(MESSAGING_HANDLER *pMessagingHandle, JC_BOOLEAN check_for_edit)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MEDIA_MIME_LIST *pTempMimeList = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "mmi_jmms_is_drm_fwd_lock_media_in_mms"));
- if (pMessagingHandle->pMimeList != NULL)
- {
- pTempMimeList = pMessagingHandle->pMimeList;
- }
- while(pTempMimeList != NULL)
- {
- if(jdi_CUtilsStrStartsWith(pTempMimeList->pMimeInfo->MimeHeaders.pContentType, "application/vnd.oma.drm.message") == E_TRUE)
- {
- if(check_for_edit)
- {
- DisplayPopup((PU8) GetString(STR_ID_JMMS_FORWARD_LOCK_DRM_CANT_EDIT), IMG_GLOBAL_WARNING, 1, JMMS_POPUP_TIME, WARNING_TONE);
- }
- else
- {
- DisplayPopup((PU8) GetString(STR_ID_JMMS_FORWARD_LOCK_DRM), IMG_GLOBAL_WARNING, 1, JMMS_POPUP_TIME, WARNING_TONE);
- }
- return E_TRUE;
- }
- pTempMimeList = pTempMimeList->pNext ;
- }
- return E_FALSE;
- }
- #endif
- /*****************************************************************************
- * FUNCTION
- * mmi_jmms_is_corrupted_video_media_in_mms
- * DESCRIPTION
- *
- * PARAMETERS
- * MESSAGING_HANDLER [IN]
- * RETURNS
- * JC_BOOLEAN
- *****************************************************************************/
- JC_BOOLEAN mmi_jmms_is_corrupted_video_media_in_mms(MESSAGING_HANDLER *pMessagingHandle)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MSG_PAGE *pTempPageList = NULL;
- JC_UINT32 audio_du = 0;
- S32 img_widthv, img_heightv;
- #ifdef __MMI_VIDEO_PLAYER__
- MDI_RESULT result_video = 0;
- #endif
- JC_BOOLEAN result_media = E_FALSE;
- GDI_RESULT image_result;
- S32 audio_result = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_INFO, "%s", "Inside mmi_jmms_is_corrupted_video_media_in_mms"));
- if (pMessagingHandle->pPageList != NULL)
- {
- pTempPageList = pMessagingHandle->pPageList;
- }
- while(pTempPageList != NULL)
- {
- if(pTempPageList->pMediaList != NULL)
- {
- switch(pTempPageList->pMediaList->eMediaType)
- {
- case E_MEDIA_IMAGE:
- #ifdef __DRM_SUPPORT__
- if(jdi_CUtilsStrStartsWith(pTempPageList->pMediaList->pMimeInfo->MimeHeaders.pContentType, APPLICATION_DRM_VALUE) != E_TRUE)
- #endif
- {
- image_result = gdi_image_get_dimension_file((S8*) pTempPageList->pMediaList->pMimeInfo->ContentData.pFileName, &img_widthv, &img_heightv);
- if(image_result != GDI_SUCCEED || (img_widthv * img_heightv) == 0)
- {
- result_media = E_TRUE;
- }
- }
- break;
- case E_MEDIA_AUDIO:
- #ifdef __DRM_SUPPORT__
- if(jdi_CUtilsStrStartsWith(pTempPageList->pMediaList->pMimeInfo->MimeHeaders.pContentType, APPLICATION_DRM_VALUE) != E_TRUE)
- #endif
- {
- audio_result = mdi_audio_get_duration((S8*) pTempPageList->pMediaList->pMimeInfo->ContentData.pFileName, &audio_du);
- if(audio_result != GDI_SUCCEED )
- {
- result_media = E_TRUE;
- }
- }
- break;
- #ifdef __MMI_VIDEO_PLAYER__
- case E_MEDIA_VIDEO:
- #ifdef __DRM_SUPPORT__
- if(jdi_CUtilsStrStartsWith(pTempPageList->pMediaList->pMimeInfo->MimeHeaders.pContentType, APPLICATION_DRM_VALUE) != E_TRUE)
- #endif
- {
- result_video = mmi_jdd_videoapp_get_video_file_size_info((S8*) pTempPageList->pMediaList->pMimeInfo->ContentData.pFileName, (JC_UINT32*)&img_widthv, (JC_UINT32*)&img_heightv);
- if(result_video == MDI_RES_VDOPLY_ERR_OPEN_FILE_FAILED)
- {
- result_media = E_TRUE;
- }
- }
- break;
- #endif
- }
- if(result_media == E_TRUE)
- {
- #ifdef __MMI_UNIFIED_MESSAGE__
- g_jmms_context->edit_error_code=-1;
- #endif
- DisplayPopup((PU8) GetString(STR_ID_JMMS_CORRUPTED_MEDIA_FILE), IMG_GLOBAL_ERROR, 1, JMMS_POPUP_TIME, ERROR_TONE);
- return E_TRUE;
- }
- }
- pTempPageList = pTempPageList->pNext ;
- }
- return E_FALSE;
- }
- /* PMT VIKAS END 20060403 */
- JMMS_COMP_ERRCODE mmi_jmms_compose_replace_media(void *path_p, U8 type, U8 is_attachment, U8 page_index, JC_UINT32 uiOldMediaID)
- {
- /*----------------------------------------------------------------*/
- /* 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_replace_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_replace_media(g_jmms_context->msg_handle, media_info_p, uiOldMediaID, 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;
- }
- 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;
- }
- #endif /* (defined (JATAAYU_SUPPORT) && defined(MMS_SUPPORT)) */