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

📄 mmismsread.c

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

					CONDAT (UK)

********************************************************************************                                                                              

 This software product is the property of Condat (UK) Ltd and may not be
 disclosed to any third party without the express permission of the owner.                                 
                                                                              
********************************************************************************

 $Project name:	Basic MMI                                                      
 $Project code:	BMI                                                            
 $Module:		SMS
 $File:		    MmiSmsRead.c
 $Revision:		1.0                                                       
                                                                              
 $Author:		Condat(UK)                                                         
 $Date:		    25/10/00                                                      
                                                                               
********************************************************************************
                                                                              
 Description:
 
    Shared definitions of data elements are made in here
    and accessed via the primitive operations supplied
                        
********************************************************************************

 $History: MmiSmsRead.c

	25/10/00			Original Condat(UK) BMI version.	
	14/10/00			SPR 1257 - merged in issue 888 from b-sample line (extract
						number from SMS improvements) and made changes to accommodate
						Unicode SMSs containing numbers. 
	   
 $End

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

#define MMI_SMSREAD_C

#define ENTITY_MFW

/* includes */
#include <string.h>
#include <stdio.h>
#include <stdlib.h>

#if defined (NEW_FRAME)

#include "typedefs.h"
#include "vsi.h"
#include "pei.h"
#include "custom.h"
#include "gsm.h"

#else

#include "stddefs.h"
#include "custom.h"
#include "gsm.h"
#include "vsi.h"

#endif
#include "p_sim.h"


#include "mfw_mfw.h"
#include "mfw_win.h"
#include "mfw_kbd.h"
/* SPR#1428 - SH - New Editor changes */
#ifndef NEW_EDITOR
#include "mfw_edt.h"
#endif
#include "mfw_tim.h"
#include "mfw_phb.h"
#include "ksd.h"
#include "psa.h"
#include "mfw_sms.h"
#include "mfw_smsi.h"
#include "mfw_icn.h"
#include "mfw_mnu.h"
#include "mfw_lng.h"
#include "mfw_sat.h"
#include "mfw_kbd.h"
#include "mfw_nm.h"

#include "psa_util.h"

#include "dspl.h"

#include "MmiMain.h"
#include "MmiDummy.h"
#include "MmiMmi.h"
#include "mmicall.h"//GW 29/11/01 for 'callNumber'

#include "MmiDialogs.h"
#include "MmiLists.h"
#include "MmiMenu.h"
#include "MmiSoftKeys.h"
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
#include "ATBCommon.h"
#include "ATBDisplay.h"
#include "ATBEditor.h"
#include "AUIEditor.h"
#else
#include "MmiEditor.h"
#endif
#include "MmiBookShared.h" // MZ 
#include "mmiSmsMenu.h"
#include "MmiSmsSend.h"
#include "MmiSmsRead.h"
#include "MmiSmsIdle.h"
#include "MmiResources.h"/*MC*/
#include "mfw_ffs.h"

#include "cus_aci.h"
#include "p_sim.h"
#include "pcm.h"

#include "message.h"
#include "prim.h"
#include "aci_cmh.h"	//GW 29/11/01 added for types in aci_fd.h
#include "aci_fd.h"		//GW 29/11/01 added for types in 'cmh.h'
#include "cmh.h" 		//GW 29/11/01 added for types in 'cmh_phb.h'
#include "cmh_phb.h"	//GW 29/11/01 added for cmhPHB_getAdrStr

#include "mmicolours.h"
//GW 29/11/01 - added header file - removed extern void callNumber(UBYTE* number);
MfwWin* getWinData( MfwHnd win);

/*SPR 1453*/
#ifdef LSCREEN
#define UCS2_MENU_TEXT_LEN 104
#else
#define UCS2_MENU_TEXT_LEN 36 /*mc SPR 1242, no of bytes in latin unicode string which fills one whole line*/ 
#endif

#define MAX_EDITOR_HEADER_LENGTH 25


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

				 DYNAMIC MENU WINDOW. DECLARATION

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

typedef enum
{
    E_DELETE,
    E_REPLY,
    E_CALL_SENDER,
    E_SAVE_NUMBER,
    E_DATE_TIME,
    E_FORWARD
};

// Those information are passed to the sms editor
typedef struct
{
	SHORT          sms_index;
	T_MMI_SMS_STAT sms_type;
	T_MFW_SMS_PARA *sms_info;
	char *assoc_name;
}T_SMS_EDITOR_DATA;


/* This variable is used to know in which state we are when MFW callback function is called */
typedef struct
{
	SHORT nb_sms_stored;
	T_MFW_SMS_IDX sms_messages[MAX_MESSAGES]; /* store info about the SMS: index... */
	wstring_t* sms_header[MAX_MESSAGES]; /* header displayed in the dynamic menu */
}T_SMS_LIST_DATA;

