⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmismsread.c

📁 GSM手机设计软件代码
💻 C
📖 第 1 页 / 共 5 页
字号:

/*******************************************************************************

 $Function:    	SmsRead_R_BuildList

 $Description:	Build the list of SMS for the dynamic list.
 
 $Returns:		status

 $Arguments:	win - current window handler
 
*******************************************************************************/

void SmsRead_R_BuildList(T_MFW_HND win, int inUnicode)
{

    T_MFW_WIN       * win_data;
    T_SMSREAD_R * data;    

    /* List is complete so present menu. */
    USHORT i;

    TRACE_FUNCTION("SmsRead_R_BuildList");
	
	win_data = getWinData(win); 
	data = getUserData_T_SMSREAD_R(win_data);
	
	data->menu_list_data = (ListMenuData *)ALLOC_MEMORY(sizeof(ListMenuData));

	if(data->menu_list_data == 0)
	{
		TRACE_EVENT("Failed memory alloc 1 ");
		return;
	}
		
	data->menu_list_data->List = (T_MFW_MNU_ITEM *)ALLOC_MEMORY( MAX_MESSAGES * sizeof(T_MFW_MNU_ITEM) );//JVJE

	if(data->menu_list_data->List == 0)
	{
		TRACE_EVENT("Failed memory alloc 2");
		return;
	}
		
	
	for (i = 0; i < ((data->sms_list_data).nb_sms_stored); i++)
	{
		mnuInitDataItem(&data->menu_list_data->List[i]);
		data->menu_list_data->List[i].str  = (char *)(data->sms_list_data).sms_header[i];
		data->menu_list_data->List[i].flagFunc = item_flag_none; 
	}
	
   	data->menu_list_data->ListLength =(data->sms_list_data).nb_sms_stored;
	data->menu_list_data->ListPosition = 1;
	data->menu_list_data->CursorPosition = 1;
	data->menu_list_data->SnapshotSize =(data->sms_list_data).nb_sms_stored;
	data->menu_list_data->Font = 0;
	data->menu_list_data->LeftSoftKey = TxtSoftSelect;
	/*NM p032*/
	if(test_sim EQ TRUE)
		data->menu_list_data->RightSoftKey = TxtDelete;
	else
		data->menu_list_data->RightSoftKey = TxtSoftBack;
		
	data->menu_list_data->KeyEvents = KEY_ALL;
	data->menu_list_data->Reason = 0;
	data->menu_list_data->Strings = TRUE;
 	data->menu_list_data->Attr   = (MfwMnuAttr*)&readSMS_menuAttrib;
	data->menu_list_data->autoDestroy    = FALSE;
 	
    /* Create the dynamic menu window */
listDisplayListMenu(win, data->menu_list_data, (ListCbFunc_t)SmsRead_R_smslist_cb,inUnicode);
list_win = data->menu_list_data->win;
	if (info_win){
          SEND_EVENT(info_win,DIALOG_DESTROY,0,0 );
          info_win = 0;
	}
}



/*******************************************************************************

 $Function:    	SmsRead_R_OPTExeDelete

 $Description:	Called when the user press Delete in the Option menu
 			
 $Returns:		event status.

 $Arguments:	m - pointer to menu.
 				i - index if selected menu item.
*******************************************************************************/

static int SmsRead_R_OPTExeDelete(MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND     	   win      = mfwParent(mfw_header());
    T_MFW_WIN        * win_data = ((T_MFW_HDR *)win)->data;
    T_SMSREAD_R_OPT  * data     = (T_SMSREAD_R_OPT *)win_data->user;

	/* access to data from parent   */
    T_MFW_HDR    * parent      =  data->parent;
    T_MFW_WIN    * win_data2   =  ((T_MFW_HDR *)parent)->data;
    
    T_SMSREAD_R_TEXTEDT2  * parent_data =  (T_SMSREAD_R_TEXTEDT2 *)win_data2->user;
	

	TRACE_FUNCTION("SmsRead_R_OPTExeDelete");
	
	if(sms_msg_delete((UBYTE)parent_data->sms_editor_data->sms_index)== MFW_SMS_OK)
	{
       /* set the status that the user selected the delete item */
		if(deleting_win == 0)
			deleting_win= mmi_dialog_information_screen_forever(win,TxtPleaseWait, NULL, COLOUR_STATUS_WAIT);
	}

   // Destroy the text editor and free memory.
   SmsRead_R_TEXTEDT2_destroy(parent_data->win);
   SmsRead_R_OPT_destroy(data->win);			
   
}

