SmsPsHandler.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:246k
源码类别:
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:
- * ---------
- * SmsPsHandler.C
- *
- * Project:
- * --------
- * MAUI
- *
- * Description:
- * ------------
- * This file is intends for MMI SMS APP.
- *
- * Author:
- * -------
- * -------
- *
- *============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * 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!!
- *============================================================================
- ****************************************************************************/
- /**
- * Copyright Notice
- * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
- * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
- * (It is illegal to remove this copyright notice from this software or any
- * portion of it)
- */
- /**************************************************************
- FILENAME : SmsPsHandler.c
- PURPOSE : It handles protocol SMS messages.
- REMARKS : nil
- AUTHOR : Magesh K, Hiran
- DATE : 01-01-2003
- **************************************************************/
- #ifdef __MOD_SMSAL__
- //
- //MTK Joy added for FDN check, 1121, shall be removed
- //#define FDN_CHECK_TESTING
- //MTK end
- /* */
- #include "MMI_features.h"
- #include "stdC.h"
- #include "L4Dr1.h"
- #include "PixtelDataTypes.h"
- /* ... Add More MMI header */
- #include "EventsGprot.h"
- #include "HistoryGprot.h"
- #include "GlobalMenuItems.h"
- #include "GlobalConstants.h"
- #include "Globaldefs.h"
- #include "wgui_categories.h"
- #include "CustMenuRes.h"
- #include "CommonScreens.h"
- #include "Unicodexdcl.h"
- #include "TimerEvents.h"
- #include "DebugInitDef.h"
- #include "ProtocolEvents.h"
- /* ...Add MSG header */
- #include "customer_ps_inc.h"
- #include "mmi_msg_context.h"
- #include "MessagesL4Def.h"
- #include "MessagesResourceData.h"
- #include "MessagesMiscell.h"
- #include "MessagesExDcl.h"
- #include "SmsGuiInterfaceProt.h"
- #include "SMsGuiInterfaceType.h"
- #include "SmsPsHandler.h"
- #include "CellBroadcastType.h"
- #ifdef __MMI_MESSAGES_CHAT__
- #include "ChatAppGprot.h"
- #include "ChatAppDef.h"
- #endif /* __MMI_MESSAGES_CHAT__ */
- /* */
- #include "customer_ps_inc.h"
- #include "l4c2smsal_struct.h"
- #include "smsal_l4c_enum.h"
- #include "ems.h"
- /* */
- #include "Gui_ems.h"
- #include "wgui_ems.h"
- #include "GSM7BitDefaultAlphabet.h"
- /* */
- #include "gpioInc.h"
- #include "CallHistoryGProts.h"
- #include "CallManagementGprot.h"
- #include "CallStructureManagementProt.h"
- #include "IdleAppProt.h"
- #include "SettingProfile.h"
- #include "ProfileGprots.h"
- #include "AlarmFrameworkProt.h"
- #include "PhoneBookTypes.h"
- #include "PhoneBookDef.h"
- #include "SimDetectionGexdcl.h"
- #include "SettingDefs.h"
- #include "SettingsGdcl.h"
- /* */
- #include "wgui_status_icons.h"
- #include "KeyBrd.h"
- #include "SMSApi.h"
- #include "SMSStruct.h"
- #include "SMSFunc.h"
- #ifdef __MMI_UNIFIED_MESSAGE__
- #include "UnifiedMessageDef.h"
- #include "UnifiedMessageGProt.h"
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- #ifdef __MMI_UNIFIED_COMPOSER__
- #include "UnifiedComposerGProt.h"
- #endif /* __MMI_UNIFIED_COMPOSER__ */
- //KP Jerry add on 2007-4-26 start
- #if defined(__MMI_CM_BLACK_LIST__) && defined(__MMI_CM_WHITE_LIST__)
- #include "ManageCallMain.h"
- #endif
- //KP Jerry add on 2007-4-26 end
- //
- //
- #ifdef __MMI_OPERATOR_LOGO__
- extern void mmi_op_logo_parse_ota_data(void);
- #endif
- #ifdef __MMI_CLI_ICON__
- extern void mmi_cli_icon_parse_ota_data(void);
- #endif
- #ifdef __MMI_MESSAGES_CHAT__
- extern pBOOL gOutBoxSaveFlag;
- extern U16 gChatMsgFlag; /* Added By Alok */
- #endif /* __MMI_MESSAGES_CHAT__ */
- extern msg_active_profile_struct activeProfile;
- extern U16 processRSKStrId;
- extern PS8 lookUpNumber(PS8 number);
- extern void MoveCursorToPosition(EMSData *data, EMSPosition *dst);
- extern void mmi_phb_sms_enter_send_by_group(void);
- extern U16 GetCmMarkerScrnID(void);
- extern MMI_PHB_LIST_VIEW phbListView;
- extern EMSData *GetEMSDataForView(EMSData **p, U8 force);
- extern EMSData *GetEMSDataForEdit(EMSData **p, U8 force);
- extern U8 DeInitMessagesEMSBuffer(msg_ems_data_struct *pE);
- #if defined(__MMI_SMART_MESSAGE_MT__) || (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__))
- #include "PicMsgApiToOthers.h"
- extern U8 gNSMBuffer[];
- extern U8 gaddtext_buffer[];
- extern U8 gOTADataBuffer[];
- #if (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__))
- extern nsm_msg_struct g_nsm_msg_context;
- #endif
- extern S8 g_pmsg_TextInMessage[];
- static U16 gMessageType = 0; /*
- * Flag to identify Message type
- * * 0 - NORMAL MESSAGE
- * * 1 - PICTURE MESSAGE
- * * 2 - RINGTONE MESSAGE
- */
- S32 mmi_nsm_send_pic_msg(U8 *bmpDataPtr, U8 *PicTextPtr, U8 **emsDataT);
- U8 mmi_nsm_prepare_msg(U8 *data, S32 data_len);
- U8 mmi_nsm_pack_and_send_msg(void);
- U16 StuffZerosInBetween(S8 *pOutBuffer, S8 *pInBuffer, U16 size);
- #define ASCIISEGMENTSIZE 252
- static void mmi_nsm_get_picmsg_sendData(mmi_frm_sms_send_struct *sendData);
- #endif /* defined(__MMI_SMART_MESSAGE_MT__) || (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) */
- #if defined(__MMI_SMART_MESSAGE_MT__)
- static S32 ucs2_count = 0; /* For Sending chinese character with pic msg */
- extern nsm_picmsg_text_struct picmsg_text_struct;
- #endif /* defined(__MMI_SMART_MESSAGE_MT__) */
- /*******************************************************
- protocol event handler
- *******************************************************/
- extern msg_msgbox_info_struct msgbox_info;
- extern PendingSaveSendDataStruct PendingSaveSendData;
- extern void mmi_phb_sms_enter_send_entry(void);
- extern U8 mmi_phb_convert_to_digit(U8 *dest, U8 *source, U8 max_dest_len);
- #ifdef __MMI_MESSAGES_SEND_BY_GROUP__
- extern MMI_PHB_ENTRY_BCD_STRUCT PhoneBook[];
- #endif /* ifdef __MMI_MESSAGES_SEND_BY_GROUP__ */
- extern U8 mmi_msg_get_seg_num(void);
- extern U16 mmi_msg_get_msgbox_size(void);
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_handle_ready_ind
- * DESCRIPTION
- *
- * PARAMETERS
- * dummy [?]
- * mod [IN]
- * result [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_handle_ready_ind(void *dummy, module_type mod, U16 result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 totalInbox = mmi_frm_sms_get_sms_list_size(MMI_FRM_SMS_APP_INBOX);
- U16 totalOutbox = mmi_frm_sms_get_sms_list_size(MMI_FRM_SMS_APP_OUTBOX);
- U16 totalDraftbox = mmi_frm_sms_get_sms_list_size(MMI_FRM_SMS_APP_DRAFTS);
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_msg_cntx.msg_init = TRUE;
- mmi_msg_set_msg_num_hint(totalInbox, totalOutbox, totalDraftbox);
- RefreshMessagesMenuList();
- mmi_msg_set_msg_icon(FALSE, FALSE);
- /* it is in the processing screen or the processing screen has been interrupted */
- if (GetMessagesCurrScrnID() == SCR_ID_MSG_PROCESSING || IsScreenPresent(SCR_ID_MSG_PROCESSING))
- {
- if (processRSKStrId == STR_LOADING_INBOX_BACK)
- {
- mmi_msg_entry_inbox_list();
- /* if the processing screen is in the history after entry inbox list */
- DeleteScreenIfPresent(SCR_ID_MSG_PROCESSING);
- }
- else if (processRSKStrId == STR_LOADING_OUTBOX_BACK)
- {
- mmi_msg_entry_outbox_list();
- /* if the processing screen is in the history after entry outbox list */
- DeleteScreenIfPresent(SCR_ID_MSG_PROCESSING);
- }
- #ifdef __MMI_MESSAGES_DRAFT_BOX__
- else if (processRSKStrId == STR_LOADING_DRAFTBOX_BACK)
- {
- mmi_msg_entry_draftbox_list();
- /* if the processing screen is in the history after entry draftbox list */
- DeleteScreenIfPresent(SCR_ID_MSG_PROCESSING);
- }
- #endif /* __MMI_MESSAGES_DRAFT_BOX__ */
- }
- #ifdef __MMI_UNIFIED_MESSAGE__
- mmi_msg_send_ready_ind(KAL_TRUE);
- #endif
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_sync_msgbox_with_at
- * DESCRIPTION
- *
- * PARAMETERS
- * dummy [?]
- * mod [IN]
- * type [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_sync_msgbox_with_at(void *dummy, module_type mod, U16 type)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 todelscrid = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_UNIFIED_MESSAGE__
- #ifdef __UNIFIED_MESSAGE_LIST_OPTION_SUPPORT__
- if (GetMessagesCurrScrnID() == SCR_ID_MSG_INBOX_LIST_OPTION || IsScreenPresent(SCR_ID_MSG_INBOX_LIST_OPTION))
- {
- todelscrid = SCR_ID_MSG_INBOX_LIST_OPTION;
- }
- else if (GetMessagesCurrScrnID() == SCR_ID_MSG_OUTBOX_LIST_OPTION || IsScreenPresent(SCR_ID_MSG_OUTBOX_LIST_OPTION))
- {
- todelscrid = SCR_ID_MSG_OUTBOX_LIST_OPTION;
- }
- else if (GetMessagesCurrScrnID() == SCR_ID_MSG_DEFAULT_LIST_OPTION || IsScreenPresent(SCR_ID_MSG_DEFAULT_LIST_OPTION))
- {
- todelscrid = SCR_ID_MSG_DEFAULT_LIST_OPTION;
- }
- else
- #endif /* __UNIFIED_MESSAGE_LIST_OPTION_SUPPORT__ */
- if (GetMessagesCurrScrnID() == SCR_ID_MSG_INBOX_MSG || IsScreenPresent(SCR_ID_MSG_INBOX_MSG))
- {
- todelscrid = SCR_ID_MSG_INBOX_MSG;
- }
- else if (GetMessagesCurrScrnID() == SCR_ID_MSG_OUTBOX_MSG || IsScreenPresent(SCR_ID_MSG_OUTBOX_MSG))
- {
- todelscrid = SCR_ID_MSG_OUTBOX_MSG;
- }
- else if (GetMessagesCurrScrnID() == SCR_ID_MSG_DEFAULT_MSG || IsScreenPresent(SCR_ID_MSG_DEFAULT_MSG))
- {
- todelscrid = SCR_ID_MSG_DEFAULT_MSG;
- }
- /* For L4C_AT_SMS_ADD, the refresh ind would be sent in mmi_frm_sms_get_sms_rsp() */
- if (type != L4C_AT_SMS_ADD)
- {
- mmi_msg_send_refresh_ind(UM_MSG_BOX_TYPE_INBOX | UM_MSG_BOX_TYPE_UNSENT | UM_MSG_BOX_TYPE_SENT |
- UM_MSG_BOX_TYPE_DRAFT);
- }
- #else /* __MMI_UNIFIED_MESSAGE__ */
- U16 totalInbox = mmi_frm_sms_get_sms_list_size(MMI_FRM_SMS_APP_INBOX);
- U16 totalOutbox = mmi_frm_sms_get_sms_list_size(MMI_FRM_SMS_APP_OUTBOX);
- U16 totalDraftbox = mmi_frm_sms_get_sms_list_size(MMI_FRM_SMS_APP_DRAFTS);
- if (GetMessagesCurrScrnID() == SCR_ID_MSG_INBOX_LIST || IsScreenPresent(SCR_ID_MSG_INBOX_LIST))
- {
- todelscrid = SCR_ID_MSG_INBOX_LIST;
- }
- else if (GetMessagesCurrScrnID() == SCR_ID_MSG_OUTBOX_LIST || IsScreenPresent(SCR_ID_MSG_OUTBOX_LIST))
- {
- todelscrid = SCR_ID_MSG_OUTBOX_LIST;
- }
- #ifdef __MMI_MESSAGES_DRAFT_BOX__
- else if (GetMessagesCurrScrnID() == SCR_ID_MSG_DRAFTBOX_LIST || IsScreenPresent(SCR_ID_MSG_DRAFTBOX_LIST))
- {
- todelscrid = SCR_ID_MSG_DRAFTBOX_LIST;
- }
- #endif /* __MMI_MESSAGES_DRAFT_BOX__ */
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- /* For the case of SIM Refresh, the msg screens should be deleted in mmi_frm_sms_sim_refresh_ind() */
- /* If the SMS screens cannot be deleted, do not show the done pupup. */
- if (todelscrid != 0 && g_msg_cntx.MessagesScrnIdDelUptoHistoryNodes != 0 && type != L4C_SMS_SIM_REFRESH)
- {
- /* Do not interrupt calling screen */
- if (!isIncomingCall())
- {
- DisplayPopup(
- (PU8) GetString(STR_GLOBAL_DONE),
- IMG_GLOBAL_ACTIVATED,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) SUCCESS_TONE);
- }
- SetMessagesScrnIdToDelHistoryNodes(todelscrid);
- DeleteMessagesHistoryNodes();
- }
- #ifndef __MMI_UNIFIED_MESSAGE__
- mmi_msg_set_msg_num_hint(totalInbox, totalOutbox, totalDraftbox);
- RefreshMessagesMenuList();
- /* If the new msg is deleted by AT, the new msg indication screen should not be displayed. */
- if (GetExitScrnID() == SCR_ID_MSG_NEW_MSG_IND &&
- type == L4C_AT_SMS_DELETE)
- {
- EntryIdleScreen();
- }
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- mmi_msg_set_msg_icon(FALSE, FALSE);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_handle_msg_waiting_ind
- * DESCRIPTION
- *
- * PARAMETERS
- * inMsg [?]
- * mod [IN]
- * result [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_handle_msg_waiting_ind(void *inMsg, module_type mod, U16 result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_FRM_SMS_MSG_WAITING_IND_STRUCT *msgInd = (MMI_FRM_SMS_MSG_WAITING_IND_STRUCT*) inMsg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (msgInd->is_clear)
- {
- g_msg_cntx.msg_waiting_info[(msgInd->line_no)].number[msgInd->ind_type] = 0;
- mmi_msg_set_msg_waiting_icon(msgInd->line_no, msgInd->ind_type, 0);
- }
- else
- {
- mmi_msg_set_msg_waiting_icon(msgInd->line_no, msgInd->ind_type, 1);
- /* Only display icon for message indication in storage, not from network. */
- if (msgInd->is_from_storage)
- {
- return;
- }
- g_msg_cntx.msg_waiting_line_number = msgInd->line_no;
- if (msgInd->is_show_num)
- {
- g_msg_cntx.msg_waiting_info[(msgInd->line_no)].number[msgInd->ind_type] = msgInd->waiting_num;
- }
- else
- {
- g_msg_cntx.msg_waiting_info[(msgInd->line_no)].number[msgInd->ind_type] = 0;
- }
- mmi_msg_msg_waiting_ind(msgInd->ind_type);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_handle_deliver_report_ind
- * DESCRIPTION
- *
- * PARAMETERS
- * inMsg [?]
- * mod [IN]
- * result [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_handle_deliver_report_ind(void *inMsg, module_type mod, U16 result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 i = 0;
- MMI_FRM_SMS_STATUS_REPORT_IND_STRUCT *msgInd = (MMI_FRM_SMS_STATUS_REPORT_IND_STRUCT*) inMsg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 0; i < MAX_STATUS_REPORT_NUM; i++)
- {
- if (g_msg_cntx.msg_deliver_report[i] == NULL)
- {
- break;
- }
- }
- if (i == MAX_STATUS_REPORT_NUM)
- {
- U8 j = 0;
- OslMfree(g_msg_cntx.msg_deliver_report[0]);
- g_msg_cntx.msg_deliver_ind--;
- for (j = 0; j < (MAX_STATUS_REPORT_NUM - 1); j++)
- {
- g_msg_cntx.msg_deliver_report[j] = g_msg_cntx.msg_deliver_report[j + 1];
- }
- g_msg_cntx.msg_deliver_report[j] = NULL;
- i = j;
- }
- g_msg_cntx.msg_deliver_report[i] = OslMalloc(sizeof(msg_deliver_report_struct));
- g_msg_cntx.msg_deliver_report[i]->delivered = msgInd->st;
- if (msgInd->ra_number.type == CSMCC_INTERNATIONAL_ADDR||
- (msgInd->ra_number.type & 0xf0) == 0x90)
- {
- g_msg_cntx.msg_deliver_report[i]->type = 1;
- }
- else
- {
- g_msg_cntx.msg_deliver_report[i]->type = 0;
- }
- memset((S8*) g_msg_cntx.msg_deliver_report[i]->number, 0, MSG_NUM_LEN);
- memcpy((S8*) g_msg_cntx.msg_deliver_report[i]->number, msgInd->ra_number.number, msgInd->ra_number.length);
- memcpy((S8*) g_msg_cntx.msg_deliver_report[i]->timestamp, msgInd->dt, 6);
- mmi_msg_deliver_report_ind();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_handle_mem_full_ind
- * DESCRIPTION
- *
- * PARAMETERS
- * inMsg [?]
- * mod [IN]
- * result [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_handle_mem_full_ind(void *inMsg, module_type mod, U16 result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_FRM_SMS_MEM_FULL_IND_STRUCT *msgInd = (MMI_FRM_SMS_MEM_FULL_IND_STRUCT*) inMsg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (msgInd->type == SMSAL_MEM_FULL_NORMAL)
- {
- mmi_msg_set_msg_icon(TRUE, FALSE);
- g_msg_cntx.msg_full_ind = TRUE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_handle_mem_exceed_ind
- * DESCRIPTION
- *
- * PARAMETERS
- * inMsg [?]
- * mod [IN]
- * result [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_handle_mem_exceed_ind(void *inMsg, module_type mod, U16 result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_FRM_SMS_MEM_EXCEED_IND_STRUCT *msgInd = (MMI_FRM_SMS_MEM_EXCEED_IND_STRUCT*) inMsg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (msgInd->type == SMSAL_MEM_EXCEED_NORMAL || msgInd->type == SMSAL_SM_EXCEED_WITH_CLASS2)
- {
- g_msg_cntx.msg_exceed_ind = TRUE;
- g_msg_cntx.msg_exceed_type = msgInd->type;
- TurnOnBacklight(1);
- if (IsMMIInIdleState())
- {
- ClearKeyEvents();
- if (IsKeyPadLockState())
- {
- EntryIdleScreen();
- }
- else
- {
- mmi_msg_entry_mem_exceed_ind();
- }
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_handle_mem_avail_ind
- * DESCRIPTION
- *
- * PARAMETERS
- * inMsg [?]
- * mod [IN]
- * result [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_handle_mem_avail_ind(void *inMsg, module_type mod, U16 result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_FRM_SMS_MEM_AVAILABLE_IND_STRUCT *msgInd = (MMI_FRM_SMS_MEM_AVAILABLE_IND_STRUCT*) inMsg;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (msgInd->type == SMSAL_MEM_AVAIL_NORMAL)
- {
- g_msg_cntx.msg_full_ind = FALSE;
- g_msg_cntx.msg_exceed_ind = FALSE;
- mmi_msg_set_msg_icon(FALSE, TRUE);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_handle_class0_msg_ind
- * DESCRIPTION
- *
- * PARAMETERS
- * inMsg [?]
- * content [?]
- * RETURNS
- *
- *****************************************************************************/
- U8 mmi_msg_handle_class0_msg_ind(void *inMsg, void *content)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_frm_sms_deliver_msg_struct *msgInd = (mmi_frm_sms_deliver_msg_struct*) inMsg;
- mmi_frm_sms_concat_struct *concatinfo = (mmi_frm_sms_concat_struct*) & (msgInd->concat_info);
- U8 type = 0;
- S16 len = 0;
- S8 *unicodecontent = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_msg_cntx.msg_class0_p != NULL)
- {
- if (g_msg_cntx.msg_class0_p->data != NULL)
- {
- OslMfree(g_msg_cntx.msg_class0_p->data);
- g_msg_cntx.msg_class0_p->data = NULL;
- }
- OslMfree(g_msg_cntx.msg_class0_p);
- g_msg_cntx.msg_class0_p = NULL;
- }
- g_msg_cntx.msg_class0_p = OslMalloc(sizeof(msg_class0_msg_struct));
- g_msg_cntx.msg_class0_p->length = msgInd->no_msg_data;
- g_msg_cntx.msg_class0_p->fo = msgInd->fo;
- g_msg_cntx.msg_class0_p->dcs = msgInd->dcs;
- g_msg_cntx.msg_class0_p->totalseg = concatinfo->total_seg;
- if (msgInd->addr_number.type == CSMCC_INTERNATIONAL_ADDR ||
- (msgInd->addr_number.type & 0xf0) == 0x90)
- {
- AnsiiToUnicodeString((S8*) g_msg_cntx.msg_class0_p->number, "+");
- type = 1;
- }
- AnsiiNToUnicodeString(
- (S8*) g_msg_cntx.msg_class0_p->number + type * ENCODING_LENGTH,
- (S8*) msgInd->addr_number.number,
- MSG_NUM_LEN);
- memcpy(g_msg_cntx.msg_class0_p->timestamp, msgInd->scts, 6);
- /* content might be unicode or ascii, convert it to unicode and store it to unicodecontent */
- if (g_msg_cntx.msg_class0_p->dcs == SMSAL_UCS2_DCS)
- {
- /* len = (S16)pfnUnicodeStrlen(content); */
- len = g_msg_cntx.msg_class0_p->length;
- unicodecontent = OslMalloc(len + 2);
- memcpy(unicodecontent, content, len);
- memset(unicodecontent + len, 0, 2);
- }
- else
- {
- /* len = strlen(content); */
- len = g_msg_cntx.msg_class0_p->length / 2;
- unicodecontent = OslMalloc((len + 1) * 2);
- AnsiiNToUnicodeString(unicodecontent, content, len);
- memset(unicodecontent + len * 2, 0, 2);
- }
- /* indicate a class0 message with missing segment with (.....) in the front of message content */
- if (!mmi_frm_sms_check_awaited_complete_msg(msgInd->msg_data[0]))
- {
- S8 ascii_miss_str[] = EMS_MISS_SEG_DELIMIT_STR;
- U16 ascii_miss_str_len = strlen((S8*) ascii_miss_str);
- S8 *unicode_miss_str = NULL;
- U16 unicode_miss_str_len = 0; /* the byte number of unicode_miss_str */
- unicode_miss_str = OslMalloc((ascii_miss_str_len + 1) * 2);
- AnsiiNToUnicodeString(unicode_miss_str, ascii_miss_str, ascii_miss_str_len);
- memset(unicode_miss_str + ascii_miss_str_len * 2, 0, 2);
- unicode_miss_str_len = (U16) pfnUnicodeStrlen(unicode_miss_str) * 2;
- /* g_msg_cntx.msg_class0_p->length contains (.....) and the length of unicodecontent */
- g_msg_cntx.msg_class0_p->length = g_msg_cntx.msg_class0_p->length + unicode_miss_str_len;
- g_msg_cntx.msg_class0_p->data = OslMalloc(g_msg_cntx.msg_class0_p->length + ENCODING_LENGTH);
- memset((S8*) g_msg_cntx.msg_class0_p->data, 0, g_msg_cntx.msg_class0_p->length + ENCODING_LENGTH);
- memcpy((S8*) g_msg_cntx.msg_class0_p->data, (S8*) unicode_miss_str, unicode_miss_str_len);
- memcpy(
- (S8*) (g_msg_cntx.msg_class0_p->data + unicode_miss_str_len),
- (S8*) unicodecontent,
- (g_msg_cntx.msg_class0_p->length - unicode_miss_str_len));
- /* free unicode_miss_str buffer */
- OslMfree(unicode_miss_str);
- unicode_miss_str = NULL;
- }
- else
- {
- g_msg_cntx.msg_class0_p->data = OslMalloc(g_msg_cntx.msg_class0_p->length + ENCODING_LENGTH);
- memset((S8*) g_msg_cntx.msg_class0_p->data, 0, g_msg_cntx.msg_class0_p->length + ENCODING_LENGTH);
- memcpy((S8*) g_msg_cntx.msg_class0_p->data, (S8*) unicodecontent, g_msg_cntx.msg_class0_p->length);
- }
- mmi_msg_class0_msg_ind();
- /* free unicodecontent buffer */
- if (unicodecontent != NULL)
- {
- OslMfree(unicodecontent);
- unicodecontent = NULL;
- }
- return FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_handle_new_msg_ind
- * DESCRIPTION
- *
- * PARAMETERS
- * data [?]
- * mod [IN]
- * result [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_handle_new_msg_ind(void *data, module_type mod, U16 result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 index = *(U16*) data;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* copy the message to show, "before" read sms screen it shall be copied again */
- mmi_msg_new_msg_ind(index);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_get_msg_new
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_get_msg_new(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 type;
- U16 list_index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Go back to Idle screen if the new msg is deleted by AT or SIM refresh is ongoing. */
- if (!mmi_msg_need_new_msg_ind() || mmi_frm_sms_is_in_sim_refresh())
- {
- DisplayPopup(
- (PU8) GetString(STR_GLOBAL_UNFINISHED),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- g_msg_cntx.msg_ind_in_idle = FALSE;
- return;
- }
- /* disallow re-entering SMS application when there is a pending SMS job running in the background */
- if (!mmi_frm_sms_check_action_pending())
- {
- mmi_msg_exit_inbox_list_dummy();
- }
- g_msg_cntx.msg_ind_in_idle = FALSE;
- g_msg_cntx.toDisplayMessageList = TO_DISPLAY_MESSAGE_LIST_INBOX;
- mmi_msg_get_msg_req(MMI_FRM_SMS_APP_NOBOX, g_msg_cntx.msg_ind_index);
- mmi_frm_sms_get_list_index(&type, &list_index, g_msg_cntx.msg_ind_index);
- /* map message box index to message list index to get the correct inbox header */
- if (type == MMI_FRM_SMS_APP_INBOX)
- {
- g_msg_cntx.currBoxIndex = list_index;
- if (mmi_frm_sms_get_sms_list_size(MMI_FRM_SMS_NOBOX) != MMI_FRM_SMS_INVALID_INDEX)
- {
- msgbox_info.totalinbox = mmi_frm_sms_get_sms_list_size(MMI_FRM_SMS_APP_INBOX);
- msgbox_info.totaloutbox = mmi_frm_sms_get_sms_list_size(MMI_FRM_SMS_APP_OUTBOX);
- msgbox_info.totaldraftbox = mmi_frm_sms_get_sms_list_size(MMI_FRM_SMS_APP_DRAFTS);
- mmi_msg_set_msg_num_hint(msgbox_info.totalinbox, msgbox_info.totaloutbox, msgbox_info.totaldraftbox);
- RefreshMessagesMenuList();
- }
- }
- }
- #ifdef __MMI_UNIFIED_MESSAGE__
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_delete_msg_after_send_rsp
- * DESCRIPTION
- *
- * PARAMETERS
- * dummy [?]
- * mod [IN]
- * result [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_delete_msg_after_send_rsp(void *dummy, module_type mod, U16 result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- UmMsgBoxType msg_box_type = mmi_um_get_current_msg_box_type();
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (mmi_msg_get_post_send_action_type())
- {
- case MMI_SMS_PS_ACTION_SEND_SUCCESS_REMOVE_MSG:
- {
- DisplayPopup(
- (PU8) GetString(STR_SMS_SEND_SUCCESS),
- IMG_SEND_SUCCESS_PIC_MSG,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) SUCCESS_TONE);
- break;
- }
- case MMI_SMS_PS_ACTION_MOVE_MSG:
- {
- /* Do nothing. */
- mmi_msg_set_post_send_action_type(MMI_SMS_PS_ACTION_DEFAULT);
- return;
- }
- default:
- {
- MMI_ASSERT(0);
- break;
- }
- }
- if (msg_box_type == UM_MSG_BOX_TYPE_UNSENT || msg_box_type == UM_MSG_BOX_TYPE_DRAFT)
- {
- #ifdef __UNIFIED_MESSAGE_LIST_OPTION_SUPPORT__
- if (IsScreenPresent(SCR_ID_MSG_OUTBOX_LIST_OPTION))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_OUTBOX_LIST_OPTION);
- }
- else
- #endif /* __UNIFIED_MESSAGE_LIST_OPTION_SUPPORT__ */
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_OUTBOX_MSG);
- }
- }
- else
- {
- MMI_ASSERT(0);
- }
- #if (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) || defined(__MMI_SMART_MESSAGE_MT__)
- if (mmi_nsm_get_msg_type() != NORMAL_MESSAGE) /* When msg count > 0 */
- {
- if ((IsScreenPresent(SCR_ID_MYPIC_DISPLAY)) && (totalInbox != 0)) /* For pic msg in Inbox list */
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MYPIC_DISPLAY);
- }
- else if ((IsScreenPresent(SCR_ID_MSG_OUTBOX_MSG)) && (totalOutbox != 0)) /* For pic msg in Outbox list */
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_OUTBOX_MSG);
- }
- else if ((IsScreenPresent(SCR_ID_MSG_INBOX_MSG)) && (totalDraftbox != 0)) /* For ringtone in Inbox list */
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_INBOX_MSG);
- }
- #if defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)
- if (g_nsm_msg_context.is_picmsg == TRUE)
- {
- mmi_nsm2_init_nsm_msg_struct(&g_nsm_msg_context);
- }
- #endif /* defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__) */
- }
- #endif /* (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) || defined(__MMI_SMART_MESSAGE_MT__) */
- DeleteMessagesHistoryNodes();
- g_msg_cntx.msg_full_ind = FALSE;
- mmi_msg_set_msg_icon(FALSE, FALSE);
- mmi_msg_set_post_send_action_type(MMI_SMS_PS_ACTION_DEFAULT);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_delete_msg_after_send_req
- * DESCRIPTION
- *
- * PARAMETERS
- * type [IN]
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_delete_msg_after_send_req(U8 type, U16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_frm_sms_delete_sms(mmi_msg_delete_msg_after_send_rsp, MOD_MMI, type, index);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_delete_msg_before_save_rsp
- * DESCRIPTION
- *
- * PARAMETERS
- * dummy [?]
- * mod [IN]
- * result [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_delete_msg_before_save_rsp(void *dummy, module_type mod, U16 result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- UmMsgBoxType msg_box_type = mmi_um_get_current_msg_box_type();
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (result == MMI_FRM_SMS_OK)
- {
- mmi_msg_save_msg_with_flag_req(MMI_FRM_SMS_SAVE_HIGHLIGHT_NEW_MSG_IND);
- }
- else
- {
- if (result == MMI_FRM_SMS_MEMINSUFFICIENT)
- {
- DisplayPopup(
- (PU8) GetString(STR_SMS_FAILURE_MEM_CAP_EXCEEDED),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) WARNING_TONE);
- }
- else
- {
- DisplayPopup(
- (PU8) GetString(STR_GLOBAL_UNFINISHED),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) WARNING_TONE);
- }
- if (msg_box_type == UM_MSG_BOX_TYPE_DRAFT)
- {
- if (IsScreenPresent(SCR_ID_MSG_WRITE_OPTION))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_WRITE_OPTION);
- }
- else
- {
- #ifdef __UNIFIED_MESSAGE_LIST_OPTION_SUPPORT__
- if (IsScreenPresent(SCR_ID_MSG_OUTBOX_LIST_OPTION))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_OUTBOX_LIST_OPTION);
- }
- else
- #endif /* __UNIFIED_MESSAGE_LIST_OPTION_SUPPORT__ */
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_OUTBOX_MSG);
- }
- }
- }
- else
- {
- MMI_ASSERT(0);
- }
- DeleteMessagesHistoryNodes();
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_delete_msg_before_save_req
- * DESCRIPTION
- *
- * PARAMETERS
- * type [IN]
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_delete_msg_before_save_req(U8 type, U16 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_frm_sms_delete_sms(mmi_msg_delete_msg_before_save_rsp, MOD_MMI, type, index);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_delete_msg_before_save_pre_check
- * DESCRIPTION
- *
- * PARAMETERS
- * data [?]
- * mod [IN]
- * result [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_delete_msg_before_save_pre_check(void *data, module_type mod, U16 result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (result == MMI_FRM_SMS_OK)
- {
- msg_mem_status_struct *memorystatus = (msg_mem_status_struct*) data;
- U16 total_storage = memorystatus->simTotal + memorystatus->meTotal;
- U16 used_storage = memorystatus->simUsed + memorystatus->meUsed;
- EMSData *pEMS;
- U8 sms_segment_size = mmi_frm_sms_get_sms_received_size(MMI_FRM_SMS_APP_DRAFTS, (U16) g_msg_cntx.currBoxIndex);
- GetEMSDataForEdit(&pEMS, 0);
- if (pEMS->Reminder.requiredSegment > (total_storage - used_storage + sms_segment_size))
- {
- mmi_msg_delete_msg_before_save_rsp(NULL, MOD_MMI, MMI_FRM_SMS_MEMINSUFFICIENT);
- }
- else
- {
- mmi_msg_delete_msg_before_save_req(MMI_FRM_SMS_APP_DRAFTS, (U16) g_msg_cntx.currBoxIndex);
- }
- }
- else
- {
- DisplayPopup(
- (PU8) GetString(STR_GLOBAL_UNFINISHED),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) WARNING_TONE);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_delete_msg_before_save
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_delete_msg_before_save()
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_frm_sms_get_memory_status(mmi_msg_delete_msg_before_save_pre_check, MOD_MMI);
- }
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_send_msg_rsp
- * DESCRIPTION
- *
- * PARAMETERS
- * number [?]
- * mod [IN]
- * result [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_send_msg_rsp(void *number, module_type mod, U16 result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (result)
- {
- case MMI_FRM_SMS_OK:
- g_msg_cntx.msg_send_info.CurrSendSmsNumbers++;
- while (g_msg_cntx.msg_send_info.CurrSendSmsNumbers < g_msg_cntx.msg_send_info.TotalSendSmsNumbers)
- {
- #ifdef __MMI_MESSAGES_SEND_TO_MANY__
- if ((g_msg_cntx.sendMessageCase == SEND_CASE_SEND_TO_MANY)
- &&
- (pfnUnicodeStrlen
- ((S8*) g_msg_cntx.msg_send_info.PhbNumber[g_msg_cntx.msg_send_info.CurrSendSmsNumbers])))
- {
- U8 length = pfnUnicodeStrlen(g_msg_cntx.msg_send_info.
- PhbNumber[g_msg_cntx.msg_send_info.CurrSendSmsNumbers]);
- memset(g_msg_cntx.smsPhoneNumber, 0, (MAX_DIGITS + 1) * ENCODING_LENGTH);
- UnicodeNToAnsii(
- (S8*) g_msg_cntx.smsPhoneNumber,
- (S8*) g_msg_cntx.msg_send_info.PhbNumber[g_msg_cntx.msg_send_info. CurrSendSmsNumbers],
- length * ENCODING_LENGTH);
- mmi_msg_send_msg_req((U8*) g_msg_cntx.smsPhoneNumber, MMI_FRM_SMS_INVALID_INDEX, 1);
- return;
- }
- #endif /* __MMI_MESSAGES_SEND_TO_MANY__ */
- #ifdef __MMI_MESSAGES_SEND_BY_GROUP__
- else if ((g_msg_cntx.sendMessageCase == SEND_CASE_SEND_BY_GROUP)
- && (g_msg_cntx.msg_send_info.PhbIndex != NULL))
- {
- U8 PhbNuminBCD[(MAX_DIGITS + 1) / 2];
- U8 PhbNum[MAX_DIGITS + 1];
- S8 PhbNumUCS2[(MAX_DIGITS + 2) * ENCODING_LENGTH];
- U8 type = 0;
- U8 length =
- (PhoneBook[g_msg_cntx.msg_send_info.PhbIndex[g_msg_cntx.msg_send_info.CurrSendSmsNumbers]].tel.length >
- (MAX_DIGITS / 2)) ?
- (MAX_DIGITS / 2) :
- PhoneBook[g_msg_cntx.msg_send_info.PhbIndex[g_msg_cntx.msg_send_info.CurrSendSmsNumbers]].tel.length;
- memset(PhbNuminBCD, 0, (MAX_DIGITS + 1) / 2);
- memcpy(
- PhbNuminBCD,
- PhoneBook[g_msg_cntx.msg_send_info.PhbIndex[g_msg_cntx.msg_send_info.CurrSendSmsNumbers]]. tel.number,
- length);
- memset(PhbNum, 0, MAX_DIGITS + 1);
- mmi_phb_convert_to_digit((U8*) PhbNum, (U8*) PhbNuminBCD, MAX_DIGITS + 1);
- memset(g_msg_cntx.smsPhoneNumber, 0, (MAX_DIGITS + 1) * ENCODING_LENGTH);
- if (PhoneBook[g_msg_cntx.msg_send_info.PhbIndex[g_msg_cntx.msg_send_info.CurrSendSmsNumbers]].tel.
- type == CSMCC_INTERNATIONAL_ADDR)
- {
- type = 1;
- AnsiiToUnicodeString((S8*) PhbNumUCS2, "+");
- }
- AnsiiNToUnicodeString((S8*) PhbNumUCS2 + type * ENCODING_LENGTH, (S8*) PhbNum, length);
- UnicodeNToAnsii(
- (S8*) g_msg_cntx.smsPhoneNumber,
- (S8*) PhbNumUCS2,
- (length + type) * ENCODING_LENGTH);
- mmi_msg_send_msg_req((U8*) g_msg_cntx.smsPhoneNumber, MMI_FRM_SMS_INVALID_INDEX, 1);
- return;
- }
- #endif /* __MMI_MESSAGES_SEND_BY_GROUP__ */
- g_msg_cntx.msg_send_info.CurrSendSmsNumbers++;
- }
- ReleaseEMSEditBuffer();
- #ifdef __MMI_UNIFIED_MESSAGE__
- /* Skip UM write menu */
- if (IsScreenPresent(SCR_ID_MSG_WRITE_OPTION))
- {
- mmi_um_skip_write_menu(KAL_TRUE);
- }
- if (mmi_um_get_current_msg_box_type() == UM_MSG_BOX_TYPE_UNSENT)
- {
- /* Remove the sent msg from drafts box */
- mmi_msg_set_post_send_action_type(MMI_SMS_PS_ACTION_SEND_SUCCESS_REMOVE_MSG);
- mmi_msg_set_processing_screen(
- STR_UNSENTBOX_MENUENTRY,
- STR_DELETING_SMS_CAPTION,
- IMG_GLOBAL_PROGRESS,
- 0);
- mmi_msg_entry_processing_generic();
- DeleteScreenIfPresent(SCR_ID_MSG_PROCESSING);
- mmi_msg_delete_msg_after_send_req(MMI_FRM_SMS_APP_DRAFTS, (U16) g_msg_cntx.currBoxIndex);
- return;
- }
- else if (mmi_um_get_current_msg_box_type() == UM_MSG_BOX_TYPE_DRAFT)
- {
- /* Remove the sent msg from drafts box */
- mmi_msg_set_post_send_action_type(MMI_SMS_PS_ACTION_SEND_SUCCESS_REMOVE_MSG);
- mmi_msg_set_processing_screen(STR_DRAFTBOX_MENUENTRY, STR_DELETING_SMS_CAPTION, IMG_GLOBAL_PROGRESS, 0);
- mmi_msg_entry_processing_generic();
- DeleteScreenIfPresent(SCR_ID_MSG_PROCESSING);
- mmi_msg_delete_msg_after_send_req(MMI_FRM_SMS_APP_DRAFTS, (U16) g_msg_cntx.currBoxIndex);
- return;
- }
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- #ifdef __UNIFIED_MESSAGE_LIST_OPTION_SUPPORT__
- if (IsScreenPresent(SCR_ID_MSG_INBOX_LIST_OPTION))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_INBOX_LIST_OPTION);
- }
- else if (IsScreenPresent(SCR_ID_MSG_OUTBOX_LIST_OPTION))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_OUTBOX_LIST_OPTION);
- }
- else if (IsScreenPresent(SCR_ID_MSG_DEFAULT_LIST_OPTION))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_DEFAULT_LIST_OPTION);
- }
- else
- #endif /* __UNIFIED_MESSAGE_LIST_OPTION_SUPPORT__ */
- if (IsScreenPresent(SCR_ID_MSG_INBOX_MSG))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_INBOX_MSG);
- }
- else if (IsScreenPresent(SCR_ID_MSG_OUTBOX_MSG))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_OUTBOX_MSG);
- }
- else if (IsScreenPresent(SCR_ID_MSG_DEFAULT_MSG))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_DEFAULT_MSG);
- }
- #if defined(__MMI_SMART_MESSAGE_MT__) || (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__))
- else if (IsScreenPresent(SCR_ID_MYPIC_DISPLAY))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MYPIC_DISPLAY);
- }
- #endif /* defined(__MMI_SMART_MESSAGE_MT__) || (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) */
- //KP Jerry add for third sevice on 2007-03-26 start
- #ifdef __KONG_NET_SP__
- else if(IsScreenPresent(SCR_ID_THUMB_WORLD_OK))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_THUMB_WORLD_OK);
- //SetMessagesScrnIdDelUpToHistoryNodes(SCR_ID_THUMB_WORLD);
- }
- else if(IsScreenPresent(SCR_ID_THUMB_WORLD_OK2))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_THUMB_WORLD_OK2);
- //SetMessagesScrnIdDelUpToHistoryNodes(SCR_ID_THUMB_WORLD);
- }
- else if(IsScreenPresent(SCR_ID_WONDERUL_OK))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_WONDERUL_OK);
- //SetMessagesScrnIdDelUpToHistoryNodes(SCR_ID_WONDERFUL);
- }
- else if(IsScreenPresent(SCR_ID_WONDERUL_OK2))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_WONDERUL_OK2);
- //SetMessagesScrnIdDelUpToHistoryNodes(SCR_ID_WONDERFUL);
- }
- #endif
- //KP Jerry add for third sevice on 2007-03-26 end
- else if (IsScreenPresent(SCR_ID_MSG_TEMPLATE_OPTION))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_TEMPLATE_OPTION);
- }
- else if (IsScreenPresent(SCR_ID_MSG_WRITE))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_WRITE);
- }
- DisplayPopup(
- (PU8) GetString(STR_SMS_SEND_SUCCESS),
- IMG_SEND_SUCCESS_PIC_MSG,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) SUCCESS_TONE);
- if (g_msg_cntx.msg_send_info.CurrSendSmsNumbers == g_msg_cntx.msg_send_info.TotalSendSmsNumbers)
- {
- DeleteMessagesHistoryNodes();
- mmi_frm_sms_delete_screen_history();
- }
- //KP Jerry add for third sevice on 2007-03-26 start
- #ifdef __KONG_NET_SP__
- if((IsScreenPresent(SCR_ID_THUMB_WORLD_OK))||(IsScreenPresent(SCR_ID_THUMB_WORLD_OK2))||(IsScreenPresent(SCR_ID_WONDERUL_OK))||(IsScreenPresent(SCR_ID_WONDERUL_OK2)))
- {
- mmi_frm_sms_delete_screen_history();
- DeleteMessagesHistoryNodes ();
- }
- #endif
- //KP Jerry add for third sevice on 2007-03-26 end
- #if (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__))
- mmi_nsm2_init_nsm_msg_struct(&g_nsm_msg_context); /* Reset after sending picture msg */
- #endif
- AlmEnableSPOF();
- break;
- case MMI_FRM_SMS_ABORT:
- #if ( defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__))
- if (g_nsm_msg_context.is_picmsg == TRUE)
- {
- EMSData *pEMS;
- GetEMSDataForEdit(&pEMS, 1);
- AddString(
- pEMS,
- (U8*) g_nsm_msg_context.textbuffer,
- (U16) pfnUnicodeStrlen((S8*) g_nsm_msg_context.textbuffer),
- NULL);
- }
- #endif /* ( defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) */
- #ifdef __MMI_SMART_MESSAGE_MT__
- /* Replying message only contains texts and the content of the msg should be keeped in abort case */
- if ((mmi_nsm_get_msg_type() == PICTURE_MESSAGE) && (g_msg_cntx.sendMessageCase != SEND_CASE_REPLY))
- {
- EMSData *pEMS;
- GetEMSDataForEdit(&pEMS, 0);
- memset(pEMS->textBuffer, 0x00, pEMS->textLength);
- /* memset(&picmsg_text_struct, 0x00, sizeof(picmsg_text_struct)); *//* For issue 140 */
- ReleaseEMSEditBuffer();
- }
- #endif /* __MMI_SMART_MESSAGE_MT__ */
- if (IsScreenPresent(SCR_ID_MSG_WRITE_OPTION))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_WRITE_OPTION);
- }
- #ifdef __MMI_SMART_MESSAGE_MT__
- else if (IsScreenPresent(SCR_ID_EDIT_OPTIONS))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_EDIT_OPTIONS);
- }
- else if (IsScreenPresent(SCR_ID_MYPIC_DISPLAY)) /* JAI 06-12-2004 for My Pic */
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MYPIC_DISPLAY);
- }
- #endif /* __MMI_SMART_MESSAGE_MT__ */
- else if (IsScreenPresent(SCR_ID_MSG_SEND_OPTION))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_SEND_OPTION);
- }
- #ifdef __UNIFIED_MESSAGE_LIST_OPTION_SUPPORT__
- else if (IsScreenPresent(SCR_ID_MSG_OUTBOX_LIST_OPTION))
- {
- /* sent / forward / abort . This case shall go back to send option */
- if (mmi_um_get_current_msg_box_type() != UM_MSG_BOX_TYPE_SENT)
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_OUTBOX_LIST_OPTION);
- }
- }
- #endif /* __UNIFIED_MESSAGE_LIST_OPTION_SUPPORT__ */
- else if (IsScreenPresent(SCR_ID_MSG_OUTBOX_MSG))
- {
- #ifdef __MMI_UNIFIED_MESSAGE__
- /* sent / forward / abort . This case shall go back to send option */
- if (mmi_um_get_current_msg_box_type() != UM_MSG_BOX_TYPE_SENT)
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_OUTBOX_MSG);
- }
- }
- //KP Jerry add for third sevice on 2007-03-26 start
- #ifdef __KONG_NET_SP__
- else if(IsScreenPresent(SCR_ID_THUMB_WORLD_OK))
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_THUMB_WORLD_OK);
- else if(IsScreenPresent(SCR_ID_THUMB_WORLD_OK2))
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_THUMB_WORLD_OK2);
- else if(IsScreenPresent(SCR_ID_WONDERUL_OK))
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_WONDERUL_OK);
- else if(IsScreenPresent(SCR_ID_WONDERUL_OK2))
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_WONDERUL_OK2);
- #endif
- //KP Jerry add for third sevice on 2007-03-26 end
- DisplayPopup(
- (PU8) GetString(STR_ABORT_SENDING_SMS),
- IMG_GLOBAL_ACTIVATED,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) SUCCESS_TONE);
- DeleteMessagesHistoryNodes();
- mmi_frm_sms_delete_screen_history();
- AlmEnableSPOF();
- break;
- case MMI_FRM_SMS_NOTREADY:
- DisplayPopup(
- (PU8) GetString(STR_SMS_MSG_NOT_READY_YET),
- IMG_SEND_FAIL_PIC_MSG,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- AlmEnableSPOF();
- break;
- case MMI_FRM_SMS_NUMINVALID:
- DisplayPopup(
- (PU8) GetString(STR_ID_PHB_NUM_INVALID),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- #ifdef __UNIFIED_MESSAGE_LIST_OPTION_SUPPORT__
- if (IsScreenPresent(SCR_ID_MSG_INBOX_LIST_OPTION))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_INBOX_LIST_OPTION);
- }
- else if (IsScreenPresent(SCR_ID_MSG_OUTBOX_LIST_OPTION))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_OUTBOX_LIST_OPTION);
- }
- else if (IsScreenPresent(SCR_ID_MSG_DEFAULT_LIST_OPTION))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_DEFAULT_LIST_OPTION);
- }
- else
- #endif /* __UNIFIED_MESSAGE_LIST_OPTION_SUPPORT__ */
- if (IsScreenPresent(SCR_ID_MSG_INBOX_MSG))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_INBOX_MSG);
- }
- else if (IsScreenPresent(SCR_ID_MSG_OUTBOX_MSG))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_OUTBOX_MSG);
- }
- else if (IsScreenPresent(SCR_ID_MSG_DEFAULT_MSG))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_DEFAULT_MSG);
- }
- #if defined(__MMI_SMART_MESSAGE_MT__) || (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__))
- else if (IsScreenPresent(SCR_ID_MYPIC_DISPLAY))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MYPIC_DISPLAY);
- }
- #endif /* defined(__MMI_SMART_MESSAGE_MT__) || (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) */
- else if (IsScreenPresent(SCR_ID_MSG_WRITE))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_WRITE);
- }
- DeleteMessagesHistoryNodes();
- mmi_frm_sms_delete_screen_history();
- AlmEnableSPOF();
- break;
- case MMI_FRM_SMS_RETURN:
- case MMI_FRM_SMS_END:
- #ifdef __MMI_SMART_MESSAGE_MT__
- if (mmi_nsm_get_msg_type() == PICTURE_MESSAGE)
- {
- ReleaseEMSEditBuffer();
- }
- #endif /* __MMI_SMART_MESSAGE_MT__ */
- break;
- case MMI_FRM_SMS_END_FROM_SENDING:
- #ifdef __MMI_SMART_MESSAGE_MT__
- if (mmi_nsm_get_msg_type() == PICTURE_MESSAGE)
- {
- ReleaseEMSEditBuffer();
- }
- #endif /* __MMI_SMART_MESSAGE_MT__ */
- #ifdef __MMI_UNIFIED_MESSAGE__
- {
- U8 msg_box_type = mmi_um_get_current_msg_box_type();
- if (msg_box_type == UM_MSG_BOX_TYPE_UNSENT)
- {
- /* unsent / edit / send/ end key, delete the old msg and save the new one */
- if (IsScreenPresent(SCR_ID_MSG_WRITE_OPTION))
- {
- /* delete the msg in draft and save the msg to unsent */
- mmi_msg_set_post_send_action_type(MMI_SMS_PS_ACTION_MOVE_MSG);
- mmi_msg_set_background_process(KAL_TRUE);
- mmi_msg_delete_msg_after_send_req(MMI_FRM_SMS_APP_UNSENT, (U16) g_msg_cntx.currBoxIndex);
- mmi_msg_save_msg_after_send_req(SMSAL_STO_UNSENT, number);
- }
- /* unsent / send / end key, the msg should be kept. */
- else
- {
- ; /* Do nothing */
- }
- }
- else if (msg_box_type == UM_MSG_BOX_TYPE_DRAFT)
- {
- /* draft / edit / send/ end key, or draft / send / end key , delete the old msg and save the new one */
- /* delete the msg in draft and save the msg to unsent */
- mmi_msg_set_post_send_action_type(MMI_SMS_PS_ACTION_MOVE_MSG);
- mmi_msg_set_background_process(KAL_TRUE);
- mmi_msg_delete_msg_after_send_req(MMI_FRM_SMS_APP_DRAFTS, (U16) g_msg_cntx.currBoxIndex);
- mmi_msg_save_msg_after_send_req(SMSAL_STO_UNSENT, number);
- }
- else
- {
- mmi_msg_set_background_process(KAL_TRUE);
- mmi_msg_save_msg_after_send_req(SMSAL_STO_UNSENT, number);
- }
- }
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- break;
- default:
- #ifdef __MMI_UNIFIED_MESSAGE__
- {
- U8 msg_box_type = mmi_um_get_current_msg_box_type();
- /* Skip UM write menu */
- if (IsScreenPresent(SCR_ID_MSG_WRITE_OPTION))
- {
- mmi_um_skip_write_menu(KAL_TRUE);
- }
- if (msg_box_type == UM_MSG_BOX_TYPE_INBOX)
- {
- /* inbox / edit / send/ send fail , or inbox / forward / send/ send fail, the msg should be saved to unsent box */
- mmi_msg_set_processing_screen(STR_INBOX_MENUENTRY, STR_GLOBAL_SAVING, IMG_GLOBAL_PROGRESS, 0);
- mmi_msg_entry_processing_generic();
- DeleteScreenIfPresent(SCR_ID_MSG_PROCESSING);
- mmi_msg_save_msg_after_send_req(SMSAL_STO_UNSENT, number);
- }
- else if (msg_box_type == UM_MSG_BOX_TYPE_SENT)
- {
- /* sent / edit / send/ send fail , or sent / forward / send/ send fail, the msg should be saved to unsent box */
- mmi_msg_set_processing_screen(STR_UM_SENT_ID, STR_GLOBAL_SAVING, IMG_GLOBAL_PROGRESS, 0);
- mmi_msg_entry_processing_generic();
- DeleteScreenIfPresent(SCR_ID_MSG_PROCESSING);
- mmi_msg_save_msg_after_send_req(SMSAL_STO_UNSENT, number);
- }
- else if (msg_box_type == UM_MSG_BOX_TYPE_UNSENT)
- {
- /* unsent / edit / send / send fail, delete the old msg and save the new one */
- if (IsScreenPresent(SCR_ID_MSG_WRITE_OPTION))
- {
- mmi_msg_set_post_send_action_type(MMI_SMS_PS_ACTION_MOVE_MSG);
- mmi_msg_set_processing_screen(STR_UM_UNSENT_ID, STR_GLOBAL_SAVING, IMG_GLOBAL_PROGRESS, 0);
- mmi_msg_entry_processing_generic();
- DeleteScreenIfPresent(SCR_ID_MSG_PROCESSING);
- mmi_msg_delete_msg_after_send_req(MMI_FRM_SMS_APP_DRAFTS, (U16) g_msg_cntx.currBoxIndex);
- mmi_msg_save_msg_after_send_with_flag_req(
- SMSAL_STO_UNSENT,
- number,
- MMI_FRM_SMS_SAVE_HIGHLIGHT_NEW_MSG_IND);
- }
- /* unsent / send/ send fail, the msg should be kept. */
- else
- {
- /* Do nothing */
- #ifdef __UNIFIED_MESSAGE_LIST_OPTION_SUPPORT__
- if (IsScreenPresent(SCR_ID_MSG_OUTBOX_LIST_OPTION))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_OUTBOX_LIST_OPTION);
- }
- else
- #endif /* __UNIFIED_MESSAGE_LIST_OPTION_SUPPORT__ */
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_OUTBOX_MSG);
- }
- DisplayPopup(
- (PU8) GetString(STR_SMS_SEND_FAILED),
- IMG_SEND_FAIL_PIC_MSG,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- DeleteMessagesHistoryNodes();
- mmi_frm_sms_delete_screen_history();
- AlmEnableSPOF();
- }
- }
- else if (msg_box_type == UM_MSG_BOX_TYPE_DRAFT)
- {
- /* draft / edit / send / send fail, or draft / send / send fail, delete the old msg and save the new one to unsent */
- mmi_msg_set_post_send_action_type(MMI_SMS_PS_ACTION_MOVE_MSG);
- mmi_msg_set_processing_screen(STR_UM_DRAFT_ID, STR_GLOBAL_SAVING, IMG_GLOBAL_PROGRESS, 0);
- mmi_msg_entry_processing_generic();
- DeleteScreenIfPresent(SCR_ID_MSG_PROCESSING);
- mmi_msg_delete_msg_after_send_req(MMI_FRM_SMS_APP_DRAFTS, (U16) g_msg_cntx.currBoxIndex);
- mmi_msg_save_msg_after_send_req(SMSAL_STO_UNSENT, number);
- }
- else
- {
- mmi_msg_save_msg_after_send_req(SMSAL_STO_UNSENT, number);
- }
- }
- #else /* __MMI_UNIFIED_MESSAGE__ */
- /* when sending fail, only save the content to outbox if the message is not sent from outbox originally */
- if (IsScreenPresent(SCR_ID_MSG_OUTBOX_SEND_OPTION))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_OUTBOX_MSG);
- DisplayPopup(
- (PU8) GetString(STR_SMS_SEND_FAILED),
- IMG_SEND_FAIL_PIC_MSG,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- DeleteMessagesHistoryNodes();
- mmi_frm_sms_delete_screen_history();
- AlmEnableSPOF();
- }
- else
- {
- mmi_msg_save_msg_after_send_req(SMSAL_STO_UNSENT, number);
- }
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_send_msg_req
- * DESCRIPTION
- *
- * PARAMETERS
- * number [?]
- * replyindex [IN]
- * hidenumscreen [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_send_msg_req(U8 *number, U16 replyindex, U8 hidenumscreen)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_frm_sms_send_struct *sendData = OslMalloc(sizeof(mmi_frm_sms_send_struct));
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset((S8*) sendData, 0, sizeof(mmi_frm_sms_send_struct));
- #ifdef __MMI_UNIFIED_MESSAGE__
- if (!(mmi_um_get_current_msg_box_type() == UM_MSG_BOX_TYPE_UNSENT && GetExitScrnID() == SCR_ID_MSG_OUTBOX_OPTION))
- #else
- if (GetMessagesCurrScrnID() != SCR_ID_MSG_OUTBOX_SEND_OPTION)
- #endif
- {
- sendData->sendrequire |= MMI_FRM_SMS_SAVE_AFTER_FAIL;
- }
- memset(sendData->number, 0, MAX_DIGITS_SMS);
- if (strlen((S8*) number))
- {
- memcpy((S8*) sendData->number, (S8*) number, strlen((S8*) number));
- }
- else if (replyindex != MMI_FRM_SMS_INVALID_INDEX)
- {
- sendData->sendrequire |= MMI_FRM_SMS_REPLY;
- sendData->replyindex = replyindex;
- }
- /* for send to many or send to group, show only one sending screen for all numbers */
- if ((g_msg_cntx.msg_send_info.CurrSendSmsNumbers + 1) < g_msg_cntx.msg_send_info.TotalSendSmsNumbers)
- {
- sendData->sendrequire |= MMI_FRM_SMS_MORE;
- }
- /* if sendcheck has a bit of MMI_FRM_SMS_SCR, do not show sending screen */
- if (g_msg_cntx.msg_send_info.CurrSendSmsNumbers != 0)
- {
- sendData->sendcheck |= MMI_FRM_SMS_SCR;
- }
- if (!hidenumscreen)
- {
- #ifdef __MMI_UNIFIED_MESSAGE__
- if (mmi_um_get_current_msg_box_type() == UM_MSG_BOX_TYPE_UNSENT)
- {
- if (IsScreenPresent(SCR_ID_MSG_WRITE_OPTION))
- {
- sendData->sendrequire |= MMI_FRM_SMS_NUM_SCR;
- }
- }
- #else /* __MMI_UNIFIED_MESSAGE__ */
- if (IsScreenPresent(SCR_ID_MSG_OUTBOX_MSG))
- {
- /* If press Send key in send-to-many number editor screen, the number exists so that not to display the number screen . */
- if (!IsScreenPresent(SCR_ID_MSG_SEND_MANY_LIST_OPTION))
- {
- sendData->sendrequire |= MMI_FRM_SMS_NUM_SCR;
- }
- }
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- /* the case of forward inbox message */
- if ((IsScreenPresent(SCR_ID_MSG_INBOX_LIST_OPTION) || IsScreenPresent(SCR_ID_MSG_INBOX_MSG)) &&
- replyindex == MMI_FRM_SMS_INVALID_INDEX)
- {
- /* If press Send key in send-to-many number editor screen, the number exists. */
- if (!(strlen((S8*) number)))
- {
- sendData->sendrequire |= MMI_FRM_SMS_NUM_SCR;
- memset(sendData->number, 0, MAX_DIGITS_SMS);
- }
- }
- }
- #if (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__))
- if (g_nsm_msg_context.is_picmsg == TRUE)
- {
- mmi_nsm_get_picmsg_sendData(sendData);
- }
- #endif /* (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) */
- #if defined(__MMI_SMART_MESSAGE_MT__)
- if ((mmi_nsm_get_msg_type() == PICTURE_MESSAGE) && (g_msg_cntx.sendMessageCase != SEND_CASE_REPLY)) /* If not reply to a picture message then do this */
- {
- mmi_nsm_get_picmsg_sendData(sendData);
- }
- #endif /* defined(__MMI_SMART_MESSAGE_MT__) */
- mmi_frm_sms_send_sms(mmi_msg_send_msg_rsp, MOD_MMI, sendData);
- OslMfree(sendData);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_send_and_save_msg_rsp
- * DESCRIPTION
- *
- * PARAMETERS
- * number [?]
- * mod [IN]
- * result [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_send_and_save_msg_rsp(void *number, module_type mod, U16 result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (result)
- {
- case MMI_FRM_SMS_OK:
- #ifdef __MMI_UNIFIED_MESSAGE__
- /* Skip UM write menu */
- if (IsScreenPresent(SCR_ID_MSG_WRITE_OPTION))
- {
- mmi_um_skip_write_menu(KAL_TRUE);
- }
- if (mmi_um_get_current_msg_box_type() == UM_MSG_BOX_TYPE_UNSENT)
- {
- /* delete the msg in draft and save the msg to sent */
- mmi_msg_set_post_send_action_type(MMI_SMS_PS_ACTION_MOVE_MSG);
- mmi_msg_set_processing_screen(STR_UM_UNSENT_ID, STR_GLOBAL_SAVING, IMG_GLOBAL_PROGRESS, 0);
- mmi_msg_entry_processing_generic();
- DeleteScreenIfPresent(SCR_ID_MSG_PROCESSING);
- mmi_msg_delete_msg_after_send_req(MMI_FRM_SMS_APP_DRAFTS, (U16) g_msg_cntx.currBoxIndex);
- mmi_msg_save_msg_after_send_req(SMSAL_STO_SENT, number);
- }
- else if (mmi_um_get_current_msg_box_type() == UM_MSG_BOX_TYPE_DRAFT)
- {
- /* delete the msg in draft and save the msg to unsent */
- mmi_msg_set_post_send_action_type(MMI_SMS_PS_ACTION_MOVE_MSG);
- mmi_msg_set_processing_screen(STR_UM_DRAFT_ID, STR_GLOBAL_SAVING, IMG_GLOBAL_PROGRESS, 0);
- mmi_msg_entry_processing_generic();
- DeleteScreenIfPresent(SCR_ID_MSG_PROCESSING);
- mmi_msg_delete_msg_after_send_req(MMI_FRM_SMS_APP_DRAFTS, (U16) g_msg_cntx.currBoxIndex);
- mmi_msg_save_msg_after_send_req(SMSAL_STO_SENT, number);
- }
- else if (mmi_um_get_current_msg_box_type() == UM_MSG_BOX_TYPE_SENT)
- {
- /* After back to sent list, the highlight should be on the old one. */
- mmi_msg_save_msg_after_send_with_flag_req(
- SMSAL_STO_SENT,
- number,
- MMI_FRM_SMS_SAVE_HIGHLIGHT_ORIGINAL_MSG_IND | MMI_FRM_SMS_SAVE_MODIFY_HIGHLIGHT);
- }
- else
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- {
- mmi_msg_save_msg_after_send_req(SMSAL_STO_SENT, number);
- }
- break;
- case MMI_FRM_SMS_ABORT:
- #if (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__))
- if (mmi_nsm_get_msg_type() == PICTURE_MESSAGE)
- {
- ReleaseEMSEditBuffer();
- }
- #endif /* (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) */
- if (IsScreenPresent(SCR_ID_MSG_WRITE_OPTION))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_WRITE_OPTION);
- }
- #if defined(__MMI_SMART_MESSAGE_MT__) || defined(__MMI_SMART_MESSAGE_MO__)
- else if (IsScreenPresent(SCR_ID_MYPIC_DISPLAY))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MYPIC_DISPLAY);
- }
- #endif /* defined(__MMI_SMART_MESSAGE_MT__) || defined(__MMI_SMART_MESSAGE_MO__) */
- else if (IsScreenPresent(SCR_ID_MSG_SEND_OPTION))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_SEND_OPTION);
- }
- #ifdef __UNIFIED_MESSAGE_LIST_OPTION_SUPPORT__
- else if (IsScreenPresent(SCR_ID_MSG_OUTBOX_LIST_OPTION))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_OUTBOX_LIST_OPTION);
- }
- #endif /* __UNIFIED_MESSAGE_LIST_OPTION_SUPPORT__ */
- else if (IsScreenPresent(SCR_ID_MSG_OUTBOX_MSG))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_OUTBOX_MSG);
- }
- DisplayPopup(
- (PU8) GetString(STR_ABORT_SENDING_SMS),
- IMG_GLOBAL_ACTIVATED,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) SUCCESS_TONE);
- DeleteMessagesHistoryNodes();
- mmi_frm_sms_delete_screen_history();
- AlmEnableSPOF();
- break;
- case MMI_FRM_SMS_NOTREADY:
- DisplayPopup(
- (PU8) GetString(STR_SMS_MSG_NOT_READY_YET),
- IMG_SEND_FAIL_PIC_MSG,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- AlmEnableSPOF();
- break;
- case MMI_FRM_SMS_RETURN:
- case MMI_FRM_SMS_END:
- #if (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__))
- if (mmi_nsm_get_msg_type() == PICTURE_MESSAGE)
- {
- ReleaseEMSEditBuffer();
- }
- #endif /* (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) */
- break;
- case MMI_FRM_SMS_END_FROM_SENDING:
- #if (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__))
- if (mmi_nsm_get_msg_type() == PICTURE_MESSAGE)
- {
- ReleaseEMSEditBuffer();
- }
- #endif /* (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) */
- #ifdef __MMI_UNIFIED_MESSAGE__
- {
- U8 msg_box_type = mmi_um_get_current_msg_box_type();
- if (msg_box_type == UM_MSG_BOX_TYPE_UNSENT)
- {
- /* unsent / edit / send/ end key, delete the old msg and save the new one */
- /* delete the msg in draft and save the msg to unsent */
- mmi_msg_set_post_send_action_type(MMI_SMS_PS_ACTION_MOVE_MSG);
- mmi_msg_set_background_process(KAL_TRUE);
- mmi_msg_delete_msg_after_send_req(MMI_FRM_SMS_APP_UNSENT, (U16) g_msg_cntx.currBoxIndex);
- mmi_msg_save_msg_after_send_req(SMSAL_STO_UNSENT, number);
- }
- else if (msg_box_type == UM_MSG_BOX_TYPE_DRAFT)
- {
- /* draft / edit / send/ end key, or draft / send / end key , delete the old msg and save the new one */
- /* delete the msg in draft and save the msg to unsent */
- mmi_msg_set_post_send_action_type(MMI_SMS_PS_ACTION_MOVE_MSG);
- mmi_msg_set_background_process(KAL_TRUE);
- mmi_msg_delete_msg_after_send_req(MMI_FRM_SMS_APP_DRAFTS, (U16) g_msg_cntx.currBoxIndex);
- mmi_msg_save_msg_after_send_req(SMSAL_STO_UNSENT, number);
- }
- else
- {
- mmi_msg_set_background_process(KAL_TRUE);
- mmi_msg_save_msg_after_send_req(SMSAL_STO_UNSENT, number);
- }
- }
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- break;
- default:
- #ifdef __MMI_UNIFIED_MESSAGE__
- /* Skip UM write menu */
- if (IsScreenPresent(SCR_ID_MSG_WRITE_OPTION))
- {
- mmi_um_skip_write_menu(KAL_TRUE);
- }
- if (mmi_um_get_current_msg_box_type() == UM_MSG_BOX_TYPE_UNSENT)
- {
- /* delete the msg in draft and save the msg to sent */
- mmi_msg_set_post_send_action_type(MMI_SMS_PS_ACTION_MOVE_MSG);
- mmi_msg_set_processing_screen(STR_UM_UNSENT_ID, STR_GLOBAL_SAVING, IMG_GLOBAL_PROGRESS, 0);
- mmi_msg_entry_processing_generic();
- DeleteScreenIfPresent(SCR_ID_MSG_PROCESSING);
- mmi_msg_delete_msg_after_send_req(MMI_FRM_SMS_APP_DRAFTS, (U16) g_msg_cntx.currBoxIndex);
- mmi_msg_save_msg_after_send_req(SMSAL_STO_UNSENT, number);
- }
- else if (mmi_um_get_current_msg_box_type() == UM_MSG_BOX_TYPE_DRAFT)
- {
- /* delete the msg in draft and save the msg to unsent */
- mmi_msg_set_post_send_action_type(MMI_SMS_PS_ACTION_MOVE_MSG);
- mmi_msg_set_processing_screen(STR_UM_DRAFT_ID, STR_GLOBAL_SAVING, IMG_GLOBAL_PROGRESS, 0);
- mmi_msg_entry_processing_generic();
- DeleteScreenIfPresent(SCR_ID_MSG_PROCESSING);
- mmi_msg_delete_msg_after_send_req(MMI_FRM_SMS_APP_DRAFTS, (U16) g_msg_cntx.currBoxIndex);
- mmi_msg_save_msg_after_send_req(SMSAL_STO_UNSENT, number);
- }
- else
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- {
- mmi_msg_save_msg_after_send_req(SMSAL_STO_UNSENT, number);
- }
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_send_and_save_msg_req
- * DESCRIPTION
- *
- * PARAMETERS
- * number [?]
- * replyindex [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_send_and_save_msg_req(U8 *number, U16 replyindex)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_frm_sms_send_struct *sendData = OslMalloc(sizeof(mmi_frm_sms_send_struct));
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset((S8*) sendData, 0, sizeof(mmi_frm_sms_send_struct));
- sendData->sendrequire |= MMI_FRM_SMS_SAVE;
- memset(sendData->number, 0, MAX_DIGITS_SMS);
- if (number != NULL)
- {
- memcpy((S8*) sendData->number, (S8*) number, strlen((S8*) number));
- }
- else if (replyindex != MMI_FRM_SMS_INVALID_INDEX)
- {
- sendData->sendrequire = MMI_FRM_SMS_REPLY;
- sendData->replyindex = replyindex;
- }
- #ifdef __MMI_UNIFIED_MESSAGE__
- if (mmi_um_get_current_msg_box_type() == UM_MSG_BOX_TYPE_UNSENT)
- {
- sendData->sendrequire |= MMI_FRM_SMS_NUM_SCR;
- }
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- #if (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__))
- /* JP for tracker issue : 20050625 */
- if (g_nsm_msg_context.is_picmsg == TRUE)
- {
- mmi_nsm_get_picmsg_sendData(sendData);
- }
- #endif /* (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) */
- // #else
- #if defined(__MMI_SMART_MESSAGE_MT__)
- if (mmi_nsm_get_msg_type() == PICTURE_MESSAGE)
- {
- mmi_nsm_get_picmsg_sendData(sendData);
- }
- #endif /* defined(__MMI_SMART_MESSAGE_MT__) */
- mmi_frm_sms_send_sms(mmi_msg_send_and_save_msg_rsp, MOD_MMI, sendData);
- OslMfree(sendData);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_save_msg_after_send_rsp
- * DESCRIPTION
- *
- * PARAMETERS
- * status [?]
- * mod [IN]
- * result [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_save_msg_after_send_rsp(void *status, module_type mod, U16 result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 sendresult = *(U8*) status;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (result)
- {
- case MMI_FRM_SMS_OK:
- #ifdef __MMI_UNIFIED_MESSAGE__
- if (!mmi_msg_check_background_process())
- {
- if (sendresult == SMSAL_STO_UNSENT)
- {
- DisplayPopup(
- (PU8) GetString(STR_UM_SEND_FAILED_SAVE_SUCCESS_ID),
- IMG_SEND_FAIL_PIC_MSG,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- else
- {
- DisplayPopup(
- (PU8) GetString(STR_UM_SEND_SAVE_SUCCESS_ID),
- IMG_SEND_SUCCESS_PIC_MSG,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) SUCCESS_TONE);
- }
- }
- #else /* __MMI_UNIFIED_MESSAGE__ */
- {
- if (sendresult == SMSAL_STO_UNSENT)
- {
- DisplayPopup(
- (PU8) GetString(STR_SMS_SEND_FAILED_SAVE_SUCCESS),
- IMG_SEND_FAIL_PIC_MSG,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- else
- {
- DisplayPopup(
- (PU8) GetString(STR_SMS_SEND_SAVE_SUCESS),
- IMG_SEND_SUCCESS_PIC_MSG,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) SUCCESS_TONE);
- }
- }
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- #if (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__))
- mmi_nsm2_init_nsm_msg_struct(&g_nsm_msg_context); /* Reset after saving picture msg */
- #endif
- break;
- case MMI_FRM_SMS_ERROR:
- case MMI_FRM_SMS_MEMFULL:
- if (sendresult == SMSAL_STO_UNSENT)
- {
- #ifdef __MMI_UNIFIED_MESSAGE__
- if (!mmi_msg_check_background_process())
- #endif
- {
- DisplayPopup(
- (PU8) GetString(STR_SMS_SEND_SAVE_FAILED),
- IMG_SEND_FAIL_PIC_MSG,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- #if (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__))
- if (g_nsm_msg_context.is_picmsg == TRUE)
- {
- EMSData *pEMS;
- GetEMSDataForEdit(&pEMS, 1);
- AddString(
- pEMS,
- (U8*) g_nsm_msg_context.textbuffer,
- (U16) pfnUnicodeStrlen((S8*) g_nsm_msg_context.textbuffer),
- NULL);
- }
- #endif /* (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) */
- }
- else
- {
- #ifdef __MMI_UNIFIED_MESSAGE__
- if (!mmi_msg_check_background_process())
- #endif
- {
- DisplayPopup(
- (PU8) GetString(STR_SMS_SEND_SUCESS_SAVE_FILED),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- }
- break;
- default:
- #ifdef __MMI_UNIFIED_MESSAGE__
- if (!mmi_msg_check_background_process())
- #endif
- {
- DisplayPopup(
- (PU8) GetString(STR_SMS_SEND_SAVE_FAILED),
- IMG_SEND_FAIL_PIC_MSG,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- #if (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__))
- if (g_nsm_msg_context.is_picmsg == TRUE)
- {
- EMSData *pEMS;
- GetEMSDataForEdit(&pEMS, 1);
- AddString(
- pEMS,
- (U8*) g_nsm_msg_context.textbuffer,
- (U16) pfnUnicodeStrlen((S8*) g_nsm_msg_context.textbuffer),
- NULL);
- }
- #endif /* (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) */
- break;
- }
- #ifdef __MMI_UNIFIED_MESSAGE__
- if (!mmi_msg_check_background_process())
- #endif
- {
- #ifdef __UNIFIED_MESSAGE_LIST_OPTION_SUPPORT__
- if (IsScreenPresent(SCR_ID_MSG_INBOX_LIST_OPTION))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_INBOX_LIST_OPTION);
- }
- else if (IsScreenPresent(SCR_ID_MSG_OUTBOX_LIST_OPTION))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_OUTBOX_LIST_OPTION);
- }
- else if (IsScreenPresent(SCR_ID_MSG_DEFAULT_LIST_OPTION))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_DEFAULT_LIST_OPTION);
- }
- else
- #endif /* __UNIFIED_MESSAGE_LIST_OPTION_SUPPORT__ */
- if (IsScreenPresent(SCR_ID_MSG_INBOX_MSG))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_INBOX_MSG);
- }
- else if (IsScreenPresent(SCR_ID_MSG_OUTBOX_MSG))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_OUTBOX_MSG);
- }
- else if (IsScreenPresent(SCR_ID_MSG_DEFAULT_MSG))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_DEFAULT_MSG);
- }
- #ifdef __MMI_SMART_MESSAGE_MT__
- else if (IsScreenPresent(SCR_ID_MYPIC_DISPLAY))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MYPIC_DISPLAY);
- }
- #endif /* __MMI_SMART_MESSAGE_MT__ */
- else if (IsScreenPresent(SCR_ID_MSG_TEMPLATE_OPTION))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_TEMPLATE_OPTION);
- }
- else if (IsScreenPresent(SCR_ID_MSG_WRITE))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_WRITE);
- }
- DeleteMessagesHistoryNodes();
- mmi_frm_sms_delete_screen_history();
- AlmEnableSPOF();
- }
- #ifdef __MMI_UNIFIED_MESSAGE__
- mmi_msg_set_background_process(KAL_FALSE);
- #endif
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_save_msg_after_send_req
- * DESCRIPTION
- *
- * PARAMETERS
- * status [IN]
- * number [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_save_msg_after_send_req(U8 status, void *number)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_frm_sms_send_struct *sendData = OslMalloc(sizeof(mmi_frm_sms_send_struct));
- EMSData *data = GetEMSDataForEdit(0, 0);
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset((S8*) sendData, 0, sizeof(mmi_frm_sms_send_struct));
- sendData->dcs = data->dcs;
- sendData->status = status;
- memcpy((S8*) sendData->number, (S8*) number, strlen((S8*) number));
- mmi_frm_sms_save_sms(mmi_msg_save_msg_after_send_rsp, MOD_MMI, sendData);
- OslMfree(sendData);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_save_msg_after_send_with_flag_req
- * DESCRIPTION
- *
- * PARAMETERS
- * status [IN]
- * number [?]
- * flag [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_save_msg_after_send_with_flag_req(U8 status, void *number, U16 flag)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_frm_sms_send_struct *sendData = OslMalloc(sizeof(mmi_frm_sms_send_struct));
- EMSData *data = GetEMSDataForEdit(0, 0);
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset((S8*) sendData, 0, sizeof(mmi_frm_sms_send_struct));
- sendData->dcs = data->dcs;
- sendData->status = status;
- sendData->sendrequire = flag;
- memcpy((S8*) sendData->number, (S8*) number, strlen((S8*) number));
- mmi_frm_sms_save_sms(mmi_msg_save_msg_after_send_rsp, MOD_MMI, sendData);
- OslMfree(sendData);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_search_phb
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_search_phb(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_msg_cntx.PhbSmsInterfaceState = MMI_SEND_ONLY;
- mmi_phb_sms_enter_send_entry();
- }
- #ifdef __MMI_MESSAGES_SEND_TO_MANY__
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_send_msg_to_many
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_send_msg_to_many(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 last = MAX_SEND_TO_MANY_ITEMS;
- S16 avail = -1;
- U8 total = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (last > 0)
- {
- last--;
- if (pfnUnicodeStrlen((S8*) g_msg_cntx.msg_send_info.PhbNumber[last]))
- {
- /* search for the first free entry to sort the list */
- while (avail < last)
- {
- avail++;
- if (!pfnUnicodeStrlen((S8*) g_msg_cntx.msg_send_info.PhbNumber[avail]))
- {
- memcpy(
- g_msg_cntx.msg_send_info.PhbNumber[avail],
- g_msg_cntx.msg_send_info.PhbNumber[last],
- sizeof(g_msg_cntx.msg_send_info.PhbNumber[last]));
- memset(g_msg_cntx.msg_send_info.PhbNumber[last], 0, ENCODING_LENGTH);
- break;
- }
- }
- }
- }
- /* calculate total valid entries */
- for (total = 0; total < MAX_SEND_TO_MANY_ITEMS; total++)
- {
- if (!pfnUnicodeStrlen((S8*) g_msg_cntx.msg_send_info.PhbNumber[total]))
- {
- break;
- }
- }
- if (avail == -1)
- {
- DisplayPopup(
- (PU8) GetString(STR_SMS_NUM_CANNOT_BE_EMPTY),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) ERROR_TONE);
- }
- else
- {
- U8 length = pfnUnicodeStrlen(g_msg_cntx.msg_send_info.PhbNumber[0]);
- memset(g_msg_cntx.smsPhoneNumber, 0, (MAX_DIGITS + 1) * ENCODING_LENGTH);
- g_msg_cntx.msg_send_info.TotalSendSmsNumbers = total;
- g_msg_cntx.msg_send_info.CurrSendSmsNumbers = 0;
- UnicodeNToAnsii(
- (S8*) g_msg_cntx.smsPhoneNumber,
- (S8*) g_msg_cntx.msg_send_info.PhbNumber[0],
- length * ENCODING_LENGTH);
- mmi_msg_send_msg_req((U8*) g_msg_cntx.smsPhoneNumber, MMI_FRM_SMS_INVALID_INDEX, 1);
- }
- }
- #endif /* __MMI_MESSAGES_SEND_TO_MANY__ */
- #ifdef __MMI_MESSAGES_SEND_BY_GROUP__
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_send_msg_to_group
- * DESCRIPTION
- *
- * PARAMETERS
- * cnt [IN]
- * PhbIndex [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_send_msg_to_group(U16 cnt, U16 *PhbIndex)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i;
- U16 actualCount;
- U8 length;
- U8 numbers[(MAX_DIGITS + 1) / 2];
- U8 tempNumber[MAX_DIGITS + 1];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (cnt == 0)
- {
- DisplayPopup(
- (PU8) GetString(STR_MESSAGES_EMPTY_GROUP_ID),
- IMG_GLOBAL_EMPTY,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) EMPTY_LIST_TONE);
- return;
- }
- if (g_msg_cntx.msg_send_info.PhbIndex != NULL)
- {
- OslMfree(g_msg_cntx.msg_send_info.PhbIndex);
- g_msg_cntx.msg_send_info.PhbIndex = NULL;
- }
- g_msg_cntx.msg_send_info.TotalSendSmsNumbers = 0;
- g_msg_cntx.msg_send_info.PhbIndex = OslMalloc(cnt * sizeof(U16));
- for (i = 0, actualCount = 0; i < cnt; i++)
- {
- length =
- (PhoneBook[PhbIndex[i]].tel.length >
- (MAX_DIGITS / 2)) ? (MAX_DIGITS / 2) : PhoneBook[PhbIndex[i]].tel.length;
- memset(numbers, 0, (MAX_DIGITS + 1) / 2);
- memcpy(numbers, PhoneBook[PhbIndex[i]].tel.number, length);
- if ((PhoneBook[PhbIndex[i]].tel.length == 0) ||
- (mmi_phb_convert_to_digit(tempNumber, (U8*) numbers, MAX_DIGITS + 1) == 0))
- {
- continue;
- }
- g_msg_cntx.msg_send_info.PhbIndex[actualCount] = PhbIndex[i];
- actualCount++;
- }
- g_msg_cntx.msg_send_info.TotalSendSmsNumbers = (U16) actualCount;
- if (g_msg_cntx.msg_send_info.TotalSendSmsNumbers > 0)
- {
- U8 PhbNuminBCD[(MAX_DIGITS + 1) / 2];
- U8 PhbNum[MAX_DIGITS + 1];
- S8 PhbNumUCS2[(MAX_DIGITS + 2) * ENCODING_LENGTH];
- U8 type = 0;
- length =
- (PhoneBook[g_msg_cntx.msg_send_info.PhbIndex[0]].tel.length >
- (MAX_DIGITS / 2)) ? (MAX_DIGITS / 2) : PhoneBook[g_msg_cntx.msg_send_info.PhbIndex[0]].tel.length;
- memset(PhbNuminBCD, 0, (MAX_DIGITS + 1) / 2);
- memcpy(PhbNuminBCD, PhoneBook[g_msg_cntx.msg_send_info.PhbIndex[0]].tel.number, length);
- memset(PhbNum, 0, MAX_DIGITS + 1);
- mmi_phb_convert_to_digit((U8*) PhbNum, (U8*) PhbNuminBCD, MAX_DIGITS + 1);
- memset(g_msg_cntx.smsPhoneNumber, 0, (MAX_DIGITS + 1) * ENCODING_LENGTH);
- if (PhoneBook[g_msg_cntx.msg_send_info.PhbIndex[0]].tel.type == CSMCC_INTERNATIONAL_ADDR)
- {
- type = 1;
- AnsiiToUnicodeString((S8*) PhbNumUCS2, "+");
- }
- AnsiiNToUnicodeString((S8*) PhbNumUCS2 + type * ENCODING_LENGTH, (S8*) PhbNum, length);
- g_msg_cntx.msg_send_info.CurrSendSmsNumbers = 0;
- UnicodeNToAnsii((S8*) g_msg_cntx.smsPhoneNumber, (S8*) PhbNumUCS2, (length + type) * ENCODING_LENGTH);
- mmi_msg_send_msg_req((U8*) g_msg_cntx.smsPhoneNumber, MMI_FRM_SMS_INVALID_INDEX, 1);
- }
- else
- {
- if (g_msg_cntx.msg_send_info.PhbIndex != NULL)
- {
- OslMfree(g_msg_cntx.msg_send_info.PhbIndex);
- g_msg_cntx.msg_send_info.PhbIndex = NULL;
- }
- g_msg_cntx.msg_send_info.TotalSendSmsNumbers = 0;
- DisplayPopup(
- (PU8) GetString(STR_MESSAGES_EMPTY_GROUP_ID),
- IMG_GLOBAL_EMPTY,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) EMPTY_LIST_TONE);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_send_msg_by_group
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_send_msg_by_group(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_msg_cntx.sendMessageCase = SEND_CASE_SEND_BY_GROUP;
- mmi_phb_sms_enter_send_by_group();
- }
- #endif /* __MMI_MESSAGES_SEND_BY_GROUP__ */
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_send_msg_to_only_entry
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_send_msg_to_only_entry(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_msg_cntx.msg_send_info.CurrSendSmsNumbers = 0;
- g_msg_cntx.msg_send_info.TotalSendSmsNumbers = 1;
- /* pressing SEND key from send to many phone number editor or send message from phonebook */
- if (g_msg_cntx.sendMessageCase == SEND_CASE_SEND_TO_MANY || g_msg_cntx.sendMessageCase == SEND_CASE_SEND_FROM_PHB)
- {
- S8 phonenumber[(MAX_DIGITS + 1) * ENCODING_LENGTH];
- U8 length = pfnUnicodeStrlen(g_msg_cntx.smsPhoneNumber);
- /* The length should be extracted by 1 for the sake of handling odd number of ascii phone number characters. */
- kal_bool isAsciiNumber = mmi_msg_check_ascii_number((U8*) g_msg_cntx.smsPhoneNumber, (U16) (length * ENCODING_LENGTH - 1));
- /* convert g_msg_cntx.smsPhoneNumber from unicode to ascii */
- if (!isAsciiNumber)
- {
- memset(phonenumber, 0, (MAX_DIGITS + 1) * ENCODING_LENGTH);
- pfnUnicodeStrncpy(phonenumber, g_msg_cntx.smsPhoneNumber, length * ENCODING_LENGTH);
- memset(g_msg_cntx.smsPhoneNumber, 0, (MAX_DIGITS + 1) * ENCODING_LENGTH);
- UnicodeNToAnsii((S8*) g_msg_cntx.smsPhoneNumber, (S8*) phonenumber, length * ENCODING_LENGTH);
- }
- }
- else if (g_msg_cntx.sendMessageCase != SEND_CASE_SEND_FROM_PHB)
- {
- memset(g_msg_cntx.smsPhoneNumber, 0, (MAX_DIGITS + 1) * ENCODING_LENGTH);
- #ifdef __MMI_UNIFIED_MESSAGE__
- if (mmi_um_get_current_msg_box_type() == UM_MSG_BOX_TYPE_UNSENT)
- {
- memcpy(
- g_msg_cntx.smsPhoneNumber,
- (S8*) mmi_frm_sms_get_address(MMI_FRM_SMS_UNSENT, (U16) g_msg_cntx.currBoxIndex),
- MAX_DIGITS_SMS);
- }
- #else /* __MMI_UNIFIED_MESSAGE__ */
- if (GetMessagesCurrScrnID() == SCR_ID_MSG_OUTBOX_SEND_OPTION)
- {
- #ifdef __MMI_MESSAGES_DRAFT_BOX__
- if (IsScreenPresent(SCR_ID_MSG_DRAFTBOX_LIST))
- {
- memcpy(
- g_msg_cntx.smsPhoneNumber,
- (S8*) mmi_frm_sms_get_address(MMI_FRM_SMS_APP_DRAFTS, (U16) g_msg_cntx.currBoxIndex),
- MAX_DIGITS_SMS);
- }
- else
- #endif /* __MMI_MESSAGES_DRAFT_BOX__ */
- memcpy(
- g_msg_cntx.smsPhoneNumber,
- (S8*) mmi_frm_sms_get_address(MMI_FRM_SMS_APP_OUTBOX, (U16) g_msg_cntx.currBoxIndex),
- MAX_DIGITS_SMS);
- }
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- }
- mmi_msg_send_msg_req((U8*) g_msg_cntx.smsPhoneNumber, MMI_FRM_SMS_INVALID_INDEX, 0);
- }
- #ifdef __MMI_SEND_BY_SEARCH_NAME__
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_send_msg_to_only_name_entry
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_send_msg_to_only_name_entry(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_msg_cntx.PhbSmsInterfaceState = MMI_SEND_BY_NAME;
- phbListView = MMI_PHB_LIST_FOR_SMS_SEARCH_NAME;
- memset(g_msg_cntx.smsPhoneNumber, 0, ENCODING_LENGTH);
- mmi_phb_search_name_pre_entry();
- }
- #endif /* __MMI_SEND_BY_SEARCH_NAME__ */
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_save_msg_rsp
- * DESCRIPTION
- *
- * PARAMETERS
- * dummy [?]
- * mod [IN]
- * result [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_save_msg_rsp(void *dummy, module_type mod, U16 result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 totalInbox = mmi_frm_sms_get_sms_list_size(MMI_FRM_SMS_APP_INBOX);
- U16 totalOutbox = mmi_frm_sms_get_sms_list_size(MMI_FRM_SMS_APP_OUTBOX);
- U16 totalDraftbox = mmi_frm_sms_get_sms_list_size(MMI_FRM_SMS_APP_DRAFTS);
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_UNIFIED_MESSAGE__
- /* Skip UM write menu */
- if (IsScreenPresent(SCR_ID_MSG_WRITE_OPTION))
- {
- mmi_um_skip_write_menu(KAL_TRUE);
- }
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- if (result == MMI_FRM_SMS_OK)
- {
- DisplayPopup(
- (PU8) GetString(STR_GLOBAL_DONE),
- IMG_GLOBAL_ACTIVATED,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) SUCCESS_TONE);
- ReleaseEMSEditBuffer();
- #if (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__))
- mmi_nsm2_init_nsm_msg_struct(&g_nsm_msg_context); /* Reset after saving picture msg */
- #endif
- }
- else
- {
- DisplayPopup(
- (PU8) GetString(STR_SMS_FAILURE_MEM_FULL),
- IMG_GLOBAL_UNFINISHED,
- 1,
- MESSAGES_POPUP_TIME_OUT,
- (U8) WARNING_TONE);
- #if (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__))
- if (g_nsm_msg_context.is_picmsg == TRUE)
- {
- EMSData *pEMS;
- GetEMSDataForEdit(&pEMS, 1);
- AddString(
- pEMS,
- (U8*) g_nsm_msg_context.textbuffer,
- (U16) pfnUnicodeStrlen((S8*) g_nsm_msg_context.textbuffer),
- NULL);
- }
- #endif /* (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) */
- }
- #ifdef __UNIFIED_MESSAGE_LIST_OPTION_SUPPORT__
- if (IsScreenPresent(SCR_ID_MSG_INBOX_LIST_OPTION))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_INBOX_LIST_OPTION);
- }
- else if (IsScreenPresent(SCR_ID_MSG_OUTBOX_LIST_OPTION))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_OUTBOX_LIST_OPTION);
- }
- else if (IsScreenPresent(SCR_ID_MSG_DEFAULT_LIST_OPTION))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_DEFAULT_LIST_OPTION);
- }
- else
- #endif /* __UNIFIED_MESSAGE_LIST_OPTION_SUPPORT__ */
- if (IsScreenPresent(SCR_ID_MSG_INBOX_MSG))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_INBOX_MSG);
- }
- else if (IsScreenPresent(SCR_ID_MSG_OUTBOX_MSG))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_OUTBOX_MSG);
- }
- else if (IsScreenPresent(SCR_ID_MSG_DEFAULT_MSG))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_DEFAULT_MSG);
- }
- #if defined(__MMI_SMART_MESSAGE_MT__) || (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__))
- else if (IsScreenPresent(SCR_ID_MYPIC_DISPLAY))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MYPIC_DISPLAY);
- }
- #endif /* defined(__MMI_SMART_MESSAGE_MT__) || (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) */
- else if (IsScreenPresent(SCR_ID_MSG_TEMPLATE_OPTION))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_TEMPLATE_OPTION);
- }
- else if (IsScreenPresent(SCR_ID_MSG_WRITE))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_WRITE);
- }
- else
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_PROCESSING);
- }
- DeleteMessagesHistoryNodes();
- mmi_msg_set_msg_num_hint(totalInbox, totalOutbox, totalDraftbox);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_save_msg_req
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_save_msg_req(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_frm_sms_send_struct *sendData = OslMalloc(sizeof(mmi_frm_sms_send_struct));
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset((S8*) sendData, 0, sizeof(mmi_frm_sms_send_struct));
- sendData->status = SMSAL_STO_UNSENT;
- memset((S8*) sendData->number, 0, MAX_DIGITS_SMS);
- #if (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__))
- /* Jp for tracker issue 20050626 */
- if (g_nsm_msg_context.is_picmsg == TRUE)
- {
- mmi_nsm_get_picmsg_sendData(sendData);
- }
- #endif /* (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) */
- #if defined(__MMI_SMART_MESSAGE_MT__)
- if (mmi_nsm_get_msg_type() == PICTURE_MESSAGE)
- {
- mmi_nsm_get_picmsg_sendData(sendData);
- }
- #endif /* defined(__MMI_SMART_MESSAGE_MT__) */
- mmi_frm_sms_save_sms(mmi_msg_save_msg_rsp, MOD_MMI, sendData);
- OslMfree(sendData);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_save_msg_with_flag_req
- * DESCRIPTION
- *
- * PARAMETERS
- * flag [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_save_msg_with_flag_req(U16 flag)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_frm_sms_send_struct *sendData = OslMalloc(sizeof(mmi_frm_sms_send_struct));
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset((S8*) sendData, 0, sizeof(mmi_frm_sms_send_struct));
- sendData->status = SMSAL_STO_UNSENT;
- memset((S8*) sendData->number, 0, MAX_DIGITS_SMS);
- sendData->sendrequire = flag;
- #if (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__))
- /* Jp for tracker issue 20050626 */
- if (g_nsm_msg_context.is_picmsg == TRUE)
- {
- mmi_nsm_get_picmsg_sendData(sendData);
- }
- #endif /* (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__)) */
- #if defined(__MMI_SMART_MESSAGE_MT__)
- if (mmi_nsm_get_msg_type() == PICTURE_MESSAGE)
- {
- mmi_nsm_get_picmsg_sendData(sendData);
- }
- #endif /* defined(__MMI_SMART_MESSAGE_MT__) */
- mmi_frm_sms_save_sms(mmi_msg_save_msg_rsp, MOD_MMI, sendData);
- OslMfree(sendData);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_save_msg_to_entry
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_save_msg_to_entry(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_msg_set_processing_screen(STR_MESSAGE_MAIN_MENU_CAPTION, STR_GLOBAL_SAVING, IMG_GLOBAL_SAVE, 0);
- mmi_msg_entry_processing_generic();
- #ifdef __MMI_UNIFIED_MESSAGE__
- if (mmi_um_get_current_msg_box_type() == UM_MSG_BOX_TYPE_DRAFT)
- {
- /* mmi_msg_delete_msg_before_save_req(MMI_FRM_SMS_APP_DRAFTS, (U16)g_msg_cntx.currBoxIndex); */
- mmi_msg_delete_msg_before_save();
- return;
- }
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- mmi_msg_save_msg_req();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_send_and_save_to_entry
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_send_and_save_to_entry(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_UNIFIED_MESSAGE__
- if (mmi_um_get_current_msg_box_type() == UM_MSG_BOX_TYPE_UNSENT)
- {
- mmi_msg_send_and_save_msg_req(
- mmi_frm_sms_get_address(MMI_FRM_SMS_UNSENT, (U16) g_msg_cntx.currBoxIndex),
- MMI_FRM_SMS_INVALID_INDEX);
- }
- else
- #endif /* __MMI_UNIFIED_MESSAGE__ */
- {
- mmi_msg_send_and_save_msg_req(NULL, MMI_FRM_SMS_INVALID_INDEX);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_reply_msg
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_reply_msg(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset(g_msg_cntx.smsPhoneNumber, 0, (MAX_DIGITS + 1) * ENCODING_LENGTH);
- g_msg_cntx.msg_send_info.CurrSendSmsNumbers = 0;
- g_msg_cntx.msg_send_info.TotalSendSmsNumbers = 1;
- mmi_msg_send_msg_req((U8*) g_msg_cntx.smsPhoneNumber, (U16) g_msg_cntx.currBoxIndex, 1);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_reply_msg_to_entry
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_reply_msg_to_entry(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_UNIFIED_COMPOSER__
- U8 *replyaddr = mmi_frm_sms_get_sms_address(MMI_FRM_SMS_INBOX, (U16)g_msg_cntx.currBoxIndex);
- ReleaseEMSEditBuffer();
- mmi_msg_entry_uc(replyaddr , (U16)MMI_UC_STATE_REPLY, (U16)g_msg_cntx.currBoxIndex, MMI_UC_MSG_TYPE_DEFAULT);
- #ifdef __UNIFIED_MESSAGE_LIST_OPTION_SUPPORT__
- if (IsScreenPresent(SCR_ID_MSG_INBOX_LIST_OPTION))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_INBOX_LIST_OPTION);
- }
- else
- #endif /* __UNIFIED_MESSAGE_LIST_OPTION_SUPPORT__ */
- if (IsScreenPresent(SCR_ID_MSG_INBOX_MSG))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_INBOX_MSG);
- }
- else
- {
- MMI_ASSERT(0);
- }
- DeleteMessagesHistoryNodes();
- return;
- #else /* __MMI_UNIFIED_COMPOSER__ */
- g_msg_cntx.sendMessageCase = SEND_CASE_REPLY;
- ReleaseEMSEditBuffer();
- #if (defined(__MMI_SMART_MESSAGE_MO__) && !defined(__MMI_MESSAGES_EMS__))
- mmi_nsm2_init_nsm_msg_struct(&g_nsm_msg_context);
- #endif
- mmi_msg_entry_write_msg();
- #endif /* __MMI_UNIFIED_COMPOSER__ */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_get_number_from_phb
- * DESCRIPTION
- *
- * PARAMETERS
- * name [?]
- * number [?]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_get_number_from_phb(U8 name[], U8 number[])
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_UNIFIED_COMPOSER__
- U8 ascii_num[MAX_DIGITS_SMS + 1];
- #endif /* __MMI_UNIFIED_COMPOSER__ */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (pfnUnicodeStrlen((PS8) number) > (MAX_DIGITS_SMS - 1))
- {
- DisplayPopup(
- (PU8) GetString(STR_SMS_NUM_LEN_EXCEEDED),
- IMG_GLOBAL_UNFINISHED,
- 1,
- PHB_NOTIFY_TIMEOUT,
- (U8) ERROR_TONE);
- return;
- }
- memset(g_msg_cntx.smsPhoneNumber, 0, (MAX_DIGITS + 1) * ENCODING_LENGTH);
- if (number)
- {
- pfnUnicodeStrcpy(g_msg_cntx.smsPhoneNumber, (PS8) number);
- }
- if (g_msg_cntx.PhbSmsInterfaceState == MMI_SEND_SMS_FROM_PHB)
- {
- #ifdef __MMI_UNIFIED_COMPOSER__
- memset(ascii_num, 0, sizeof(ascii_num));
- UnicodeToAnsii((S8*)ascii_num, (S8*)number);
- mmi_msg_entry_uc(ascii_num, MMI_UC_STATE_WRITE_NEW_MSG, 0, MMI_UC_MSG_TYPE_SMS_ONLY);
- #else /* __MMI_UNIFIED_COMPOSER__ */
- g_msg_cntx.sendMessageCase = SEND_CASE_SEND_FROM_PHB;
- mmi_msg_entry_write_msg();
- #endif /* __MMI_UNIFIED_COMPOSER__ */
- }
- else if (IsScreenPresent(SCR_ID_MSG_NUMBER))
- {
- /* put the selected number to editor */
- HistoryReplace(SCR_ID_MSG_NUMBER, SCR_ID_MSG_NUMBER, mmi_msg_entry_phone_number);
- GoBackToHistory(SCR_ID_MSG_NUMBER);
- }
- else
- {
- mmi_msg_entry_phone_number();
- }
- }
- #ifdef __MMI_UNIFIED_COMPOSER__
- /*****************************************************************************
- * FUNCTION
- * mmi_msg_edit_msg_by_uc
- * DESCRIPTION
- * Edit msg by unified composer
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_msg_edit_msg_by_uc(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- UmMsgBoxType msgbox_type = mmi_um_get_current_msg_box_type();
- U8* addr = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (msgbox_type == UM_MSG_BOX_TYPE_INBOX)
- {
- addr = mmi_frm_sms_get_address(MMI_FRM_SMS_INBOX, (U16) g_msg_cntx.currBoxIndex);
- }
- else if (msgbox_type == UM_MSG_BOX_TYPE_UNSENT)
- {
- addr = mmi_frm_sms_get_address(MMI_FRM_SMS_UNSENT, (U16) g_msg_cntx.currBoxIndex);
- }
- else if (msgbox_type == UM_MSG_BOX_TYPE_SENT)
- {
- addr = mmi_frm_sms_get_address(MMI_FRM_SMS_OUTBOX, (U16) g_msg_cntx.currBoxIndex);
- }
- else if (msgbox_type == UM_MSG_BOX_TYPE_DRAFT)
- {
- addr = mmi_frm_sms_get_address(MMI_FRM_SMS_DRAFTS, (U16) g_msg_cntx.currBoxIndex);
- }
- else
- {
- MMI_ASSERT(0);
- }
- mmi_msg_entry_uc(addr , MMI_UC_STATE_EDIT_EXISTED_MSG, (U16)g_msg_cntx.currBoxIndex, MMI_UC_MSG_TYPE_DEFAULT);
- #ifdef __UNIFIED_MESSAGE_LIST_OPTION_SUPPORT__
- if (IsScreenPresent(SCR_ID_MSG_INBOX_LIST_OPTION))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_INBOX_LIST_OPTION);
- }
- else if (IsScreenPresent(SCR_ID_MSG_OUTBOX_LIST_OPTION))
- {
- SetMessagesScrnIdToDelHistoryNodes(SCR_ID_MSG_OUTBOX_LIST_OPTION);
- }
- else if (IsScreenPresent(SCR_ID_MSG_DEFAULT_LIST_OPTION))