typedef struct
{
    /* administrative data */

    T_MMI_CONTROL   mmi_control;
    T_MFW_HND       win;
    SHORT           id;
    T_MFW_HND       parent;

    /* associated handlers */

    T_MFW_HND       sms_handle;         /* MFW sms handler      */

    /* internal data */
	T_SMS_LIST_DATA sms_list_data;
	T_SMS_EDITOR_DATA sms_editor_data;
	ListMenuData *menu_list_data;
    UBYTE           option_select;  /* indicate what the user selected in the Optionsmenu*/

} T_SMSREAD_R;
T_SMSREAD_R* getUserData_T_SMSREAD_R( T_MFW_WIN *win)
{
	if (win == NULL)
		return (NULL);
	return((T_SMSREAD_R *)win->user);
}


typedef struct
{
    /* administrative data */

    T_MMI_CONTROL   mmi_control;
    T_MFW_HND       win;
    SHORT           id;
    T_MFW_HND       parent;
    T_MFW_HND       editor_win;

    /* associated handlers */


    /* internal data */
	T_SMS_EDITOR_DATA *sms_editor_data;
	ListMenuData *menu_list_data;
} T_SMSREAD_R_TEXTEDT2;
T_SMSREAD_R_TEXTEDT2* getUserData_T_SMSREAD_R_TEXTEDT2( T_MFW_WIN *win)
{
	if (win == NULL)
		return (NULL);
	return((T_SMSREAD_R_TEXTEDT2 *)win->user);
}



typedef struct
{
    /* administrative data */

    T_MMI_CONTROL   mmi_control;
    T_MFW_HND       win;
    SHORT           id;
    T_MFW_HND       parent;

    /* associated handlers */

    /* !!! **************************************** modify here **************************************** !!!*/
    T_MFW_HND       kbd;
    T_MFW_HND       kbd_long;
    T_MFW_HND       menu;
    /* !!! **************************************** end modify here **************************************** !!! */

    /* internal data */

    /* !!! **************************************** modify here **************************************** !!!*/
    BOOL            answer; /* TRUE == YES, FALSE == NO */
	T_MFW_HND		sms;
    T_MFW_HND       dialog_win;

    /* !!! **************************************** end modify here **************************************** !!! */
	T_SMS_EDITOR_DATA *sms_editor_data;    //NM 25.8
} T_SMSREAD_R_OPT;
T_SMSREAD_R_OPT* getUserData_T_SMSREAD_R_OPT( T_MFW_WIN *win)
{
	if (win == NULL)
		return (NULL);
	return((T_SMSREAD_R_OPT *)win->user);
}





static enum
{
	READ_SMS_LIST,
	READ_SELECTED_SMS
} g_sms_state;	

//MZ 7/02/01 tmp enums.
static enum
{
	MFW_MB_LINE1,
	MFW_MB_DATA
}mfw_mailBox_type;

/*SPR 1508, changed codes 128, 129 and 130 to 129, 130, and 131 respectively.*/
static const char g_translation_ascii_table[128] = { 64, 156, 36, 157, 138, 131, 151, 141, 149, 129,
													 10,   2 ,  7,  32, 143, 134,   4,  95, 232, 226, 239, 234, 227,   5, 228,
											 		233, 240,  32, 146, 145, 225, 144,  32,  33,  34,  35,   1,  37,  38,  39,
											 		 40,  41,  42,  43,  44, 45,  46,  47,  48,  49,  50,  51,  52,  53,  54,
											 		 55,  56,  57,  58,  59,  60,  61,  62,  63, 173,  65,  66,  67,  68,  69,
											 		 70,  71,  72,  73,  74,  75,  76,  77,  78,  79,  80,  81,  82,  83,  84,
											 		 85,  86,  87,  88,  89,  90, 142, 153, 165, 154,  168, 06,  97,  98,  99,
											 		100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
											 		115, 116, 117, 118, 119, 120, 121, 122, 132, 148, 164, 130, 133};



static const int g_translation_unicode[128] = { 0x0040, 0x00A3, 0x0024, 0x00A5, 0x00E8, 0x00E9, 0x00F9, 0x00EC, 0x00F2, 0x00C7, 0x000A, 0x00D8, 0x00F8,
												0x000D, 0x00C5, 0x00E5, 0x0394, 0x005F, 0x03A6, 0x0393, 0x039B, 0x03A9, 0x03A0, 0x03A8, 0x03A3, 0x0398,
												0x039E, 0x03A2, 0x00C6, 0x00E6, 0x00DF, 0x00C9, 0x0020, 0x0021, 0x0022, 0x0023, 0x00A4, 0x0025, 0x0026,
												0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, 0x0030, 0x0031, 0x0032, 0x0033,
												0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, 0x00A1,
												0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D,
												0x004E, 0x004F, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A,
												0x00C4, 0x00D6, 0x00D1, 0x00DC, 0x00A7, 0x00BF, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
												0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074,
												0x0075,	0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x00E4, 0x00F6, 0x00F1, 0x00FC,	0x00E0};