/*******************************************************************************

 $Function:    	SmsRead_R_OPTExeReply

 $Description:	Called when the user press Reply in the Option menu
 			
 $Returns:		event status.

 $Arguments:	m - pointer to menu.
 				i - index if selected menu item.
*******************************************************************************/

static int SmsRead_R_OPTExeReply(MfwMnu* m, MfwMnuItem* i)
{

    T_MFW_HND       win  = mfwParent(mfw_header());
    T_MFW_WIN     * win_data = ((T_MFW_HDR *)win)->data;
    T_SMSREAD_R_OPT         * data = (T_SMSREAD_R_OPT *)win_data->user;	
	
	T_MFW_HDR    * parent      =  data->parent;
    T_MFW_WIN    * win_data2   =  ((T_MFW_HDR *)parent)->data;
    
    T_SMSREAD_R_TEXTEDT2  * parent_data =  (T_SMSREAD_R_TEXTEDT2 *)win_data2->user;
	

	TRACE_FUNCTION("SmsRead_R_OPTExeReply");

	    /* Copy the number and name information to the SMS buffer
	    */
	 /*MC SPR 1257, clear whole buffer in case of Unicode entry*/
    memset(SmsData.TextBuffer, '\0', MAX_MSG_LEN_ARRAY);
		//Copy the calling number for pasting into the number buffer;
	    strcpy((char *)SmsData.NumberBuffer,(char *)parent_data->sms_editor_data->sms_info->sms_mt.orig_addr.number); 

	      // SH - Check the reply path to see if we should use our own service centre number
	      
		if ( parent_data->sms_editor_data->sms_info->sms_mt.rp &&
			strlen(parent_data->sms_editor_data->sms_info->sms_mt.sc_addr) != 0 )
		{
			SmsData.called_from_reply_item = TRUE;
	  	  	/* copy the service center number as well */
			strcpy((char *)SmsData.CentreBuffer, (char *)parent_data->sms_editor_data->sms_info->sms_mt.sc_addr);
		}
		else
		{
			/* use the own Service Center Number if the caller doesnt send one*/
			SmsData.called_from_reply_item = FALSE;
		}

	/* p304 SH save window pointer */
		win = parent_data->win;
		// Destroy the text editor, free memory
	    SmsRead_R_TEXTEDT2_destroy(parent_data->win);
		/* Destroy the Options Menu and text editor.before starting the Send Editor.*/
		SmsRead_R_OPT_destroy(data->win);

		/* NM,  FTA 34.2.8  */
		
		/* p304 SH - call this after destroying editor & windows. parent_data is lost,
		so use pointer saved from above */
		SmsSend_SEND_start(win, (void *) &SmsData);
    

    
	
    return 1;
}

/*******************************************************************************

 $Function:    	SmsRead_R_OPTExeStoreNumber

 $Description:	Called when the user press Store Number in the Option menu
 			
 $Returns:		event status.

 $Arguments:	m - pointer to menu.
 				i - index if selected menu item.
*******************************************************************************/

