MTK添加短信同号删除功能

MTK定义的短信列表如下:

 

static U16 srv_sms_inbox_list[SRV_SMS_MAX_SMS_ENTRY];
static U16 srv_sms_outbox_list[SRV_SMS_MAX_SMS_ENTRY];
static U16 srv_sms_drafts_list[SRV_SMS_MAX_SMS_ENTRY];

 

这些短信列表分别记录了收件箱、发件箱和草稿箱的message id,我们知道MTK是根据message id来删除短信的,而通过message id又可以获得message number。依此,可以做一个同号删除的功能。

 

 U16 g_message_list_size; U16*g_message_id_list; U32 g_message_number; /********************************************************** *FUNCTION: * 删除短信准备,记录下短信列表、条数、号码。 ***********************************************************/ static void mmi_message_same_delete_pre(void) { S8 *msg_number; //根据信箱类型(收件箱、发件箱等)获得短信列表 srv_sms_get_list_and_size(&g_message_id_list, g_message_list_size, g_sms_cntx.curr_box_type); //根据当前message id 获得号码 msg_number = (S8*)srv_sms_get_msg_asc_address(g_sms_cntx.curr_msg_id); //使用MTK 的函数,把号码转换为8字节的整数 g_message_number = srv_phb_sse_convert_number_to_int(msg_number); //显示正在删除提示界面 mmi_sms_set_processing_screen_sg(g_sms_gid, 0, STR_GLOBAL_DELETING, 0); mmi_sms_entry_processing_generic_sg(); mmi_message_same_deleting(); } /*********************************************************** *FUNCTION: * 寻找号码相同的短信进行删除; * 若没有找到,关闭正在删除和选项界面。 ************************************************************/ static void mmi_message_same_deleting(void) { S8 *number; U32 num; MMI_BOOL flag=MMI_FALSE; g_message_list_size--; for(; g_message_list_size>=0; g_message_list_size--) { number = (S8*)srv_sms_get_msg_asc_address(g_message_id_list[g_message_list_size]); num = srv_phb_sse_convert_number_to_int(number); if(g_message_number == num) { //号码相等的短信 flag = MMI_TRUE; break; } } if(flag==MMI_TRUE) { srv_sms_delete_msg( g_message_id_list[g_message_list_size], mmi_message_same_delete_rsp, NULL); } else { mmi_sms_display_popup( (UI_string_type) GetString(STR_GLOBAL_DELETED), MMI_EVENT_EXPLICITLY_DELETED); g_sms_cntx.curr_msg_id = SRV_SMS_INVALID_MSG_ID; mmi_frm_scrn_close(g_sms_gid, SCR_ID_SMS_PROCESSING); mmi_frm_scrn_close(g_sms_gid, SCR_ID_SMS_VIEWER_OPTIONS); } } /*********************************************************** *FUNCTION: * 删除短信返回,根据返回结果; * 如果成功则继续删除,否则弹出提示 ************************************************************/ static void mmi_message_same_delete_rsp(srv_sms_callback_struct* callback_data) { SmsCBFuncPtr callback_func = (SmsCBFuncPtr)callback_data->user_data; if(callback_data->result == MMI_TRUE) { mmi_message_same_deleting(); } else { mmi_sms_display_popup( (UI_string_type) GetString(STR_GLOBAL_UNFINISHED), MMI_EVENT_FAILURE); } }

你可能感兴趣的:(list,delete,processing,callback,sms,MTK)