/*SPR 1508, added conversion table*/												
static const int translation_ascii_2_unicode[256] = { 
	0x0000, 0x00A4, 0x00d8, 0xFFFF, 0x0394, 0x03A8, 0x00BF, 0x00F8, 0xFFFF, 0xFFFF, 0x000A, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
	0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
	0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026,0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
	0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
	0x0040,0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
	0x0050, 0x0051, 0x0052, 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FF, 0xFFFF, 0xFFFF,
	0xFFFF, 0x00DF, 0x0393, 0x03A0, 0x03A3, 0xFFFF, 0xFFFF, 0xFFFF, 0x03A6, 0x0398, 0x03A9, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x039B, 
	0x039E, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF
	};


static const MfwMnuAttr readSMS_menuAttrib =
{
    &readSMS_menuArea,
    MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu       */
    -1,                                 /* use default font         */
    NULL,                               /* with these items         */
    0,                                   /* number of items     */
	COLOUR_LIST_SMS,
	TxtMessages,
	NULL, 
	MNUATTRSPARE

};




static SHORT g_sms_list_counter;

static SHORT g_nb_line_sms;
static int search_index;	/* SPR888 - SH - keeps track of position within SMS for extract number */

static  T_MFW_HND       info_win=0;
static T_MFW_HND        deleting_win = 0;
static  T_MFW_HND       list_win=0;

static char sms_text_ascii[MAX_EDITOR_LEN];

/* we need this variable "read_status" to know which sms message we are going
   to edit (user pressed in the sms menu-> EDIT)
   because SMS_MT & SMS_MO have different size of character 
   (current length saved in "current_sms_len") !!
   SMS_MT includes additional TIME, DATE and NUMBER and we dont want
   to show it when we are editing.
*/
static UBYTE read_status;
static USHORT current_sms_len= 0;

static T_SmsUserData   SmsData;

static T_MFW_HND smsRead_NumberName_info_screen(T_MFW_HND parent_window, T_SmsUserData *UserData,char* name);
UBYTE check_assoc_name(char *name, T_MFW_SMS_ADDR sms_addr);


static T_MFW_HND SmsRead_R_OPT_create (T_MFW_HND parent);
static void SmsRead_R_OPT_destroy (T_MFW_HND window);
static void SmsRead_R_OPT_StandardDialog(T_MFW_HND win, char *text, ULONG duration);
static void SmsRead_R_OPT_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static int SmsRead_R_OPT_win_cb (MfwEvt e, MfwWin *w);
static int SmsRead_R_OPT_mfw_cb (MfwEvt event, void *parameter);
static int SmsRead_R_OPT_dialog_cb(T_MFW_HND win, USHORT Identifier, USHORT Reason);
static int SmsRead_R_OPT_kbd_cb (MfwEvt e, MfwKbd *k);
static int SmsRead_R_OPT_mnu_cb (MfwEvt e, MfwMnu *m);
static int SmsRead_R_OPTExeDelete(MfwMnu* m, MfwMnuItem* i);
static int SmsRead_R_OPTExeReply(MfwMnu* m, MfwMnuItem* i);
static int SmsRead_R_OPTExeStoreNumber(MfwMnu* m, MfwMnuItem* i);
void SmsRead_StoreNumber(void);
static int SmsRead_R_OPTExeEdit(MfwMnu* m, MfwMnuItem* i);


/* R is the identifier used for the function of the Read menu window */
static T_MFW_HND SmsRead_R_create (T_MFW_HND parent);
static void SmsRead_R_destroy (T_MFW_HND window);
static void SmsRead_R_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static int SmsRead_R_win_cb (MfwEvt e, MfwWin *w);
static int SmsRead_R_mfw_cb(MfwEvt event, void *parameter);
static int SmsRead_R_dialog_cb(T_MFW_HND win, USHORT Identifier, USHORT Reason);
static void SmsRead_R_smslist_cb(T_MFW_HND * Parent, ListMenuData * ListData);
static void SmsRead_R_BuildList(T_MFW_HND win,int inUnicode);

// Fill an unicode structure for display
void string_CopyW2W(wstring_t *strDestination, charw_t *strSource, USHORT count );


static T_MFW_HND SmsRead_R_TEXTEDT2_create (T_MFW_HND parent);
static void SmsRead_R_TEXTEDT2_destroy (T_MFW_HND window);
static void SmsRead_R_TEXTEDT2_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static int SmsRead_R_TEXTEDT2_win_cb (MfwEvt e, MfwWin *w);
static void SmsRead_R_TEXTEDT2_editor_cb(T_MFW_HND win, USHORT Identifier, USHORT Reason);
static void SmsRead_R_TEXTEDT2_smslist_cb(T_MFW_HND * Parent, ListMenuData * ListData);

static BOOL Search_forNextNumber(T_SmsUserData *UserData);

⌨️ 快捷键说明

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