UnifiedComposerMiscell.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:253k
源码类别:
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) 2005
- *
- * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
- * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
- * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
- * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
- * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
- *
- * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
- * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
- * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- *
- * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
- * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
- * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
- * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
- * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
- *
- *****************************************************************************/
- /*****************************************************************************
- *
- * Filename:
- * ---------
- * UnifiedComposerMiscell.c
- *
- * Project:
- * --------
- * MAUI
- *
- * Description:
- * ------------
- * This file implements miscell utilities for Unified Composer application.
- *
- * 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!
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- #ifndef _MMI_UNIFIED_COMPOSER_MISCELL_C
- #define _MMI_UNIFIED_COMPOSER_MISCELL_C
- #include "MMI_features.h"
- #ifdef __MMI_UNIFIED_COMPOSER__
- #include "stdC.h"
- #include "L4Dr1.h"
- #include "FileSystemDef.h"
- #include "FileMgr.h"
- #include "Fmt_struct.h"
- #include "FileSystemGProt.h"
- #include "mdi_datatype.h"
- #include "mdi_audio.h"
- /* micha1230 */
- #include "custom_nvram_editor_data_item.h"
- #include "custom_data_account.h"
- #include "NVRAMEnum.h"
- #include "NVRAMProt.h"
- #include "NVRAMType.h"
- #include "Conversions.h"
- #include "DebugInitDef.h"
- #include "FrameworkStruct.h"
- #include "EventsGprot.h"
- #include "HistoryGprot.h"
- #include "CommonScreens.h"
- #include "GlobalDefs.h"
- #include "SettingProfile.h"
- #include "PhoneBookGprot.h"
- #include "TimerEvents.h"
- #include "wgui_status_icons.h"
- #include "keyBrd.h"
- #include "gpioInc.h"
- #include "MessagesresourceData.h"
- #include "MessagesMiscell.h"
- #include "SmsGuiInterfaceProt.h"
- #include "SmsGuiInterfaceType.h"
- #include "SmsPsHandler.h"
- #include "mmi_msg_context.h"
- #include "xml_def.h"
- #include "wgui_categories_UCE.h"
- /* ASM */
- #include "app_mem.h"
- #include "lcd_sw_rnd.h"
- #include "gdi_include.h"
- #include "USBDeviceGprot.h"
- #include "SMSApi.h"
- #include "SMSStruct.h"
- #include "wapadp.h"
- #include "mmsadp.h"
- #include "wap_ps_struct.h"
- #include "custom_wap_config.h"
- #include "med_api.h"
- #include "gdi_include.h"
- #include "app_asyncfile.h"
- #include "UnifiedMessageGProt.h"
- #include "custom_uc_config.h"
- #include "UnifiedComposerDef.h"
- #include "UnifiedComposerGProt.h"
- #include "UnifiedComposerProt.h"
- /*****************************************************************************
- * Local Variable
- *****************************************************************************/
- const S8 g_uc_three_dot[] = { '.', ' ', '.', ' ', '.', ' ', ' ', ' ' };
- /*****************************************************************************
- * Extern Function
- *****************************************************************************/
- extern EMSData *GetEMSDataForEdit(EMSData **p, U8 force);
- extern int mmi_charset_utf8_to_ucs2_length_in_bytes(const kal_uint8 *raw);
- extern int mmi_charset_ucs2_to_utf8_length_in_bytes(const kal_uint8 *raw);
- extern kal_uint16 EMSUsableTextLen(kal_uint8 dcs);
- extern EMSTATUS EMSCalculateSeg(kal_uint8 dcs,kal_uint16 num_byte, kal_uint8 *usedSegment);
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_init_context
- * DESCRIPTION
- * Initialize Unified Composer context
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_init_context(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset(g_uc_p, 0 , sizeof(mmi_uc_context_struct));
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_create_adm_mem
- * DESCRIPTION
- * Create adm memory for UC
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_create_adm_mem(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_uc_p->main.mem_pool_id = kal_adm_create(mmi_uc_adm_mem,
- MMI_UC_ADM_MEM_SIZE,
- NULL,
- KAL_FALSE);
- MMI_ASSERT(g_uc_p->main.mem_pool_id);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_add_address
- * DESCRIPTION
- * add address function
- * PARAMETERS
- * void
- * RETURNS
- * TRUE means add successfully. Otherwise FALSE.
- *****************************************************************************/
- BOOL mmi_uc_add_address(U8* ucs2_addr, mmi_uc_address_type_enum type, mmi_uc_address_group_type_enum group)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_uc_addr_struct** addr_head = &(g_uc_p->msg.to_head);
- mmi_uc_addr_struct* addr_tail = NULL;
- mmi_uc_addr_struct* addr_new = NULL;
- U8 ascii_addr[MMI_UC_MAX_ADDR_LEN + 1];
- U8 addr_num_calculated = 0;
- U8* addr_num = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (group)
- {
- case MMI_UC_ADDRESS_GROUP_TYPE_TO:
- {
- addr_tail = g_uc_p->msg.to_head;
- addr_head = &(g_uc_p->msg.to_head);
- addr_num = &(g_uc_p->msg.to_num);
- }
- break;
- case MMI_UC_ADDRESS_GROUP_TYPE_CC:
- {
- addr_tail = g_uc_p->msg.cc_head;
- addr_head = &(g_uc_p->msg.cc_head);
- addr_num = &(g_uc_p->msg.cc_num);
- }
- break;
- case MMI_UC_ADDRESS_GROUP_TYPE_BCC:
- {
- addr_tail = g_uc_p->msg.bcc_head;
- addr_head = &(g_uc_p->msg.bcc_head);
- addr_num = &(g_uc_p->msg.bcc_num);
- }
- break;
- case MMI_UC_ADDRESS_GROUP_TYPE_FROM:
- {
- addr_tail = g_uc_p->msg.from;
- addr_head = &(g_uc_p->msg.from);
- }
- break;
- default:
- {
- MMI_ASSERT(0);
- }
- break;
- }
- if (type == MMI_UC_ADDRESS_TYPE_PHONE_NUMBER)
- {
- memset(ascii_addr, 0, sizeof(ascii_addr));
- UnicodeNToAnsii((S8*) ascii_addr, (S8*) ucs2_addr, MMI_UC_MAX_ADDR_LEN * ENCODING_LENGTH);
- }
- if (group != MMI_UC_ADDRESS_GROUP_TYPE_FROM)
- {
- if (addr_tail == NULL)
- {
- addr_num_calculated = 0;
- }
- else
- {
- addr_num_calculated = 1;
- for (; addr_tail->next != NULL ; addr_tail = addr_tail->next)
- {
- addr_num_calculated++;
- }
- }
- MMI_ASSERT((addr_num_calculated == (*addr_num)));
- }
- addr_new = kal_adm_alloc(g_uc_p->main.mem_pool_id, sizeof(mmi_uc_addr_struct));
- MMI_ASSERT(addr_new);
- addr_new->type = type;
- addr_new->group = group;
- addr_new->next = NULL;
- if (addr_new->type == MMI_UC_ADDRESS_TYPE_PHONE_NUMBER)
- {
- U8 len = strlen((char*)ascii_addr);
- MMI_ASSERT(len <= MMI_UC_MAX_ADDR_LEN);
- addr_new->addr = kal_adm_alloc(g_uc_p->main.mem_pool_id, len + 1);
- MMI_ASSERT(addr_new->addr);
- memset(addr_new->addr, 0, len + 1);
- memcpy(addr_new->addr, ascii_addr, len);
- }
- else if (addr_new->type == MMI_UC_ADDRESS_TYPE_EMAIL)
- {
- U8 len = pfnUnicodeStrlen((S8*)ucs2_addr);
- MMI_ASSERT(len <= MMI_UC_MAX_ADDR_LEN);
- addr_new->addr = kal_adm_alloc(g_uc_p->main.mem_pool_id, ((len + 1) * ENCODING_LENGTH));
- MMI_ASSERT(addr_new->addr);
- memset(addr_new->addr, 0, ((len + 1) * ENCODING_LENGTH));
- memcpy(addr_new->addr, ucs2_addr, (len * ENCODING_LENGTH));
- }
- else
- {
- MMI_ASSERT(0);
- }
- /* First entry */
- if (addr_tail == NULL)
- {
- addr_new->previous = NULL;
- *addr_head = addr_new;
- }
- else
- {
- addr_new->previous = addr_tail;
- addr_tail->next = addr_new;
- }
- if (group != MMI_UC_ADDRESS_GROUP_TYPE_FROM)
- {
- (*addr_num) = (*addr_num) + 1;
- }
- return MMI_TRUE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_check_duplicate_address
- * DESCRIPTION
- * Check duplicate address function
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- mmi_uc_addr_struct* mmi_uc_check_duplicate_address(U8* ucs2_addr, mmi_uc_address_type_enum type, mmi_uc_address_group_type_enum group)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_uc_addr_struct* addr_tail = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (group)
- {
- case MMI_UC_ADDRESS_GROUP_TYPE_TO:
- {
- addr_tail = g_uc_p->msg.to_head;
- }
- break;
- case MMI_UC_ADDRESS_GROUP_TYPE_CC:
- {
- addr_tail = g_uc_p->msg.cc_head;
- }
- break;
- case MMI_UC_ADDRESS_GROUP_TYPE_BCC:
- {
- addr_tail = g_uc_p->msg.bcc_head;
- }
- break;
- case MMI_UC_ADDRESS_GROUP_TYPE_FROM:
- {
- addr_tail = g_uc_p->msg.from;
- }
- break;
- default:
- {
- MMI_ASSERT(0);
- }
- break;
- }
- if (type == MMI_UC_ADDRESS_TYPE_PHONE_NUMBER)
- {
- U8 addr[(MMI_UC_MAX_ADDR_LEN + 1) * ENCODING_LENGTH];
- memset(addr, 0, sizeof(addr));
- UnicodeNToAnsii((S8*) addr, (S8*) ucs2_addr, MMI_UC_MAX_ADDR_LEN * ENCODING_LENGTH);
- for (; addr_tail != NULL ; addr_tail = addr_tail->next)
- {
- if (addr_tail->type != MMI_UC_ADDRESS_TYPE_PHONE_NUMBER)
- {
- continue;
- }
- //if (strcmp((char*)addr, (char*)addr_tail->addr) == 0)
- if (ComparePhoneNum(addr, addr_tail->addr) == MMI_TRUE )
- {
- return addr_tail;
- }
- }
- }
- else if (type == MMI_UC_ADDRESS_TYPE_EMAIL)
- {
- for (; addr_tail != NULL ; addr_tail = addr_tail->next)
- {
- if (addr_tail->type != MMI_UC_ADDRESS_TYPE_EMAIL)
- {
- continue;
- }
- //if (pfnUnicodeStrcmp((S8*)ucs2_addr, (S8*)addr_tail->addr) == 0)
- if (mmi_uc_compare_string_ignore_case((U16*)ucs2_addr, (U16*)addr_tail->addr) == MMI_TRUE)
- {
- return addr_tail;
- }
- }
- }
- else
- {
- MMI_ASSERT(0);
- }
- return NULL;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_change_msg_type_if_needed
- * DESCRIPTION
- * Change msg type if needed.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- BOOL mmi_uc_change_msg_type_if_needed(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_uc_msg_type_enum msg_type;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
- "*[UnifiedComposerMiscell.c] mmi_uc_change_msg_type_if_needed curr=%d spec=%d set=%d*n",
- g_uc_p->msg_type.curr_msg_type,
- g_uc_p->msg_type.caller_specific_msg_type,
- g_uc_p->msg_type.setting_msg_type));
- msg_type = mmi_uc_determine_msg_type_by_content();
- switch (g_uc_p->msg_type.caller_specific_msg_type )
- {
- case MMI_UC_MSG_TYPE_SMS_ONLY:
- {
- MMI_ASSERT(g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER);
- }
- break;
- case MMI_UC_MSG_TYPE_MMS_ONLY:
- {
- MMI_ASSERT(g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER);
- }
- break;
- case MMI_UC_MSG_TYPE_DEFAULT:
- {
- if (g_uc_p->msg_type.setting_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
- {
- if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
- {
- if (msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
- {
- g_uc_p->msg_type.curr_msg_type = MMI_UC_MSG_TYPE_SMS_PREFER;
- return TRUE;
- }
- }
- else if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
- {
- if (msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
- {
- g_uc_p->msg_type.curr_msg_type = MMI_UC_MSG_TYPE_MMS_PREFER;
- return TRUE;
- }
- }
- else
- {
- MMI_ASSERT(0);
- }
- }
- else if (g_uc_p->msg_type.setting_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
- {
- if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
- {
- /* Do nothing. */
- }
- else if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
- {
- MMI_ASSERT(0);
- }
- else
- {
- MMI_ASSERT(0);
- }
- }
- else
- {
- MMI_ASSERT(0);
- }
- }
- break;
- case MMI_UC_MSG_TYPE_SMS_PREFER:
- {
- if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
- {
- if (msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
- {
- g_uc_p->msg_type.curr_msg_type = MMI_UC_MSG_TYPE_SMS_PREFER;
- return TRUE;
- }
- }
- else if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
- {
- if (msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
- {
- g_uc_p->msg_type.curr_msg_type = MMI_UC_MSG_TYPE_MMS_PREFER;
- return TRUE;
- }
- }
- else
- {
- MMI_ASSERT(0);
- }
- }
- break;
- case MMI_UC_MSG_TYPE_MMS_PREFER:
- {
- if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER)
- {
- /* Do nothing. */
- }
- else if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER)
- {
- MMI_ASSERT(0);
- }
- else
- {
- MMI_ASSERT(0);
- }
- }
- break;
- default:
- {
- MMI_ASSERT(0);
- }
- }
- return FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_determine_msg_type_by_content
- * DESCRIPTION
- * Determine msg type according to current msg content
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- mmi_uc_msg_type_enum mmi_uc_determine_msg_type_by_content(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_uc_p->msg.cc_num > 0)
- {
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
- "*[UnifiedComposerMiscell.c] mmi_uc_determine_msg_type_by_content cc=%d *n",
- g_uc_p->msg.cc_num));
- return MMI_UC_MSG_TYPE_MMS_PREFER;
- }
- else if (g_uc_p->msg.bcc_num > 0)
- {
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
- "*[UnifiedComposerMiscell.c] mmi_uc_determine_msg_type_by_content bcc=%d *n",
- g_uc_p->msg.bcc_num));
- return MMI_UC_MSG_TYPE_MMS_PREFER;
- }
- else if (pfnUnicodeStrlen((S8*)g_uc_p->msg.subject))
- {
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,"*[UnifiedComposerMiscell.c] mmi_uc_determine_msg_type_by_content subject *n"));
- return MMI_UC_MSG_TYPE_MMS_PREFER;
- }
- else if (g_uc_p->msg.total_slide_num > 1)
- {
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
- "*[UnifiedComposerMiscell.c] mmi_uc_determine_msg_type_by_content slide=%d *n",
- g_uc_p->msg.total_slide_num));
- return MMI_UC_MSG_TYPE_MMS_PREFER;
- }
- else if (g_uc_p->msg.total_object_num > 1)
- {
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
- "*[UnifiedComposerMiscell.c] mmi_uc_determine_msg_type_by_content object=%d *n",
- g_uc_p->msg.total_object_num));
- return MMI_UC_MSG_TYPE_MMS_PREFER;
- }
- else if ((g_uc_p->msg.total_object_num == 1) &&
- (g_uc_p->msg.object_head->type != MMI_UC_OBJECT_TYPE_TEXT))
- {
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
- "*[UnifiedComposerMiscell.c] mmi_uc_determine_msg_type_by_content one object *n"));
- return MMI_UC_MSG_TYPE_MMS_PREFER;
- }
- else
- {
- mmi_uc_addr_struct* addr = g_uc_p->msg.to_head;
- for (; addr != NULL; addr = addr->next)
- {
- if (addr->type == MMI_UC_ADDRESS_TYPE_EMAIL)
- {
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
- "*[UnifiedComposerMiscell.c] mmi_uc_determine_msg_type_by_content email addr *n"));
- return MMI_UC_MSG_TYPE_MMS_PREFER;
- }
- }
- /* Add text object when the UC screen is exited */
- //MMI_ASSERT(g_uc_p->msg.current_slide->text.object);
- if (g_uc_p->msg.current_slide)
- {
- if (g_uc_p->msg.current_slide->text.UCS2_count)
- {
- if (g_uc_p->msg.current_slide->text.char_count > g_uc_p->sms_info.max_ucs2_char_num)
- {
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
- "*[UnifiedComposerMiscell.c] mmi_uc_determine_msg_type_by_content ucs2 text size exceed *n"));
- return MMI_UC_MSG_TYPE_MMS_PREFER;
- }
- }
- else if (g_uc_p->msg.current_slide->text.char_count)
- {
- if (g_uc_p->msg.current_slide->text.char_count + g_uc_p->msg.current_slide->text.extension_char_count >
- g_uc_p->sms_info.max_gsm7bit_char_num)
- {
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
- "*[UnifiedComposerMiscell.c] mmi_uc_determine_msg_type_by_content ascii text size exceed *n"));
- return MMI_UC_MSG_TYPE_MMS_PREFER;
- }
- }
- }
- }
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
- "*[UnifiedComposerMiscell.c] mmi_uc_determine_msg_type_by_content SMS *n"));
- return MMI_UC_MSG_TYPE_SMS_PREFER;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_update_msg_size
- * DESCRIPTION
- * Update msg size
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_update_msg_size(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_uc_p->send_info.existed_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER &&
- (g_uc_p->main.state == MMI_UC_STATE_FORWARD || g_uc_p->main.state == MMI_UC_STATE_SEND))
- {
- g_uc_p->msg.msg_size = wap_mma_uc_calc_header_size(&g_uc_p->msg) + g_uc_p->msg.msg_body_size;
- }
- else
- {
- g_uc_p->msg.msg_size = wap_mma_uc_calc_msg_size(&g_uc_p->msg);
- }
- if (g_uc_p->msg.current_slide)
- {
- g_uc_p->msg.msg_size_without_text_buffer = g_uc_p->msg.msg_size - g_uc_p->msg.current_slide->text.utf8_msg_len;
- }
- else
- {
- g_uc_p->msg.msg_size_without_text_buffer = g_uc_p->msg.msg_size;
- }
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
- "*[UnifiedComposerMiscell.c] mmi_uc_update_msg_size msg_size=%d msg_size_wo_text=%d *n",
- g_uc_p->msg.msg_size,
- g_uc_p->msg.msg_size_without_text_buffer));
- MMI_ASSERT(g_uc_p->msg.msg_size_without_text_buffer <= g_uc_p->msg.msg_size);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_addr_struct
- * DESCRIPTION
- * get current highlighted address
- * PARAMETERS
- * void
- * RETURNS
- * current highlighted address
- *****************************************************************************/
- mmi_uc_addr_struct* mmi_uc_get_highlighted_addr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_uc_addr_struct* addr = NULL;
- U32 addr_num = 0;
- U32 i = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch(g_uc_p->done.current_addr_type)
- {
- case MMI_UC_ADDRESS_GROUP_TYPE_TO:
- {
- addr = g_uc_p->msg.to_head;
- addr_num = g_uc_p->msg.to_num;
- }
- break;
- case MMI_UC_ADDRESS_GROUP_TYPE_CC:
- {
- addr = g_uc_p->msg.cc_head;
- addr_num = g_uc_p->msg.cc_num;
- }
- break;
- case MMI_UC_ADDRESS_GROUP_TYPE_BCC:
- {
- addr = g_uc_p->msg.bcc_head;
- addr_num = g_uc_p->msg.bcc_num;
- }
- break;
- default:
- {
- MMI_ASSERT(0);
- }
- break;
- }
- MMI_ASSERT(g_uc_p->done.current_addr_index < addr_num);
- for( ; i < g_uc_p->done.current_addr_index; addr = addr->next)
- {
- i++;
- MMI_ASSERT(addr->next);
- }
- return addr;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_free_addr_memory
- * DESCRIPTION
- * free address memory
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_free_addr_memory(mmi_uc_addr_struct* addr)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_ASSERT(addr);
- if (addr->addr)
- {
- kal_adm_free(g_uc_p->main.mem_pool_id, addr->addr);
- }
- kal_adm_free(g_uc_p->main.mem_pool_id, addr);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_delete_addr
- * DESCRIPTION
- * Delete address
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_delete_addr(mmi_uc_addr_struct* address)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_uc_addr_struct* addr = address;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (addr->group)
- {
- case MMI_UC_ADDRESS_GROUP_TYPE_TO:
- {
- if (g_uc_p->msg.to_num == 1)
- {
- g_uc_p->msg.to_num = 0;
- g_uc_p->msg.to_head = NULL;
- }
- else
- {
- g_uc_p->msg.to_num--;
- /* The first entry */
- if (addr == g_uc_p->msg.to_head)
- {
- g_uc_p->msg.to_head = addr->next;
- addr->next->previous = NULL;
- }
- /* The last entry */
- else if (addr->next == NULL)
- {
- addr->previous->next = NULL;
- }
- else
- {
- addr->next->previous = addr->previous;
- addr->previous->next = addr->next;
- }
- }
- }
- break;
- case MMI_UC_ADDRESS_GROUP_TYPE_CC:
- {
- if (g_uc_p->msg.cc_num == 1)
- {
- g_uc_p->msg.cc_num = 0;
- g_uc_p->msg.cc_head = NULL;
- }
- else
- {
- g_uc_p->msg.cc_num--;
- /* The first entry */
- if (addr == g_uc_p->msg.cc_head)
- {
- g_uc_p->msg.cc_head = addr->next;
- addr->next->previous = NULL;
- }
- /* The last entry */
- else if (addr->next == NULL)
- {
- addr->previous->next = NULL;
- }
- else
- {
- addr->next->previous = addr->previous;
- addr->previous->next = addr->next;
- }
- }
- }
- break;
- case MMI_UC_ADDRESS_GROUP_TYPE_BCC:
- {
- if (g_uc_p->msg.bcc_num == 1)
- {
- g_uc_p->msg.bcc_num = 0;
- g_uc_p->msg.bcc_head = NULL;
- }
- else
- {
- g_uc_p->msg.bcc_num--;
- /* The first entry */
- if (addr == g_uc_p->msg.bcc_head)
- {
- g_uc_p->msg.bcc_head = addr->next;
- addr->next->previous = NULL;
- }
- /* The last entry */
- else if (addr->next == NULL)
- {
- addr->previous->next = NULL;
- }
- else
- {
- addr->next->previous = addr->previous;
- addr->previous->next = addr->next;
- }
- }
- }
- break;
- case MMI_UC_ADDRESS_GROUP_TYPE_FROM:
- {
- mmi_uc_free_addr_memory(addr);
- g_uc_p->msg.from = NULL;
- return;
- }
- break;
- default:
- {
- MMI_ASSERT(0);
- }
- break;
- }
- mmi_uc_free_addr_memory(addr);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_delete_all_addr
- * DESCRIPTION
- * Delete group address address
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_delete_all_addr(mmi_uc_address_group_type_enum group)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_uc_addr_struct* addr = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- do
- {
- switch (group)
- {
- case MMI_UC_ADDRESS_GROUP_TYPE_TO:
- {
- addr = g_uc_p->msg.to_head;
- }
- break;
- case MMI_UC_ADDRESS_GROUP_TYPE_CC:
- {
- addr = g_uc_p->msg.cc_head;
- }
- break;
- case MMI_UC_ADDRESS_GROUP_TYPE_BCC:
- {
- addr = g_uc_p->msg.bcc_head;
- }
- break;
- default:
- {
- MMI_ASSERT(0);
- }
- break;
- }
- if (addr != NULL)
- {
- mmi_uc_delete_addr(addr);
- }
- else
- {
- break;
- }
- }while(TRUE);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_copy_with_dot
- * DESCRIPTION
- * Append three dots to the end of string
- * PARAMETERS
- * source [IN] Source buffer.
- * dest [IN/OUT] Destination buffer.
- * max_len [IN] Max characters can be put in destination buffer
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_copy_with_dot(S8 *dest, S8 *source, S32 max_len)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (pfnUnicodeStrlen(source) <= max_len)
- {
- pfnUnicodeStrcpy((S8*) dest, (S8*) source);
- }
- else
- {
- /* do not clear end of string because pfnUnicodeStrncpy will auto set NULL terminate */
- pfnUnicodeStrncpy((S8*) dest, (S8*) source, max_len - 3);
- pfnUnicodeStrcat((S8*) dest, (S8*) g_uc_three_dot);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_set_file_mgr_filter
- * DESCRIPTION
- * Set file manager filters
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_set_file_mgr_filter(FMGR_FILTER* filter, const char *mime_types)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (strstr(mime_types, "jpeg"))
- {
- FMGR_FILTER_SET(filter, FMGR_TYPE_JPG);
- }
- if (strstr(mime_types, "gif"))
- {
- FMGR_FILTER_SET(filter, FMGR_TYPE_GIF);
- }
- if (strstr(mime_types, "wbmp"))
- {
- FMGR_FILTER_SET(filter, FMGR_TYPE_WBMP);
- FMGR_FILTER_SET(filter, FMGR_TYPE_WBM);
- }
- if (strstr(mime_types, "mid")) /* Including "audio/mid" */
- {
- FMGR_FILTER_SET(filter, FMGR_TYPE_MID);
- }
- if (strstr(mime_types, "amr")) /* Assume audio/amr is okay even the parameter is audio/amr-wb */
- {
- FMGR_FILTER_SET(filter, FMGR_TYPE_AMR);
- }
- #ifdef __MMI_VCARD__
- if (strstr(mime_types, "vcard"))
- {
- FMGR_FILTER_SET(filter, FMGR_TYPE_VCF);
- }
- #endif /* __MMI_VCARD__ */
- #ifdef __MMI_VCALENDAR__
- if (strstr(mime_types, "vcalendar"))
- {
- FMGR_FILTER_SET(filter, FMGR_TYPE_VCS);
- }
- #endif /* __MMI_VCALENDAR__ */
- if (strstr(mime_types, "video/mp4"))
- {
- FMGR_FILTER_SET(filter, FMGR_TYPE_MP4);
- }
- if (strstr(mime_types, "video/mpeg"))
- {
- FMGR_FILTER_SET(filter, FMGR_TYPE_MPG);
- }
- if (strstr(mime_types, "3gp"))
- {
- FMGR_FILTER_SET(filter, FMGR_TYPE_3GP);
- }
- if (strstr(mime_types, "3gpp2"))
- {
- FMGR_FILTER_SET(filter, FMGR_TYPE_3G2);
- }
- if (strstr(mime_types, "bmp"))
- {
- FMGR_FILTER_SET(filter, FMGR_TYPE_BMP);
- }
- if (strstr(mime_types, "png"))
- {
- FMGR_FILTER_SET(filter, FMGR_TYPE_PNG);
- }
- if (strstr(mime_types, "wav"))
- {
- FMGR_FILTER_SET(filter, FMGR_TYPE_WAV);
- }
- if (strstr(mime_types, "imelody"))
- {
- FMGR_FILTER_SET(filter, FMGR_TYPE_IMY);
- }
- if (strstr(mime_types, "smaf"))
- {
- FMGR_FILTER_SET(filter, FMGR_TYPE_MMF);
- }
- if (strstr(mime_types, "mp3") || strstr(mime_types, "audio/mpeg")) /* with disagreement */
- {
- FMGR_FILTER_SET(filter, FMGR_TYPE_DAF);
- }
- if (strstr(mime_types, "video/x-msvideo")) /* with disagreement */
- {
- FMGR_FILTER_SET(filter, FMGR_TYPE_AVI);
- }
- if (strstr(mime_types, "amr-wb"))
- {
- FMGR_FILTER_SET(filter, FMGR_TYPE_AWB);
- }
- if (strstr(mime_types, "wma")) /* with disagreement */
- {
- FMGR_FILTER_SET(filter, FMGR_TYPE_WMA);
- }
- if (strstr(mime_types, "audio/aac"))
- {
- FMGR_FILTER_SET(filter, FMGR_TYPE_AAC);
- }
- if (strstr(mime_types, "m4a"))
- {
- FMGR_FILTER_SET(filter, FMGR_TYPE_M4A);
- }
- if (strstr(mime_types, "aiff"))
- {
- FMGR_FILTER_SET(filter, FMGR_TYPE_AIF);
- FMGR_FILTER_SET(filter, FMGR_TYPE_AIFF);
- FMGR_FILTER_SET(filter, FMGR_TYPE_AIFC);
- }
- if (strstr(mime_types, "audio/basic"))
- {
- FMGR_FILTER_SET(filter, FMGR_TYPE_AU);
- FMGR_FILTER_SET(filter, FMGR_TYPE_SND);
- }
- if (strstr(mime_types, "text/vnd.sun.j2me.app-descriptor"))
- {
- FMGR_FILTER_SET(filter, FMGR_TYPE_JAD);
- }
- if (strstr(mime_types, "application/java-archive"))
- {
- FMGR_FILTER_SET(filter, FMGR_TYPE_JAR);
- }
- if (strstr(mime_types, "application/vnd.mtk.lrc"))
- {
- FMGR_FILTER_SET(filter, FMGR_TYPE_LRC);
- }
- if (strstr(mime_types, "image/svg+xml"))
- {
- FMGR_FILTER_SET(filter, FMGR_TYPE_SVG);
- }
- if (strstr(mime_types, "application/vnd.mtk.m3d"))
- {
- FMGR_FILTER_SET(filter, FMGR_TYPE_M3D);
- }
- return;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_convert_to_mms_insert_type
- * DESCRIPTION
- * Insert object
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- U32 mmi_uc_convert_to_mms_insert_type(mmi_uc_object_type object_type)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (object_type)
- {
- case MMI_UC_OBJECT_TYPE_IMAGE:
- {
- return MMA_INSERT_IMAGE;
- }
- break;
- case MMI_UC_OBJECT_TYPE_AUDIO:
- {
- return MMA_INSERT_AUDIO;
- }
- break;
- case MMI_UC_OBJECT_TYPE_VIDEO:
- {
- return MMA_INSERT_VIDEO;
- }
- break;
- case MMI_UC_OBJECT_TYPE_ATTACHMENT:
- {
- return MMA_INSERT_ATTACHMENT;
- }
- break;
- case MMI_UC_OBJECT_TYPE_TEXT:
- {
- return MMA_INSERT_TEXT;
- }
- break;
- default:
- {
- MMI_ASSERT(0);
- }
- break;
- }
- return MMA_INSERT_UNKNOWN;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_convert_mms_insert_type_to_uc
- * DESCRIPTION
- * Insert object
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- mmi_uc_object_type mmi_uc_convert_mms_insert_type_to_uc(U32 object_type)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (object_type)
- {
- case MMA_INSERT_IMAGE:
- {
- return MMI_UC_OBJECT_TYPE_IMAGE;
- }
- break;
- case MMA_INSERT_AUDIO:
- {
- return MMI_UC_OBJECT_TYPE_AUDIO;
- }
- break;
- case MMA_INSERT_VIDEO:
- {
- return MMI_UC_OBJECT_TYPE_VIDEO;
- }
- break;
- case MMA_INSERT_ATTACHMENT:
- {
- return MMI_UC_OBJECT_TYPE_ATTACHMENT;
- }
- break;
- case MMA_INSERT_TEXT:
- {
- return MMI_UC_OBJECT_TYPE_TEXT;
- }
- break;
- default:
- {
- MMI_ASSERT(0);
- }
- break;
- }
- return 0;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_convert_to_editor_object_type
- * DESCRIPTION
- * Insert object
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- U32 mmi_uc_convert_to_editor_object_type(mmi_uc_object_type object_type)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (object_type)
- {
- case MMI_UC_OBJECT_TYPE_IMAGE:
- {
- return WGUI_UCE_OBJECT_TYPE_IMAGE;
- }
- break;
- case MMI_UC_OBJECT_TYPE_AUDIO:
- {
- return WGUI_UCE_OBJECT_TYPE_AUDIO;
- }
- break;
- case MMI_UC_OBJECT_TYPE_VIDEO:
- {
- return WGUI_UCE_OBJECT_TYPE_VIDEO;
- }
- break;
- case MMI_UC_OBJECT_TYPE_ATTACHMENT:
- {
- return WGUI_UCE_OBJECT_TYPE_ATTACHMENT;
- }
- break;
- default:
- {
- MMI_ASSERT(0);
- }
- break;
- }
- return 0;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_convert_to_editor_msg_type
- * DESCRIPTION
- * Insert object
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- U32 mmi_uc_convert_to_editor_msg_type(mmi_uc_msg_type_enum msg_type)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (msg_type)
- {
- case MMI_UC_MSG_TYPE_SMS_PREFER:
- case MMI_UC_MSG_TYPE_SMS_ONLY:
- {
- return WGUI_UCE_MSG_TYPE_SMS;
- }
- break;
- case MMI_UC_MSG_TYPE_MMS_PREFER:
- case MMI_UC_MSG_TYPE_MMS_ONLY:
- {
- return WGUI_UCE_MSG_TYPE_MMS;
- }
- break;
- default:
- {
- MMI_ASSERT(0);
- }
- break;
- }
- return 0;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_display_popup
- * DESCRIPTION
- * Display result popup
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_display_popup(mmi_uc_result result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (result)
- {
- case MMI_UC_OK:
- {
- DisplayPopup(
- (PU8) GetString(STR_GLOBAL_OK),
- IMG_GLOBAL_OK,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) SUCCESS_TONE);
- }
- break;
- case MMI_UC_SIZE_EXCEEDS:
- {
- DisplayPopup(
- (PU8) GetString(STR_UC_MSG_SIZE_EXCEED_ID),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- break;
- case MMI_UC_PROHIBIT_BY_CREATION_MODE:
- {
- DisplayPopup(
- (PU8) GetString(STR_UC_PROHIBIT_BY_CREATION_MODE_ID),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- break;
- case MMI_UC_PROHIBIT_BY_DRM:
- {
- DisplayPopup(
- (PU8) GetString(STR_GLOBAL_DRM_PROHIBITED),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- break;
- case MMI_UC_NO_SPACE:
- {
- DisplayPopup(
- (PU8) GetString(STR_UC_NO_SPACE_ID),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- break;
- case MMI_UC_STORAGE_FULL:
- {
- DisplayPopup(
- (PU8) GetString(STR_UC_STORAGE_FULL_ID),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- break;
- case MMI_UC_XML_ERROR:
- {
- DisplayPopup(
- (PU8) GetString(STR_UC_CONTENT_ERROR_ID),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- break;
- case MMI_UC_ERROR:
- {
- DisplayPopup(
- (PU8) GetString(STR_GLOBAL_UNFINISHED),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- break;
- case MMI_UC_NOT_SUPPORT:
- {
- DisplayPopup(
- (PU8) GetString(STR_UC_NOT_SUPPORT_ID),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- break;
- default:
- {
- MMI_ASSERT(0);
- }
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_display_mma_result_popup
- * DESCRIPTION
- * Display result popup
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_display_mma_result_popup(mma_result_enum result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (result)
- {
- case MMA_RESULT_OK:
- {
- DisplayPopup(
- (PU8) GetString(STR_GLOBAL_OK),
- IMG_GLOBAL_OK,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) SUCCESS_TONE);
- }
- break;
- case MMA_RESULT_FAIL_UNSUPPORT_CONTENT:
- {
- DisplayPopup(
- (PU8) GetString(STR_UC_UNSUPPORT_CONTENT_ID),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- break;
- case MMA_RESULT_FAIL_CREATION_MODE_MAX_MSG_SIZE_REACHED:
- {
- DisplayPopup(
- (PU8) GetString(STR_UC_CREATION_MODE_MAX_MSG_SIZE_REACHED_ID),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- break;
- case MMA_RESULT_FAIL_MAX_SLIDE_NUM_REACHED:
- {
- DisplayPopup(
- (PU8) GetString(STR_UC_MAX_SLIDE_NUM_REACHED_ID),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- break;
- case MMA_RESULT_FAIL_MAX_MSG_NUM_REACHED:
- {
- DisplayPopup(
- (PU8) GetString(STR_UC_TOO_MANY_MSG_ID),
- 0,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- break;
- case MMA_RESULT_FAIL_INSUFFICIENT_STORAGE:
- {
- DisplayPopup(
- (PU8) GetString(STR_UC_STORAGE_FULL_DELETE_FILE_ID),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- break;
- case MMA_RESULT_FAIL_NOT_READY:
- case MMA_RESULT_FAIL_BUSY:
- {
- DisplayPopup(
- (PU8) GetString(STR_GLOBAL_NOT_AVAILABLE),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- break;
- default:
- {
- DisplayPopup(
- (PU8) GetString(STR_GLOBAL_UNFINISHED),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_display_mma_send_result_popup
- * DESCRIPTION
- * Display result popup
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_display_mma_send_result_popup(mma_result_enum result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_uc_p->send_info.fail_cause != NULL && pfnUnicodeStrlen((S8*)g_uc_p->send_info.fail_cause))
- {
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
- "*[UnifiedComposerMiscell.c] mmi_uc_display_mma_send_result_popup fail_string result=%d*n",
- result));
- DisplayPopup(
- (PU8) g_uc_p->send_info.fail_cause,
- 0,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- return;
- }
- switch (result)
- {
- case MMA_RESULT_OK:
- {
- DisplayPopup(
- (PU8) GetString(STR_UC_SENT_ID),
- IMG_SEND_SUCCESS_PIC_MSG,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) SUCCESS_TONE);
- }
- break;
- case MMA_RESULT_FAIL_USER_CANCEL:
- {
- DisplayPopup(
- (PU8) GetString(STR_UC_ABORTED_ID),
- IMG_GLOBAL_ACTIVATED,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) SUCCESS_TONE);
- }
- break;
- case MMA_RESULT_FAIL_COMM_CONFIG_ERROR:
- {
- DisplayPopup(
- (PU8) GetString(STR_UC_CONFIG_ERROR_ID),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- break;
- case MMA_RESULT_FAIL_COMM_CONNECT_ERROR:
- {
- DisplayPopup(
- (PU8) GetString(STR_UC_SEND_FAIL_ID),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- break;
- case MMA_RESULT_FAIL_COMM_SERVER_TIMEOUT:
- {
- DisplayPopup(
- (PU8) GetString(STR_UC_SERVER_TIMEOUT_ID),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- break;
- case MMA_RESULT_FAIL_COMM_SERVER_ERROR:
- {
- DisplayPopup(
- (PU8) GetString(STR_UC_SERVER_ERROR_ID),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- break;
- case MMA_RESULT_FAIL_COMM_SERVICE_DENIED:
- {
- DisplayPopup(
- (PU8) GetString(STR_UC_SERVICE_DENIED_ID),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- break;
- case MMA_RESULT_FAIL_COMM_UNSUPPORT_CONTENT:
- {
- DisplayPopup(
- (PU8) GetString(STR_UC_UNSUPPORT_CONTENT_BY_SERVER_ID),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- break;
- case MMA_RESULT_FAIL_COMM_UNKNOWN_APN:
- {
- DisplayPopup(
- (PU8) GetString(STR_UC_UNKNOWN_APN_ID),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- break;
- case MMA_RESULT_FAIL_COMM_UNAUTHORIZED:
- {
- DisplayPopup(
- (PU8) GetString(STR_UC_UNAUTHORIZED_ID),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- break;
- case MMA_RESULT_FAIL_NOT_READY:
- case MMA_RESULT_FAIL_BUSY:
- {
- DisplayPopup(
- (PU8) GetString(STR_GLOBAL_NOT_AVAILABLE),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- break;
- default:
- {
- DisplayPopup(
- (PU8) GetString(STR_UC_SEND_FAIL_ID),
- IMG_SEND_FAIL_PIC_MSG,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_display_resize_result_popup
- * DESCRIPTION
- * Display result popup
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_display_resize_result_popup(U16 result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (result)
- {
- case MMI_UC_RESIZING_SUCCEED:
- case MMI_UC_RESIZING_SUCCEED_WITH_UNCHANGED:
- {
- MMI_ASSERT(0);
- }
- break;
- case MMI_UC_RESIZING_FAILED_IN_GDI_ENCODER_ERR_DISK_FULL:
- {
- DisplayPopup(
- (PU8) GetString(STR_UC_STORAGE_FULL_ID),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- break;
- case MMI_UC_RESIZING_FAILED_IN_INSUFFICIENT_DRAWING_BUF:
- case MMI_UC_RESIZING_FAILED_IN_NO_QUOTA:
- {
- DisplayPopup(
- (PU8) GetString(STR_UC_SYSTEM_RESOURCES_EXHAUSTED_ID),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- break;
- case MMI_UC_RESIZING_FAILED_IN_UNKNOWN_DIMENSION:
- {
- DisplayPopup(
- (PU8) GetString(STR_UC_FILE_CORRUPT_ID),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- break;
- case MMI_UC_RESIZING_FAILED_IN_GDI_FAILED:
- case MMI_UC_RESIZING_FAILED_IN_GDI_ENCODER_ERR_WRITE_PROTECTION:
- case MMI_UC_RESIZING_FAILED_IN_GDI_ENCODER_ERR_NO_DISK:
- default:
- {
- DisplayPopup(
- (PU8) GetString(STR_UC_FAIL_TO_RESIZE_IMAGE_ID),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MMI_UC_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_convert_mms_check_result
- * DESCRIPTION
- * Translate mms_uc_insert_check_struct to mmi_uc_result
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- mmi_uc_result mmi_uc_convert_mms_check_result(mma_insert_check_struct* check_result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (check_result->result)
- {
- return MMI_UC_OK;
- }
- else
- {
- if (check_result->oversize)
- {
- return MMI_UC_SIZE_EXCEEDS;
- }
- if (check_result->creation_mode_violate)
- {
- return MMI_UC_PROHIBIT_BY_CREATION_MODE;
- }
- if (check_result->drm_type == MMA_DRM_FL_CD ||
- check_result->drm_type == MMA_DRM_SD_NO_RIGHT)
- {
- return MMI_UC_PROHIBIT_BY_DRM;
- }
- }
- return MMI_UC_NOT_SUPPORT;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_insert_slide
- * DESCRIPTION
- * Insert empty slide next to cur_slide
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- mmi_uc_slide_struct* mmi_uc_insert_slide(mmi_uc_slide_struct* cur_slide)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_uc_slide_struct* new_slide;
- U32 slide_size;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- slide_size = sizeof(mmi_uc_slide_struct);
- new_slide = kal_adm_alloc(g_uc_p->main.mem_pool_id, slide_size);
- MMI_ASSERT(new_slide);
- memset(new_slide, 0, slide_size);
- g_uc_p->msg.total_slide_num++;
- new_slide->duration = g_uc_p->mms_info.sliding_time.value;
- MMI_ASSERT(g_uc_p->msg.total_slide_num <= MMI_UC_MAX_MMS_SLIDE_NUM);
- /* First slide */
- if (cur_slide == NULL)
- {
- //MMI_ASSERT( g_uc_p->msg.total_slide_num == 1 );
- new_slide->next = g_uc_p->msg.slide_head;
- new_slide->previous = NULL;
- if (g_uc_p->msg.slide_head)
- {
- g_uc_p->msg.slide_head->previous = new_slide;
- }
- g_uc_p->msg.slide_head = new_slide;
- new_slide->slide_num = 1;
- if (new_slide->next)
- {
- mmi_uc_slide_struct* update_slide = mmi_uc_get_end_slide();
- while (update_slide != new_slide)
- {
- update_slide->slide_num++;
- mmi_uc_update_text_object_path(update_slide);
- update_slide = update_slide->previous;
- }
- }
- }
- else
- {
- new_slide->slide_num = cur_slide->slide_num + 1;
- new_slide->next = cur_slide->next;
- new_slide->previous = cur_slide;
- if (cur_slide->next)
- {
- mmi_uc_slide_struct* update_slide = mmi_uc_get_end_slide();
- cur_slide->next->previous = new_slide;
- while (update_slide != new_slide)
- {
- update_slide->slide_num++;
- mmi_uc_update_text_object_path(update_slide);
- update_slide = update_slide->previous;
- }
- }
- cur_slide->next = new_slide;
- }
- return new_slide;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_check_duplicate_object
- * DESCRIPTION
- * Check duplicate object
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- mmi_uc_object_struct* mmi_uc_check_duplicate_object(U16* filePath)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_uc_object_struct* obj = g_uc_p->msg.object_head;
- U32 i = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_uc_p->msg.total_object_num == 0)
- {
- MMI_ASSERT(obj == NULL);
- return obj;
- }
- else
- {
- for (; i < g_uc_p->msg.total_object_num ; i++)
- {
- MMI_ASSERT(obj);
- if (pfnUnicodeStrcmp((S8*)obj->file_path, (S8*)filePath) == 0)
- {
- return obj;
- }
- else
- {
- obj = obj->next;
- }
- }
- }
- return NULL;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_check_duplicate_object_by_filename
- * DESCRIPTION
- * Check duplicate object by file name
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- mmi_uc_object_struct* mmi_uc_check_duplicate_object_by_filename(U16* file_name, mmi_uc_object_struct* start_obj)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_uc_object_struct* obj = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (start_obj == NULL)
- {
- obj = g_uc_p->msg.object_head;
- }
- else
- {
- obj = start_obj;
- }
- for (; obj != NULL ; obj = obj->next)
- {
- MMI_ASSERT(obj);
- if (pfnUnicodeStrcmp((S8*)obj->file_name, (S8*)file_name) == 0)
- {
- return obj;
- }
- }
- return NULL;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_check_if_exceed_MMS_size_limitation
- * DESCRIPTION
- * Insert object
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- BOOL mmi_uc_check_if_exceed_MMS_size_limitation(U32 size)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
- "*[UnifiedComposerMiscell.c] mmi_uc_check_if_exceed_MMS_size_limitation size=%d mms_max_size=%d *n",
- size,
- g_uc_p->mms_info.max_mms_size));
- if (size <= g_uc_p->mms_info.max_mms_size)
- {
- return MMI_FALSE;
- }
- else
- {
- return MMI_TRUE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_insert_object_to_slide
- * DESCRIPTION
- * Insert object
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_insert_object_to_slide(mmi_uc_object_struct* object, mmi_uc_slide_struct* slide, mmi_uc_object_type object_type)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (object_type)
- {
- case MMI_UC_OBJECT_TYPE_IMAGE:
- {
- slide->image.object = object;
- slide->image.begin = MMI_UC_INVALID_VALUE;
- slide->image.end = MMI_UC_INVALID_VALUE;
- object->reference_count++;
- }
- break;
- case MMI_UC_OBJECT_TYPE_AUDIO:
- {
- slide->audio.object = object;
- slide->audio.begin = MMI_UC_INVALID_VALUE;
- slide->audio.end = MMI_UC_INVALID_VALUE;
- object->reference_count++;
- }
- break;
- case MMI_UC_OBJECT_TYPE_VIDEO:
- {
- slide->video.object = object;
- slide->video.begin = MMI_UC_INVALID_VALUE;
- slide->video.end = MMI_UC_INVALID_VALUE;
- object->reference_count++;
- }
- break;
- case MMI_UC_OBJECT_TYPE_TEXT:
- {
- slide->text.object = object;
- slide->text.background_color = MMI_UC_DEFAULT_BG_COLOR;
- slide->text.foreground_color = MMI_UC_DEFAULT_FG_COLOR;
- slide->text.begin = MMI_UC_INVALID_VALUE;
- slide->text.end = MMI_UC_INVALID_VALUE;
- object->reference_count++;
- }
- break;
- default:
- {
- MMI_ASSERT(0);
- }
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_initialize_editor
- * DESCRIPTION
- * Initialize editor
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_editor_initialize()
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- wgui_uce_initialize_editor( g_uc_p->main.text_buffer,
- MMI_UC_TEXT_BUFFER_SIZE / ENCODING_LENGTH,
- g_uc_p->msg.current_slide_num,
- g_uc_p->msg.total_slide_num,
- mmi_uc_get_message_size_callback,
- mmi_uc_text_change_callback);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_convert_to_editor_layout_type
- * DESCRIPTION
- * Insert object
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- U32 mmi_uc_convert_to_editor_layout_type(mmi_uc_layout_enum layout_type)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (layout_type)
- {
- case MMI_UC_LAYOUT_DEFAULT:
- {
- return WGUI_UCE_LAYOUT_TYPE_THUMBNAIL_AT_TOP;
- }
- break;
- case MMI_UC_LAYOUT_THUMBNAIL_AT_TOP:
- {
- return WGUI_UCE_LAYOUT_TYPE_THUMBNAIL_AT_TOP;
- }
- break;
- case MMI_UC_LAYOUT_THUMBNAIL_AT_BOTTOM:
- {
- return WGUI_UCE_LAYOUT_TYPE_THUMBNAIL_AT_BOTTOM;
- }
- break;
- default:
- {
- MMI_ASSERT(0);
- }
- break;
- }
- return WGUI_UCE_LAYOUT_TYPE_THUMBNAIL_AT_TOP;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_convert_to_mms_layout_type
- * DESCRIPTION
- * Insert object
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- U32 mmi_uc_convert_to_mms_layout_type(mmi_uc_layout_enum layout_type)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (layout_type)
- {
- case MMI_UC_LAYOUT_DEFAULT:
- {
- return MMA_LAYOUT_IMAGE_ON_TOP;
- }
- break;
- case MMI_UC_LAYOUT_THUMBNAIL_AT_TOP:
- {
- return MMA_LAYOUT_IMAGE_ON_TOP;
- }
- break;
- case MMI_UC_LAYOUT_THUMBNAIL_AT_BOTTOM:
- {
- return MMA_LAYOUT_TEXT_ON_TOP;
- }
- break;
- default:
- {
- MMI_ASSERT(0);
- }
- break;
- }
- return MMA_LAYOUT_IMAGE_ON_TOP;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_convert_mms_layout_type_to_uc
- * DESCRIPTION
- * Insert object
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- U32 mmi_uc_convert_mms_layout_type_to_uc(U8 layout_type)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (layout_type)
- {
- case MMA_LAYOUT_NONE:
- {
- return MMI_UC_LAYOUT_DEFAULT;
- }
- break;
- case MMA_LAYOUT_IMAGE_ON_TOP:
- {
- return MMI_UC_LAYOUT_THUMBNAIL_AT_TOP;
- }
- break;
- case MMA_LAYOUT_TEXT_ON_TOP:
- {
- return MMI_UC_LAYOUT_THUMBNAIL_AT_BOTTOM;
- }
- break;
- default:
- {
- MMI_ASSERT(0);
- }
- break;
- }
- return MMI_UC_LAYOUT_THUMBNAIL_AT_TOP;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_editor_add_object
- * DESCRIPTION
- * Add object to editor
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_editor_add_object(mmi_uc_object_struct* object, mmi_uc_object_type object_type)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wgui_uce_object_type_enum uce_object_type = mmi_uc_convert_to_editor_object_type(object_type);
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (object_type == MMI_UC_OBJECT_TYPE_IMAGE ||
- object_type == MMI_UC_OBJECT_TYPE_VIDEO)
- {
- if (object->drm_type == MMA_DRM_NONE ||
- object->drm_type == MMA_DRM_SD)
- {
- if (object->is_virtual_file)
- {
- U8 virtual_file_name[FS_GenVFN_SIZE + FMGR_MAX_EXT_LEN * ENCODING_LENGTH];
- S32 result;
- memset(virtual_file_name, 0, FS_GenVFN_SIZE + FMGR_MAX_EXT_LEN * ENCODING_LENGTH);
- if (g_uc_p->main.file_handle > 0)
- {
- FS_Close(g_uc_p->main.file_handle);
- g_uc_p->main.file_handle = 0;
- }
- g_uc_p->main.file_handle = FS_Open(object->file_path, FS_READ_ONLY | FS_OPEN_SHARED);
- if (g_uc_p->main.file_handle <= 0)
- {
- MMI_ASSERT(0);
- }
- result = FS_GenVirtualFileName(
- g_uc_p->main.file_handle,
- (U16*)virtual_file_name,
- (unsigned int)FS_GenVFN_SIZE,
- object->offset,
- object->size);
- if (result < 0)
- {
- MMI_ASSERT(0);
- }
- pfnUnicodeStrcat((PS8) virtual_file_name, (PS8) L".");
- MMI_ASSERT(mmi_uc_get_file_extension(object->file_name));
- pfnUnicodeStrcat((PS8) virtual_file_name, (PS8) mmi_uc_get_file_extension(object->file_name));
- wgui_uce_add_object( uce_object_type,
- (U16*)virtual_file_name,
- 0,
- mmi_uc_convert_to_editor_layout_type(g_uc_p->msg.layout));
- }
- else
- {
- wgui_uce_add_object( uce_object_type,
- object->file_path,
- 0,
- mmi_uc_convert_to_editor_layout_type(g_uc_p->msg.layout));
- }
- }
- else
- {
- wgui_uce_add_object( uce_object_type,
- NULL,
- IMG_UC_DRM_THUMBNAIL_ID,
- mmi_uc_convert_to_editor_layout_type(g_uc_p->msg.layout));
- }
- }
- else
- {
- wgui_uce_add_object(uce_object_type, NULL, 0, 0);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_insert_object
- * DESCRIPTION
- * Insert object
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- mmi_uc_object_struct* mmi_uc_insert_object(S8* filePath, mmi_uc_object_type object_type)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_uc_object_struct* new_object;
- U16* file_name;
- U32 object_size;
- U16 file_path_len = pfnUnicodeStrlen(filePath);
- U16 file_name_len = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- object_size = sizeof(mmi_uc_object_struct);
- new_object = kal_adm_alloc(g_uc_p->main.mem_pool_id, object_size);
- MMI_ASSERT(new_object);
- memset(new_object, 0, object_size);
- /* file path */
- new_object->file_path = kal_adm_alloc(g_uc_p->main.mem_pool_id, (file_path_len + 1 ) * 2);
- MMI_ASSERT(new_object->file_path);
- memset(new_object->file_path, 0, (file_path_len + 1) * 2);
- pfnUnicodeStrncpy((S8*)new_object->file_path, (S8*)filePath, file_path_len);
- /* file name */
- file_name = mmi_uc_get_file_name((U16*)filePath);
- file_name_len = pfnUnicodeStrlen((S8*)file_name);
- new_object->file_name = kal_adm_alloc(g_uc_p->main.mem_pool_id, (file_name_len + 1 ) * 2);
- MMI_ASSERT(new_object->file_name);
- memset(new_object->file_name, 0, (file_name_len + 1) * 2);
- pfnUnicodeStrncpy((S8*)new_object->file_name, (S8*)file_name, file_name_len);
- /* type */
- new_object->type = object_type;
- /* size */
- new_object->size = applib_get_file_size((kal_wchar*)filePath);
- /* Default value! caller should update these value if necessary. */
- new_object->offset = 0;
- new_object->drm_type = MMA_DRM_NONE;
- new_object->is_virtual_file = MMI_FALSE;
- g_uc_p->msg.total_object_num++;
- /* First object */
- if (g_uc_p->msg.object_head == NULL)
- {
- g_uc_p->msg.object_head = new_object;
- new_object->next = NULL;
- new_object->previous = NULL;
- }
- else
- {
- /* Insert new object in the list head */
- new_object->next = g_uc_p->msg.object_head;
- new_object->previous = NULL;
- g_uc_p->msg.object_head->previous = new_object;
- g_uc_p->msg.object_head = new_object;
- }
- return new_object;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_insert_attachment
- * DESCRIPTION
- * Insert attachment
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- mmi_uc_attachment_info_struct* mmi_uc_insert_attachment()
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_uc_attachment_info_struct* new_attach;
- U32 attach_size;
- U32 i = 1;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- attach_size = sizeof(mmi_uc_attachment_info_struct);
- new_attach = kal_adm_alloc(g_uc_p->main.mem_pool_id, attach_size);
- MMI_ASSERT(new_attach);
- memset(new_attach, 0, attach_size);
- if (g_uc_p->msg.total_attachment_num == 0)
- {
- MMI_ASSERT(g_uc_p->msg.attachment_head == NULL);
- g_uc_p->msg.attachment_head = new_attach;
- new_attach->next = NULL;
- new_attach->previous = NULL;
- }
- else
- {
- mmi_uc_attachment_info_struct* cur_attach = g_uc_p->msg.attachment_head;
- MMI_ASSERT(cur_attach);
- for ( ; cur_attach->next != NULL; cur_attach = cur_attach->next)
- {
- i++;
- }
- MMI_ASSERT(i == g_uc_p->msg.total_attachment_num);
- cur_attach->next = new_attach;
- new_attach->next = NULL;
- new_attach->previous = cur_attach;
- }
- g_uc_p->msg.total_attachment_num++;
- return new_attach;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_insert_object_to_attachment
- * DESCRIPTION
- * Insert object
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_insert_object_to_attachment(mmi_uc_object_struct* object,mmi_uc_attachment_info_struct* attachment)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- attachment->object = object;
- object->reference_count++;
- return;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_get_file_name
- * DESCRIPTION
- * Get file name
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- U16* mmi_uc_get_file_name(U16* filePath)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U32 file_path_len = pfnUnicodeStrlen((S8*)filePath);
- U16* cur_position;
- U16* pre_position;
- S32 i = file_path_len - 1;
- U8 pattern[3 * ENCODING_LENGTH];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset(pattern, 0, sizeof(pattern));
- AnsiiNToUnicodeString((S8*)pattern, "\", 1);
- for (; i >= 0 ; i--)
- {
- cur_position = &(filePath[i]);
- pre_position = cur_position - 1;
- if (pfnUnicodeStrncmp((S8*)pre_position, (S8*)pattern, 1) == 0)
- {
- return cur_position;
- }
- }
- return filePath;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_get_file_extension
- * DESCRIPTION
- * Get file name
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- U16* mmi_uc_get_file_extension(U16* filePath)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U32 file_path_len = pfnUnicodeStrlen((S8*)filePath);
- U16* cur_position;
- U16* pre_position;
- S32 i = file_path_len - 1;
- U8 pattern[3 * ENCODING_LENGTH];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset(pattern, 0, sizeof(pattern));
- AnsiiNToUnicodeString((S8*)pattern, ".", 1);
- for (; i >= 0 ; i--)
- {
- cur_position = &(filePath[i]);
- pre_position = cur_position - 1;
- if (pfnUnicodeStrncmp((S8*)pre_position, (S8*)pattern, 1) == 0)
- {
- return cur_position;
- }
- }
- return NULL;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_set_index
- * DESCRIPTION
- * Set highlighted idnex
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_set_index(S32 hilited_index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_uc_p->main.object_index = hilited_index;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_delete_object_from_list
- * DESCRIPTION
- * delete object from list
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_delete_object_from_list(mmi_uc_object_struct* object)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (object == g_uc_p->msg.object_head)
- {
- g_uc_p->msg.object_head = object->next;
- if (object->next)
- {
- object->next->previous = NULL;
- }
- }
- else
- {
- object->previous->next = object->next;
- if (object->next)
- {
- object->next->previous = object->previous;
- }
- }
- g_uc_p->msg.total_object_num--;
- if (object->file_name)
- {
- kal_adm_free(g_uc_p->main.mem_pool_id, object->file_name);
- }
- if (object->file_path)
- {
- kal_adm_free(g_uc_p->main.mem_pool_id, object->file_path);
- }
- kal_adm_free(g_uc_p->main.mem_pool_id, object);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_attachment_info_struct
- * DESCRIPTION
- * get attachment by index
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- mmi_uc_attachment_info_struct* mmi_uc_get_attachment_by_index(U16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_uc_attachment_info_struct* att = g_uc_p->msg.attachment_head;
- U16 i = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_ASSERT(g_uc_p->msg.attachment_head);
- for (; i < index ; i++)
- {
- MMI_ASSERT(att);
- att = att->next;
- }
- return att;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_delete_attachment_from_list
- * DESCRIPTION
- * delete attachment info from list
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_delete_attachment_from_list(mmi_uc_attachment_info_struct* att)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (att == g_uc_p->msg.attachment_head)
- {
- g_uc_p->msg.attachment_head = att->next;
- if (att->next)
- {
- att->next->previous = NULL;
- }
- }
- else
- {
- att->previous->next = att->next;
- if (att->next)
- {
- att->next->previous = att->previous;
- }
- }
- g_uc_p->msg.total_attachment_num--;
- kal_adm_free(g_uc_p->main.mem_pool_id, att);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_get_object_in_slide
- * DESCRIPTION
- * Get object in slide
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- mmi_uc_object_struct* mmi_uc_get_object_in_slide(mmi_uc_slide_struct* slide, mmi_uc_object_type object_type)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (object_type)
- {
- case MMI_UC_OBJECT_TYPE_IMAGE:
- {
- return slide->image.object;
- }
- break;
- case MMI_UC_OBJECT_TYPE_AUDIO:
- {
- return slide->audio.object;
- }
- break;
- case MMI_UC_OBJECT_TYPE_VIDEO:
- {
- return slide->video.object;
- }
- break;
- default:
- {
- MMI_ASSERT(0);
- }
- break;
- }
- return NULL;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_reset_text_buffer
- * DESCRIPTION
- * Reset text buffer
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_reset_text_buffer(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset(g_uc_p->main.text_buffer, 0, MMI_UC_TEXT_BUFFER_SIZE);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_init_uc_folder
- * DESCRIPTION
- * Create uc folder
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_init_uc_folder(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- FS_HANDLE file_handle;
- S32 result;
- U8 mmi_uc_folder_path[MMI_UC_MAX_TEMP_FILE_LEN];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset(mmi_uc_folder_path, 0, MMI_UC_MAX_TEMP_FILE_LEN);
- MMI_UC_MAKE_FOLDER_PATH(mmi_uc_folder_path);
- /* if the dir exists, delete it */
- file_handle = FS_Open((WCHAR*)mmi_uc_folder_path, FS_OPEN_DIR | FS_READ_ONLY);
- if (file_handle >= 0)
- {
- FS_Close(file_handle);
- FS_XDelete((WCHAR*)mmi_uc_folder_path,
- FS_FILE_TYPE | FS_DIR_TYPE | FS_RECURSIVE_TYPE,
- NULL,
- 0);
- }
- result = FS_CreateDir((WCHAR*)mmi_uc_folder_path);
- if (result < 0)
- {
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
- "*[UnifiedComposerMiscell.c] mmi_uc_init_uc_folder Create DIR FAIL! *n"));
- }
- FS_SetAttributes((unsigned short*)mmi_uc_folder_path, FS_ATTR_DIR | FS_ATTR_HIDDEN);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_save_buffer_to_file
- * DESCRIPTION
- * Save the content of text buffer to file
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- S32 mmi_uc_save_buffer_to_file(U8* file_path, U8* buffer, U16 char_num)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- FS_HANDLE file_handle;
- S32 result = FS_NO_ERROR;
- U32 write_len = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Open the file to write, overwrite if already exists. */
- file_handle = FS_Open((U16*) file_path, FS_CREATE_ALWAYS | FS_READ_WRITE);
- if (file_handle > 0)
- {
- U32 utf8_buffer_size = (char_num * 3 + ENCODING_LENGTH);
- U8* utf8_buffer = applib_mem_screen_alloc(utf8_buffer_size);
- U32 utf8_len = 0;
- MMI_ASSERT(utf8_buffer_size <= MMI_UC_UTF8_TEXT_BUFFER_SIZE);
- memset(utf8_buffer , 0, utf8_buffer_size);
- utf8_len = mmi_chset_ucs2_to_utf8_string(utf8_buffer, utf8_buffer_size, buffer);
- result = FS_Write(file_handle,
- utf8_buffer,
- utf8_len - 1, /* null terminator */
- &write_len);
- applib_mem_screen_free(utf8_buffer);
- FS_Close(file_handle);
- }
- return result;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_switch_slide
- * DESCRIPTION
- * Switch slide
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_switch_slide(mmi_uc_slide_struct* slide)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- //wgui_uce_text_info_struct text_info;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- //memset(&text_info, 0, sizeof(wgui_uce_text_info_struct));
- mmi_uc_reset_text_buffer();
- mmi_uc_editor_initialize();
- mmi_uc_reset_history_guibuffer(SCR_ID_UC_EDITOR);
- if (slide != NULL && slide->text.object)
- {
- mmi_uc_read_file_to_text_buffer((U8*)slide->text.object->file_path);
- //wgui_uce_get_text_info_for_buffer(&text_info, g_uc_p->main.text_buffer);
- //mmi_uc_set_text_info_to_slide(slide, &text_info);
- }
- mmi_uc_set_editor_info(slide);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_set_editor_info
- * DESCRIPTION
- * Set editor info
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_set_editor_info(mmi_uc_slide_struct* slide)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wgui_uce_text_info_struct text_info;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset(&text_info, 0, sizeof(wgui_uce_text_info_struct));
- if (slide != NULL)
- {
- if (slide->text.object)
- {
- mmi_uc_set_text_info_from_slide(slide, &text_info);
- wgui_uce_insert_text(&text_info, g_uc_p->main.text_buffer);
- }
- if (slide->image.object)
- {
- mmi_uc_editor_add_object(slide->image.object, MMI_UC_OBJECT_TYPE_IMAGE);
- }
- if (slide->audio.object)
- {
- mmi_uc_editor_add_object(slide->audio.object, MMI_UC_OBJECT_TYPE_AUDIO);
- }
- if (slide->video.object)
- {
- mmi_uc_editor_add_object(slide->video.object, MMI_UC_OBJECT_TYPE_VIDEO);
- }
- }
- if (g_uc_p->msg.total_attachment_num)
- {
- mmi_uc_editor_add_object(NULL, MMI_UC_OBJECT_TYPE_ATTACHMENT);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_set_text_info_to_slide
- * DESCRIPTION
- * Set text info to slide
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_set_text_info_to_slide(mmi_uc_slide_struct* slide, wgui_uce_text_info_struct* text_info)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- slide->text.char_count = text_info->char_count;
- slide->text.UCS2_count = text_info->UCS2_count;
- slide->text.utf8_msg_len = text_info->utf8_msg_len;
- slide->text.extension_char_count = text_info->extension_char_count;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_set_text_info_from_slide
- * DESCRIPTION
- * Set text info from slide
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_set_text_info_from_slide(mmi_uc_slide_struct* slide, wgui_uce_text_info_struct* text_info)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- text_info->char_count = slide->text.char_count;
- text_info->UCS2_count = slide->text.UCS2_count;
- text_info->utf8_msg_len = slide->text.utf8_msg_len;
- text_info->extension_char_count = slide->text.extension_char_count;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_read_file_to_text_buffer
- * DESCRIPTION
- * Read the file to text buffer
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_read_file_to_text_buffer(U8* file_path)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- FS_HANDLE file_handle;
- U32 result;
- U32 read_len = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Open the file to write, overwrite if already exists. */
- file_handle = FS_Open((U16*) file_path, FS_READ_ONLY | FS_OPEN_SHARED );
- if (file_handle > 0)
- {
- U8* temp_utf8_buffer = applib_mem_screen_alloc(MMI_UC_UTF8_TEXT_BUFFER_SIZE);
- memset(temp_utf8_buffer, 0, MMI_UC_UTF8_TEXT_BUFFER_SIZE);
- result = FS_Read(file_handle,
- temp_utf8_buffer,
- MMI_UC_UTF8_TEXT_BUFFER_SIZE,
- &read_len);
- FS_Close(file_handle);
- if (result == FS_NO_ERROR)
- {
- mmi_chset_utf8_to_ucs2_string(g_uc_p->main.text_buffer, MMI_UC_TEXT_BUFFER_SIZE, temp_utf8_buffer);
- applib_mem_screen_free(temp_utf8_buffer);
- return;
- }
- applib_mem_screen_free(temp_utf8_buffer);
- }
- MMI_ASSERT(0);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_delete_slide
- * DESCRIPTION
- * delete slide
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_delete_slide(mmi_uc_slide_struct* slide)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (slide == g_uc_p->msg.slide_head)
- {
- g_uc_p->msg.slide_head = slide->next;
- if (slide->next)
- {
- slide->next->previous = NULL;
- }
- }
- else
- {
- slide->previous->next = slide->next;
- if (slide->next)
- {
- slide->next->previous = slide->previous;
- }
- }
- g_uc_p->msg.total_slide_num--;
- if (slide->next)
- {
- mmi_uc_slide_struct* update_slide = slide->next;
- while (update_slide)
- {
- update_slide->slide_num--;
- mmi_uc_update_text_object_path(update_slide);
- update_slide = update_slide->next;
- }
- }
- kal_adm_free(g_uc_p->main.mem_pool_id, slide);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_insert_signature_check
- * DESCRIPTION
- * Check if it is needed to insert signature.
- * PARAMETERS
- * void
- * RETURNS
- * kal_bool
- *****************************************************************************/
- void mmi_uc_insert_signature_check(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_MMS_PREFER &&
- g_uc_p->mms_info.signature.enable)
- {
- if (mmi_uc_insert_signature())
- {
- /* Add signature successfully. Initialize editor. */
- //mmi_uc_switch_slide(g_uc_p->msg.current_slide);
- mmi_uc_editor_initialize();
- mmi_uc_set_editor_info(g_uc_p->msg.current_slide);
- }
- }
- else if (g_uc_p->msg_type.curr_msg_type == MMI_UC_MSG_TYPE_SMS_PREFER &&
- g_uc_p->mms_info.signature.enable)
- {
- /* tricky! disallow to insert signature for forward and send case */
- if (g_uc_p->main.state != MMI_UC_STATE_FORWARD &&
- g_uc_p->main.state != MMI_UC_STATE_SEND)
- {
- g_uc_p->msg.signature_inserted = MMI_FALSE;
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_insert_signature
- * DESCRIPTION
- * insert signature
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- BOOL mmi_uc_insert_signature()
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_uc_slide_struct* slide;
- mmi_uc_slide_struct* last_slide;
- U32 i = 1;
- U32 new_slide_size;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_uc_p->msg.signature_inserted)
- {
- g_uc_p->msg.fail_to_insert_signature = MMI_FALSE;
- return MMI_TRUE;
- }
- if (g_uc_p->msg.total_slide_num == MMI_UC_MAX_MMS_SLIDE_NUM)
- {
- g_uc_p->msg.fail_to_insert_signature = MMI_TRUE;
- return MMI_FALSE;
- }
- new_slide_size = wap_mma_uc_calc_object_smil_size(MMA_INSERT_EMPTY_SLIDE, NULL);
- if (mmi_uc_check_if_exceed_MMS_size_limitation(new_slide_size + g_uc_p->msg.msg_size))
- {
- g_uc_p->msg.fail_to_insert_signature = MMI_TRUE;
- return MMI_FALSE;
- }
- for (last_slide = g_uc_p->msg.slide_head; last_slide->next != NULL ; last_slide = last_slide->next)
- {
- i++;
- }
- MMI_ASSERT( i == g_uc_p->msg.total_slide_num);
- slide = mmi_uc_insert_slide(last_slide);
- mmi_uc_update_msg_size();
- if (g_uc_p->mms_info.signature.img_file)
- {
- if (!mmi_uc_insert_signature_file(g_uc_p->mms_info.signature.img_file,
- slide,
- MMI_UC_OBJECT_TYPE_IMAGE))
- {
- mmi_uc_delete_slide_with_object(slide);
- g_uc_p->msg.fail_to_insert_signature = MMI_TRUE;
- return MMI_FALSE;
- }
- mmi_uc_update_msg_size();
- }
- if (g_uc_p->mms_info.signature.audio_file)
- {
- if (!mmi_uc_insert_signature_file(g_uc_p->mms_info.signature.audio_file,
- slide,
- MMI_UC_OBJECT_TYPE_AUDIO))
- {
- mmi_uc_delete_slide_with_object(slide);
- g_uc_p->msg.fail_to_insert_signature = MMI_TRUE;
- return MMI_FALSE;
- }
- mmi_uc_update_msg_size();
- }
- if (g_uc_p->mms_info.signature.video_file)
- {
- if (!mmi_uc_insert_signature_file(g_uc_p->mms_info.signature.video_file,
- slide,
- MMI_UC_OBJECT_TYPE_VIDEO))
- {
- mmi_uc_delete_slide_with_object(slide);
- g_uc_p->msg.fail_to_insert_signature = MMI_TRUE;
- return MMI_FALSE;
- }
- mmi_uc_update_msg_size();
- }
- if (g_uc_p->mms_info.signature.text_file)
- {
- if (!mmi_uc_insert_signature_file(g_uc_p->mms_info.signature.text_file,
- slide,
- MMI_UC_OBJECT_TYPE_TEXT))
- {
- mmi_uc_delete_slide_with_object(slide);
- g_uc_p->msg.fail_to_insert_signature = MMI_TRUE;
- return MMI_FALSE;
- }
- mmi_uc_update_msg_size();
- }
- g_uc_p->msg.fail_to_insert_signature = MMI_FALSE;
- g_uc_p->msg.signature_inserted = MMI_TRUE;
- return MMI_TRUE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_delete_slide_with_object
- * DESCRIPTION
- * delete slide
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_delete_slide_with_object(mmi_uc_slide_struct* slide)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (slide->image.object)
- {
- slide->image.object->reference_count--;
- if (slide->image.object->reference_count == 0)
- {
- mmi_uc_delete_object_from_list(slide->image.object);
- }
- }
- if (slide->audio.object)
- {
- slide->audio.object->reference_count--;
- if (slide->audio.object->reference_count == 0)
- {
- mmi_uc_delete_object_from_list(slide->audio.object);
- }
- }
- if (slide->video.object)
- {
- slide->video.object->reference_count--;
- if (slide->video.object->reference_count == 0)
- {
- mmi_uc_delete_object_from_list(slide->video.object);
- }
- }
- if (slide->text.object)
- {
- S32 result = FS_Delete((U16*)slide->text.object->file_path);
- if ( result != FS_NO_ERROR)
- {
- PRINT_INFORMATION_2((MMI_TRACE_G6_SMS,
- "*[UnifiedComposerMiscell.c] mmi_uc_delete_slide_with_object Delete Text file FAIL! *n"));
- }
- mmi_uc_delete_object_from_list(slide->text.object);
- }
- mmi_uc_delete_slide(slide);
- mmi_uc_reset_layout_if_needed();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_delete_slide_with_object
- * DESCRIPTION
- * delete slide
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- BOOL mmi_uc_insert_signature_file(U16* file_path, mmi_uc_slide_struct* slide, mmi_uc_object_type type)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_uc_object_struct* object;
- mma_insert_type_enum mms_type = mmi_uc_convert_to_mms_insert_type(type);
- mma_insert_check_struct check_result;
- BOOL result = MMI_FALSE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- object = mmi_uc_check_duplicate_object(file_path);
- memset(&check_result, 0, sizeof(mma_insert_check_struct));
- if (object && object->type != MMI_UC_OBJECT_TYPE_ATTACHMENT)
- {
- U32 obj_smil_size = wap_mma_uc_calc_object_smil_size(mms_type, file_path);
- if (mmi_uc_check_if_exceed_MMS_size_limitation(obj_smil_size + g_uc_p->msg.msg_size))
- {
- result = MMI_FALSE;
- }
- else
- {
- mmi_uc_insert_object_to_slide(object, slide, type);
- result = MMI_TRUE;
- }
- }
- else
- {
- wap_mma_uc_insert_object_check(file_path,
- mms_type,
- g_uc_p->msg.msg_size,
- g_uc_p->mms_info.max_mms_size,
- &check_result);
- if (!(check_result.result))
- {
- result = MMI_FALSE;
- }
- else
- {
- if (type == MMI_UC_OBJECT_TYPE_TEXT)
- {
- U8 mmi_uc_text_path[MMI_UC_MAX_TEMP_FILE_LEN];
- FS_HANDLE file_handle;
- U32 file_result = 0;
- U32 read_len = 0;
- U8* buffer = NULL;
- wgui_uce_text_info_struct text_info;
- U32 file_size = applib_get_file_size((kal_wchar*)file_path);
- U32 buffer_size = (file_size + 1);
- U32 write_len = 0;
- U32 ucs2_buffer_size = MMI_UC_UTF8_TEXT_BUFFER_SIZE;
- U8* ucs2_buffer = 0;
- file_handle = FS_Open((U16*) file_path, FS_READ_ONLY );
- if (file_handle <= 0)
- {
- return MMI_FALSE;
- }
- else
- {
- buffer = kal_adm_alloc(g_uc_p->main.mem_pool_id, buffer_size);
- if (buffer == NULL)
- {
- return MMI_FALSE;
- }
- memset(buffer, 0, buffer_size);
- file_result = FS_Read(
- file_handle,
- buffer,
- buffer_size - 1, /* file_size */
- &read_len);
- FS_Close(file_handle);
- if (file_result != FS_NO_ERROR)
- {
- kal_adm_free(g_uc_p->main.mem_pool_id, buffer);
- return MMI_FALSE;
- }
- }
- memset(mmi_uc_text_path, 0, MMI_UC_MAX_TEMP_FILE_LEN);
- MMI_UC_MAKE_TEXT_FILE_PATH(mmi_uc_text_path, slide->slide_num);
- file_handle = FS_Open((U16*) mmi_uc_text_path, FS_CREATE_ALWAYS | FS_READ_WRITE);
- if (file_handle <= 0)
- {
- kal_adm_free(g_uc_p->main.mem_pool_id, buffer);
- return MMI_FALSE;
- }
- result = FS_Write(file_handle,
- buffer,
- buffer_size - 1, /* null terminator */
- &write_len);
- FS_Close(file_handle);
- if (result != FS_NO_ERROR)
- {
- kal_adm_free(g_uc_p->main.mem_pool_id, buffer);
- return MMI_FALSE;
- }
- ucs2_buffer = applib_mem_screen_alloc(ucs2_buffer_size);
- memset(ucs2_buffer,0,ucs2_buffer_size);
- mmi_chset_utf8_to_ucs2_string(ucs2_buffer, ucs2_buffer_size - ENCODING_LENGTH, buffer);
- mmi_uc_editor_initialize();
- memset(&text_info, 0, sizeof(wgui_uce_text_info_struct));
- wgui_uce_get_text_info_for_buffer(&text_info, ucs2_buffer);
- applib_mem_screen_free(ucs2_buffer);
- mmi_uc_set_text_info_to_slide(slide, &text_info);
- object = mmi_uc_insert_object((S8*)mmi_uc_text_path, MMI_UC_OBJECT_TYPE_TEXT);
- mmi_uc_insert_object_to_slide(object, slide, MMI_UC_OBJECT_TYPE_TEXT);
- result = MMI_TRUE;
- }
- else
- {
- object = mmi_uc_insert_object((S8*) file_path, type);
- object->drm_type = check_result.drm_type;
- mmi_uc_insert_object_to_slide(object, slide, type);
- result = MMI_TRUE;
- }
- }
- }
- return result;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_reset_mms_signature
- * DESCRIPTION
- * Reset mms signature info in context
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_reset_mms_signature(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_uc_p->mms_info.signature.text_file)
- {
- kal_adm_free(g_uc_p->main.mem_pool_id, g_uc_p->mms_info.signature.text_file);
- g_uc_p->mms_info.signature.text_file = NULL;
- }
- if (g_uc_p->mms_info.signature.img_file)
- {
- kal_adm_free(g_uc_p->main.mem_pool_id, g_uc_p->mms_info.signature.img_file);
- g_uc_p->mms_info.signature.img_file = NULL;
- }
- if (g_uc_p->mms_info.signature.audio_file)
- {
- kal_adm_free(g_uc_p->main.mem_pool_id, g_uc_p->mms_info.signature.audio_file);
- g_uc_p->mms_info.signature.audio_file = NULL;
- }
- if (g_uc_p->mms_info.signature.video_file)
- {
- kal_adm_free(g_uc_p->main.mem_pool_id, g_uc_p->mms_info.signature.video_file);
- g_uc_p->mms_info.signature.video_file = NULL;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_uc_reset_msg
- * DESCRIPTION
- * Reset msg info in context
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_uc_reset_msg(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (g_uc_p->msg.to_head)
- {
- mmi_uc_delete_addr(g_uc_p->msg.to_head);
- }
- while (g_uc_p->msg.cc_head)
- {
- mmi_uc_delete_addr(g_uc_p->msg.cc_head);
- }
- while (g_uc_p->msg.bcc_head)
- {
- mmi_uc_delete_addr(g_uc_p->msg.bcc_head);
- }
- while (g_uc_p->msg.from)
- {
- mmi_uc_delete_addr(g_uc_p->msg.from);
- }
- while (g_uc_p->msg.slide_head)
- {
- mmi_uc_delete_slide_with_object(g_uc_p->msg.slide_head);
- }
- while (g_uc_p->msg.attachment_head)
- {
- mmi_uc_delete_object_from_list(g_uc_p->msg.attachment_head->object);
- mmi_uc_delete_attachment_from_list(g_uc_p->msg.attachment_head);