static int SmsRead_R_OPTExeStoreNumber(MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND       win  = mfwParent(mfw_header());
    T_MFW_WIN     * win_data = ((T_MFW_HDR *)win)->data;
    T_SMSREAD_R_OPT         * data = (T_SMSREAD_R_OPT *)win_data->user;

	T_MFW_HDR    * parent      =  data->parent;
    T_MFW_WIN    * win_data2   =  ((T_MFW_HDR *)parent)->data;
    T_SMSREAD_R_TEXTEDT2  * parent_data =  (T_SMSREAD_R_TEXTEDT2 *)win_data2->user;
	T_MFW_PHB_ENTRY  pb_data;
	UBYTE found_name;			/*SPR888 -SH*/
	T_MFW_SMS_ADDR    *orig_addr;   /*SPR888 -SH*/
	
	TRACE_FUNCTION("SmsRead_R_OPTExeStoreNumber");

	 /* Copy the number and name information to the SMS buffer
    */
	
	orig_addr = &parent_data->sms_editor_data->sms_info->sms_mt.orig_addr;	/* SH - makes easier to read! */

	if(orig_addr->ton == MFW_TON_INTERNATIONAL && (char)orig_addr->number[0]!='+'
		&& strlen((char *)orig_addr->number)>0 )
		/* SPR888 - SH - do not add + if already there */
	{
		strcpy((char *)SmsData.NumberBuffer,"+");
		strcat((char *)SmsData.NumberBuffer,(char *)orig_addr->number); 
	}
	else
	{
		strcpy((char *)SmsData.NumberBuffer,(char *)orig_addr->number); 
	}


	if (read_status EQ MMI_SMS_MT)
	{
		/* MT -SMS has the additional information (Date, Time & Number)
		   we dont want to show these when we are editing       */
    	memcpy(SmsData.TextBuffer,&sms_text_ascii[current_sms_len],MAX_MSG_LEN_ARRAY);
	}
	else
	{
		//when we were reading the saved-SMS with the length of MAX_MSG_LEN
  		memcpy(SmsData.TextBuffer,sms_text_ascii,MAX_MSG_LEN_ARRAY);/* assumption: sms_text_ascii is still filled from reading the SMS*/
	}
	
	/* SPR888 - SH - Start looking for numbers from beginning of SMS text */
	
	search_index = 0;
	if (strlen((char *)SmsData.NumberBuffer)==0)
	{
		Search_forNextNumber(&SmsData);
	}

	if (strlen((char *)SmsData.NumberBuffer)==0)
	{
		mmi_dialog_information_screen(parent_data->win, TxtNotAvailable, NULL, NULL, NULL);
	}
	else
	{
		//Search the phonebook for the sender number entry and display the tag and number.
		if (bookFindNameInPhonebook((const char*)&SmsData.NumberBuffer[0], &pb_data) !=0)
		{
#ifdef NO_ASCIIZ			
			//Display the tag and number dialog.
			/* SPR888 - SH - parent_data->parent changed to parent_data->win */
			smsRead_NumberName_info_screen(/*parent_data->parent*/parent_data->win,(void *)&SmsData, (char*)pb_data.name.data);
#else
			//Display the tag and number dialog.
			/* SPR888 - SH - parent_data->parent changed to parent_data->win */
			smsRead_NumberName_info_screen(parent_data->win,(void *)&SmsData, (char*)pb_data.name);
#endif

		}
		else
		{
			/* SPR888 - SH - parent_data->parent changed to parent_data->win */
			smsRead_NumberName_info_screen(parent_data->win,(void *)&SmsData,NULL);
		}
	}

	// Destroy the text editor, rel memory. 
    SmsRead_R_TEXTEDT2_destroy(parent_data->win);
	/* Destroy the Options Menu and text editor. */
	SmsRead_R_OPT_destroy(data->win);
   	
    return 1;
}

/*******************************************************************************

 $Function:    	SmsRead_R_OPTExeEdit

 $Description:	Called when the user press Forward in the Option menu
 			
 $Returns:		event status.

 $Arguments:	m - pointer to menu.
 				i - index if selected menu item.
*******************************************************************************/

static int SmsRead_R_OPTExeEdit(MfwMnu* m, MfwMnuItem* i)
{
    T_MFW_HND       win  = mfwParent(mfw_header());
    T_MFW_WIN     * win_data = ((T_MFW_HDR *)win)->data;
    T_SMSREAD_R_OPT         * data = (T_SMSREAD_R_OPT *)win_data->user;

	T_MFW_HDR    * parent      =  data->parent;
    T_MFW_WIN    * win_data2   =  ((T_MFW_HDR *)parent)->data;
    T_SMSREAD_R_TEXTEDT2  * parent_data =  (T_SMSREAD_R_TEXTEDT2 *)win_data2->user;

    T_DISPLAY_DATA Dialog;


	TRACE_FUNCTION("SmsRead_R_OPTExeEdit");
	if (FFS_flashData.ConcatenateStatus == TRUE )
	{
		 /* Copy the number and name information to the SMS buffer
	    */
	    SmsData.NumberBuffer[0] = '\0';

		if (read_status EQ MMI_SMS_MT)
		{
			/* MT -SMS has the additional information (Date, Time & Number)
			   we dont want to show these when we are editing       */
	    	memcpy(SmsData.TextBuffer,&sms_text_ascii[current_sms_len],MAX_MSG_LEN_ARRAY);
		}
		else
		{
			//when we were reading the saved-SMS with the length of MAX_MSG_LEN
	  		memcpy(SmsData.TextBuffer,sms_text_ascii,MAX_MSG_LEN_ARRAY);/* assumption: sms_text_ascii is still filled from reading the SMS*/
		}
		SmsData.called_from_reply_item = FALSE;

		

		
	/* p304 SH save window pointer */
		win = parent_data->win;
		// Destroy the text editor, free memory
	    SmsRead_R_TEXTEDT2_destroy(parent_data->win);
		/* Destroy the Options Menu and text editor.before starting the Send Editor.*/
		SmsRead_R_OPT_destroy(data->win);

		/* NM,  FTA 34.2.8  */
		
		/* p304 SH - call this after destroying editor & windows. parent_data is lost,
		so use pointer saved from above */
		SmsSend_SEND_start(win, (void *) &SmsData);
	}
	/* API - 28-01-03 - 1628 - Allow the editing of a single SMS if ConcatenateStatus is FALSE */
	/* API - 19-03-03 - 1825 - Allow the editing of a single saved SMS if ConcatenateStatus is FLASE*/
	else if ((FFS_flashData.ConcatenateStatus == FALSE) && ((parent_data->sms_editor_data->sms_info->sms_mt.msg_len <= MAX_MSG_LEN_SGL)
			|| (parent_data->sms_editor_data->sms_info->sms_mo.msg_len <= MAX_MSG_LEN_SGL)))
	{
		TRACE_EVENT_P1("msg_len in edit is = %d", parent_data->sms_editor_data->sms_info->sms_mt.msg_len);

		/* Copy the number and name information to the SMS buffer
	    */
	    SmsData.NumberBuffer[0] = '\0';

		if (read_status EQ MMI_SMS_MT)
		{
			/* MT -SMS has the additional information (Date, Time & Number)
			   we dont want to show these when we are editing       */
	    	memcpy(SmsData.TextBuffer,&sms_text_ascii[current_sms_len],MAX_MSG_LEN_SGL);
		}
		else
		{
			//when we were reading the saved-SMS with the length of MAX_MSG_LEN
	  		memcpy(SmsData.TextBuffer,sms_text_ascii,MAX_MSG_LEN_SGL);/* assumption: sms_text_ascii is still filled from reading the SMS*/
		}
		SmsData.called_from_reply_item = FALSE;

		win = parent_data->win;
		// Destroy the text editor, free memory
	    SmsRead_R_TEXTEDT2_destroy(parent_data->win);
		/* Destroy the Options Menu and text editor.before starting the Send Editor.*/
		SmsRead_R_OPT_destroy(data->win);
		
		SmsSend_SEND_start(win, (void *) &SmsData);
	}
	/* API - 28-01-03 - 1628 - END */
	else
	{
	/* Initialise the dialog control block with default information
	*/
	dlg_initDisplayData_TextId( &Dialog, TxtNull, TxtNull, TxtNotAllowed, TxtNull , COLOUR_STATUS_WAIT);
	dlg_initDisplayData_events( &Dialog, (T_VOID_FUNC)NULL, 3000, KEY_CLEAR );

	/* Show the dialog
	*/
	info_dialog( win, &Dialog );
	
	}
    return 1;
}

/*******************************************************************************

 $Function:    	SmsRead_R_READSMS_OPT_start

 $Description:	Start the creation of the Option Window from the Read SMS
  				Text window.
 			
 $Returns:		mfw window handler

 $Ar

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -