comparison src/aci2/bmi/mmiEmsCreate.c @ 120:3c2acfa1a72f

src/aci2/bmi: file renames to make filename case consistent
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 07 Oct 2016 03:46:05 +0000
parents src/aci2/bmi/mmiemscreate.c@93999a60b835
children
comparison
equal deleted inserted replaced
119:b92a33c204b6 120:3c2acfa1a72f
1
2 /*******************************************************************************
3
4 TI (Shanghai)
5
6 ********************************************************************************
7
8 This software product is the property of TI (Shanghai) Ltd and may not be
9 disclosed to any third party without the express permission of the owner.
10
11 ********************************************************************************
12
13 $Project name: TISHMMS Project
14 $Project code: BMI (6349)
15 $Module: MMS
16 $File: MmiEMSCreate.c
17 $Revision: 1.0
18
19 $Author: Pinghua create (pinghua-zhang@ti.com )
20 $Date: 26/08/03
21
22 ********************************************************************************
23
24 Description:
25
26 This module provides definitions of the types and
27 constants which are shared across the MMS
28 application modules.
29
30 ********************************************************************************
31 $History: MmiMMSCreate.h
32
33 xrashmic 08 Feb, 2005 MMI-SPR-27853
34 Added more parameters to the information_dialog function
35
36 MMI-SPR-27384 Dec-16-2004 - xreddymn
37 Modifications for EMS inbox presentation
38
39 xrashmic 9 Dec, 2004 MMI-SPR-27385
40 Description: No response on selecting the EMS preview option
41 Solution: Removed the EMS preview option, since the editor itself acts as preview.
42
43 xrashmic 7 Dec, 2004 MMI-SPR-23965
44 Description: Not able to extract the objects in EMS message
45 Solution: Extract and store the objects in the Object Manager
46
47 MMI-SPR-25278: Nov-29-2004 - xreddymn
48 Implemented FFS limits for MMS/EMS storage
49
50 CRR: 25302 - xpradipg 10 Nov 2004
51 Description: Should be able to select the number fro the phonebook while
52 sending MMS/EMS.
53 Solution: The new feature to select the number from phonebook while sending
54 MMS/EMS is added
55
56 CRR: 25329 - xpradipg 27 Oct 2004
57 Description: Delete option in EMS create does not work
58 Solution: the option is removed since a Softkey is provided in the compose
59 screen, that can be used to delete objects directly.
60
61 MMI-SPR-25273: Oct-14-2004 - xreddymn
62 Description: EMS forward not working
63 Solution: Added changes to implement the EMS forward feature
64
65 CRR: 25291 - xrashmic 14 Oct 2004
66 Description: The sent EMS is stored in unsent folder.
67 Solution: The Outbox has been removed, instead we now have Sent folder for the sent EMS
68
69 CRR: 24741 - xpradipg 17 Sept 2004
70 Description: Default values to be removed in text editor of MMS and EMS
71 Solution: The buffer assigned to the text editor is reset.
72
73 MMI-SPR-24735: Sep-16-2004 - xreddymn
74 Added changes to reduce flickering of EMS editor screen when the user is
75 deleting or navigating
76
77 xrashmic 13 Sep, 2004 MMI-SPR-24744
78 Description: No indication of the EMS sent. Also after sending EMS, the option
79 screen is displayed.
80 Solution: Implemented the indication of EMS sent screen.
81
82 MMI-SPR-23926 (TII_MMS12) and MMI-SPR-24115 (TII_MMS55): Aug-17-2004 - xreddymn
83 Keep track of MMS/EMS display
84
85 CRR: 23942 - xpradipg 26 Aug 2004
86 Description: Default values to be removed in text editor of MMS and EMS
87 Solution: The buffer assigned to the text editor is reset.
88
89 CRR: 23942 - xpradipg 26 Aug 2004
90 Description: Default values to be removed in number editor of MMS and EMS
91 Solution: The strcpy() of the hardcoded numbers to the editor buffer are commented
92
93 Bug Id 23 : 16 Aug, 2004 - xpradipg
94 Description:Remove insert slide form options menu
95 Solution: removed the insert slide item from the menu item array
96
97 17/01/04 Replace mfw edit with AUI edit.
98 26/08/03 Original TI(Shanghai) BMI version.
99
100 $End
101
102 *******************************************************************************/
103 #define MMI_MMSCREATE_C
104
105 #define ENTITY_MFW
106
107 /* includes */
108 #include <string.h>
109 #include <stdio.h>
110 #include <stdlib.h>
111
112 #if defined (NEW_FRAME)
113
114 #include "typedefs.h"
115 #include "vsi.h"
116 #include "pei.h"
117 #include "custom.h"
118 #include "gsm.h"
119
120 #else
121
122 #include "STDDEFS.H"
123 #include "custom.h"
124 #include "gsm.h"
125 #include "vsi.h"
126
127 #endif
128 #include "prim.h"
129
130
131 #include "mfw_mfw.h"
132 #include "mfw_win.h"
133 #include "mfw_kbd.h"
134 //#include "mfw_edt.h"
135 #include "mfw_tim.h"
136 #include "mfw_phb.h"
137 #include "ksd.h"
138 #include "psa.h"
139 #include "mfw_sms.h"
140 #include "mfw_smsi.h"
141 #include "mfw_icn.h"
142 #include "mfw_mnu.h"
143 #include "mfw_lng.h"
144 #include "mfw_sat.h"
145 #include "mfw_kbd.h"
146 #include "mfw_nm.h"
147
148 #include "psa_util.h"
149
150 #include "dspl.h"
151 // #include "unicode_types.h"
152
153 #include "MmiMain.h"
154 #include "MmiDummy.h"
155 //#include "MmiLists.h"
156 #include "MmiMmi.h"
157 #include "mmiCall.h"//GW 29/11/01 for 'callNumber'
158
159 #include "MmiDialogs.h"
160 #include "MmiLists.h"
161 #include "MmiMenu.h"
162 #include "MmiSoftKeys.h"
163
164 #ifdef NEW_EDITOR
165 #include "ATBCommon.h"
166 #include "ATBDisplay.h"
167 #include "ATBEditor.h"
168 #include "AUIEditor.h"
169 #else /* NEW_EDITOR */
170 #ifdef EASY_TEXT_ENABLED
171 #include "MmiLatinPredText.h"
172 #endif /* EASY_TEXT_ENABLED */
173 #include "MmiEditor.h"
174 #endif /* NEW_EDITOR */
175
176 #include "MmiBookShared.h" // MZ
177 #include "mmimmsmenu.h"
178 #include "mmiemscreate.h" // pinghua modify
179 #include "mmimmscreate.h"
180 #include "mmimmsom.h"
181 #include "mmiwindow.h"
182 #include "mfw_ffs.h"
183
184 #include "cus_aci.h"
185
186 #include "prim.h"
187 #ifndef PCM_2_FFS
188 #include "pcm.h"
189 #endif
190
191
192 #include "aci_cmh.h" //GW 29/11/01 added for types in aci_fd.h
193 #include "aci_fd.h" //GW 29/11/01 added for types in 'cmh.h'
194 #include "cmh.h" //GW 29/11/01 added for types in 'cmh_phb.h'
195 #include "cmh_phb.h" //GW 29/11/01 added for cmhPHB_getAdrStr
196
197 #include "mmiColours.h"
198
199
200 // ronaldc 8-5
201
202 #include "mg4def.h"
203 #include "evtdefs.h"
204 #include "mg4stu.h"
205 #include "Mg4Dal.h"
206 #include "mg4devif.h"
207 #include "dalevt.h"
208 #include "evif.h"
209 #include "mg4str.h"
210 #include "mmif.h"
211 #include "mg4mem.h"
212
213 #include "AUIWapext.h"
214 #include "ATBData.h"
215 #include "dspl.h" // xrashmic 13 Sep, 2004 MMI-SPR-24744
216
217 // xreddymn Dec-16-2004 MMI-SPR-27384
218 #include "Mfw_td.h"
219
220 UCS2 ems_g_insertString[128] = {'t','e','s','t',0};
221 MSafeString ems_g_safeString;
222
223 UINT32 gEmsMsgId = MM_INVALID_MESSAGE_ID;
224
225 // xreddymn Dec-16-2004 MMI-SPR-27384
226 MM_S_MESSAGE_HEADER *EmsMsgHeader=NULL;
227 EVT_STRUCT g_EMS_event_struct;
228 extern T_MFW_TIME current_time;
229 extern T_MFW_DATE current_date;
230
231 //GW 29/11/01 - added header file - removed extern void callNumber(UBYTE* number);
232 MfwWin* getWinData( MfwHnd win);
233
234 extern void M4_DebugMessage(unsigned long para);
235
236 //xreddymn Aug-26-2004
237 extern UINT8 gucMmsTitleBarHeight;
238
239 //xreddymn Aug-27-2004 MMI-SPR-23926 (TII_MMS12) and MMI-SPR-24115 (TII_MMS55): To keep track of MMS display
240 extern BOOL g_M4_display_active;
241
242 //xreddymn Oct-14-2004 MMI-SPR-25273: Used to maintain the state when forwarding an EMS message
243 BOOL gEmsForward=FALSE;
244
245 //xreddymn Nov-26-2004
246 extern T_MFW_HND g_inSaveModeWin;
247 extern BOOL g_inSaveMode;
248 //xrashmic 08 Feb, 2005 MMI-SPR-27853
249 extern T_MFW_HND information_dialog(USHORT TxtId1, USHORT TxtId2,char* Txt1, char* Txt2, USHORT SoftKeyTxtId1, USHORT SoftKeyTxtId2, int timer, T_MFW_EVENT keyEvents, T_VOID_FUNC callback);
250
251
252
253
254 /*********************************************************************
255
256 DYNAMIC MENU WINDOW. DECLARATION
257
258 **********************************************************************/
259
260
261 static int EMSCreate_OPTexeSend(MfwMnu* m, MfwMnuItem* i);
262 //xrashmic 7 Dec, 2004 MMI-SPR-23965
263 static int EMSCreate_OPTexeInsPreDefPicture(MfwMnu* m, MfwMnuItem* i);
264 static int EMSCreate_OPTexeInsPicture(MfwMnu* m, MfwMnuItem* i);
265 static int EMSCreate_OPTexeInsPreDefSound(MfwMnu* m, MfwMnuItem* i);
266 static int EMSCreate_OPTexeInsSound(MfwMnu* m, MfwMnuItem* i);
267
268 static int EMSCreate_OPTexeInsText(MfwMnu* m, MfwMnuItem* i);
269 //static int MMSCreate_OPTexeInsSlide(MfwMnu* m, MfwMnuItem* i);
270 static int EMSCreate_OPTexeDelPicture(MfwMnu* m, MfwMnuItem* i);
271 static int EMSCreate_OPTexeDelSound(MfwMnu* m, MfwMnuItem* i);
272 static int EMSCreate_OPTexeDelText(MfwMnu* m, MfwMnuItem* i);
273 static int EMSCreate_OPTexeSave(MfwMnu* m, MfwMnuItem* i);
274
275 static MfwMnuItem EMSCreate_OPTDeleteItems [] =
276 {
277 {0,0,0,(char *)TxtMMSDeletePicture,0,(MenuFunc)EMSCreate_OPTexeDelPicture,item_flag_none},
278 {0,0,0,(char *)TxtMMSDeleteSound,0,(MenuFunc)EMSCreate_OPTexeDelSound,item_flag_none},
279 {0,0,0,(char *)TxtMMSDeleteText,0,(MenuFunc)EMSCreate_OPTexeDelText,item_flag_none}
280 };
281 static MfwMnuAttr MMSCreate_OPTDeleteAttrib =
282 {
283 &SmsRead_R_OPTArea,
284 MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */
285 -1, /* use default font */
286 EMSCreate_OPTDeleteItems, /* with these items */
287 sizeof(EMSCreate_OPTDeleteItems)/sizeof(MfwMnuItem), /* number of items */
288 COLOUR_LIST_SMS, TxtNull, MNUATTRSPARE
289 };
290
291 static MfwMnuItem EMSCreate_OPTItems [] =
292 {
293 {0,0,0,(char *)TxtSend,0,(MenuFunc)EMSCreate_OPTexeSend,item_flag_none},
294 {0,0,0,(char *)TxtMMSInsertPrePicture,0,(MenuFunc)EMSCreate_OPTexeInsPreDefPicture,item_flag_none},
295 {0,0,0,(char *)TxtMMSInsertPicture,0,(MenuFunc)EMSCreate_OPTexeInsPicture,item_flag_none},
296 {0,0,0,(char *)TxtMMSInsertPreSound,0,(MenuFunc)EMSCreate_OPTexeInsPreDefSound,item_flag_none},
297 {0,0,0,(char *)TxtMMSInsertSound,0,(MenuFunc)EMSCreate_OPTexeInsSound,item_flag_none},
298 {0,0,0,(char *)TxtMMSInsertText,0,(MenuFunc)EMSCreate_OPTexeInsText,item_flag_none},
299 //Bug Id 23 : 16 Aug, 2004 - xpradipg
300 //Description:Remove insert slide form options menu
301 // {0,0,0,(char *)TxtMMSInsertSlide,0,(MenuFunc)EMSCreate_OPTexeInsSlide,item_flag_none},
302 {0,0,0,(char *)TxtSave,0,(MenuFunc)EMSCreate_OPTexeSave,item_flag_none},
303 //CRR: 25329 - xpradipg 25 Oct 2004
304 // {0,0,0,(char *)TxtMMSDelete,&MMSCreate_OPTDeleteAttrib,0,item_flag_none},
305
306 //xrashmic 9 Dec, 2004 MMI-SPR-27385
307 //Removed the EMS preview option, since the editor itself acts as preview.
308 // {0,0,0,(char *)TxtMMSPreview,0,(MenuFunc)NULL,item_flag_none}
309 };
310
311 static MfwMnuAttr EMSCreate_OPTAttrib =
312 {
313 &SmsRead_R_OPTArea,
314 MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */
315 -1, /* use default font */
316 EMSCreate_OPTItems, /* with these items */
317 sizeof(EMSCreate_OPTItems)/sizeof(MfwMnuItem), /* number of items */
318 COLOUR_LIST_SMS, TxtNull, MNUATTRSPARE
319
320 };
321
322 /* 1. User selects 'Preview' from user menu (MMI) */
323 /* 2. MMI calls action_ResumeEditor() to resume the magic4 client and suspends the menu system */
324 void action_EMS_ResumeEditor()
325 {
326 /* resume magic4 editor */
327 DAL_PostMessage(EMG4_Resume,EMG4_Type_NotUsed,0,NULL);
328 /* if necessary, add code here to suspend display of the menu system */
329 }
330
331
332 /* 3. After action_ResumeEditor has been completed, MMI then calls action_PreviewMessage() to preview the message currently in the magic4 editor */
333
334
335
336 void action_EMS_SuspendEditor()
337 {
338 /* suspend magic4 editor */
339 DAL_PostMessage(EMG4_Suspend,EMG4_Type_NotUsed,0,NULL);
340 /* if necessary, add code here to resume display of the menu system */
341 }
342
343 /*******************************************************************************
344
345 $Function: set_MMS_current_time_stamp
346
347 $Description: Sets current time in the time stamp structure
348
349 $Returns: none
350
351 $Arguments: t - Time stamp to be updated by this function
352
353 $author : xreddymn
354
355 *******************************************************************************/
356
357 void set_MMS_current_time_stamp(MM_S_TIME_STAMP *t)
358 {
359 t->day=current_date.day;
360 t->month=current_date.month;
361 t->year=current_date.year;
362 t->hour=current_time.hour;
363 t->min=current_time.minute;
364 t->sec=current_time.second;
365 }
366
367 /*******************************************************************************
368
369 $Function: EMS_update_header_handler
370
371 $Description: Callback function for DAL_ModifyMessageParamsAsync
372
373 $Returns: none
374
375 $Arguments: As specified by M4
376
377 $author : xreddymn
378 Currently, this is a dummy function
379
380 *******************************************************************************/
381
382 ESTATUS EMS_update_header_handler(EVENT_ID aeId, EVENT_TYPE aeType, MESSAGE_PARAM ampParam, EVT_HANDLE EvtHandle)
383 {
384
385 }
386
387 EVT_STRUCT CreatEmsDocumentevtHandle;
388
389 ESTATUS Handler_EMS_CreateDocument(EVENT_ID aeId, EVENT_TYPE aeType, MESSAGE_PARAM ampParam, EVT_HANDLE evtHandle)
390 {
391 //xmzhou_trace_string_value("Handler_EMS_CreateDocument aeId = ", aeId);
392
393 switch(aeId)
394 {
395 case EMG4_FileOpDone:
396
397 //xmzhou_trace_string_value("gEmsMsgId = ampParam = ", ampParam);
398
399 gEmsMsgId = (UINT32)ampParam;
400
401 if(g_inSaveMode==TRUE)
402 {
403 g_inSaveMode=FALSE;
404 // xreddymn Nov-26-2004 MMI-SPR-25278
405 winDelete(g_inSaveModeWin);
406 //xrashmic 08 Feb, 2005 MMI-SPR-27853
407 //Added few more parameters for this function
408 information_dialog(TxtSaved,TxtNull, NULL,NULL,TxtNull,TxtSoftBack,FOREVER,KEY_CLEAR|KEY_RIGHT|KEY_HUP,NULL);
409 /* xreddymn Dec-15-2004 MMI-SPR-27384
410 * Update EMS message header with the current time stamp
411 */
412 {
413 ESTATUS eResult= DAL_RetrieveMessageHeader(gEmsMsgId,&EmsMsgHeader);
414 if(eResult==ENoError)
415 {
416 set_MMS_current_time_stamp(&EmsMsgHeader->timestamp);
417 g_EMS_event_struct.handler = EMS_update_header_handler;
418 g_EMS_event_struct.parentEvtHandle = NULL;
419 g_EMS_event_struct.pData = NULL;
420 g_EMS_event_struct.userFlag = 0;
421 DAL_ModifyMessageParamsAsync((EVT_HANDLE)&g_EMS_event_struct,gEmsMsgId,EmsMsgHeader);
422 }
423 }
424 }
425 break;
426
427 // xrashmic Nov-17-2004: Changes for FFS error handling
428 case EMG4_OpError:
429 {
430 MDword reason;
431 reason = (ampParam & 0x3FFF);
432 // xreddymn Nov-27-2004 MMI-SPR-25278
433 switch(reason)
434 {
435 case EFileOpFailed:
436 winDelete(g_inSaveModeWin);
437 //xrashmic 08 Feb, 2005 MMI-SPR-27853
438 //Added few more parameters for this function
439 information_dialog(TxtFailed,TxtFatalError,NULL,NULL, TxtNull,TxtSoftBack,FOREVER,KEY_CLEAR|KEY_RIGHT|KEY_HUP,NULL);
440 break;
441 }
442 }
443 break;
444 }
445
446 return ENoError;
447 }
448
449 /*******************************************************************************
450
451 $Function: EMSCreate_exec_cb
452
453 $Description: Exec callback function of the MMS Create window
454
455 $Returns: none
456
457 $Arguments: win - window handler
458 event - mfw event
459 parameter - optional data.
460 $author : pinghua for EMS modify !!
461
462 *******************************************************************************/
463 void EMSCreate_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
464 /* callback handler for events sent to to trigger execution */
465 {
466 ESTATUS eStatus;
467 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
468
469 TRACE_FUNCTION ("EMSCreate_exec_cb()");
470
471 //xmzhou_trace_string_value("EMSCreate_exec_cb called", event);
472
473 switch (event)
474 {
475 case MWM_CREATE:
476 /* initialization of administrative data */
477 TRACE_EVENT("MWM_CREATE");
478
479 // xreddymn Oct-14-2004 MMI-SPR-25273: Open an existing EMS message to forward
480 if(gEmsForward==TRUE)
481 {
482 CreatEmsDocumentevtHandle.handler = Handler_EMS_CreateDocument;
483 CreatEmsDocumentevtHandle.parentEvtHandle = NULL;
484 CreatEmsDocumentevtHandle.pData = NULL;
485 CreatEmsDocumentevtHandle.userFlag = 0;
486
487 eStatus = EV_OpenDocument((EVT_HANDLE) &CreatEmsDocumentevtHandle, (MM_MESSAGE_ID) gEmsMsgId, (MM_MESSAGE_ID) MM_INVALID_MESSAGE_ID);
488 DAL_PostMessage(EMG4_Edit,EMG4_Type_NotUsed,0,NULL);
489 }
490 else
491 {
492 //Creat a document for one EMS
493 CreatEmsDocumentevtHandle.handler = Handler_EMS_CreateDocument;
494 CreatEmsDocumentevtHandle.parentEvtHandle = NULL;
495 CreatEmsDocumentevtHandle.pData = NULL;
496 CreatEmsDocumentevtHandle.userFlag = 0;
497
498 eStatus = EV_CreateDocument((EVT_HANDLE) &CreatEmsDocumentevtHandle, EMtSms, (MM_MESSAGE_ID) MM_INVALID_MESSAGE_ID);
499 if (eStatus!=ENoError)
500 {
501 //xmzhou_trace_string_value("EMSCreate_exec_cb EV_CreateDocument return error num = ", eStatus);
502 }
503 else
504 {
505 //xmzhou_trace_string("EMSCreate_exec_cb EV_CreateDocument return ENoError");
506 gEmsMsgId = MM_INVALID_MESSAGE_ID;
507 }
508 }
509 //xreddymn Aug-27-2004 MMI-SPR-23926 (TII_MMS12) and MMI-SPR-24115 (TII_MMS55): M4 client will now use the display
510 g_M4_display_active=TRUE;
511 break;
512
513 case MWM_ONDRAW:
514 TRACE_EVENT("MWM_ONDRAW");
515 dspl_Enable(0);
516 #if(0)
517 dspl_ClearAll();
518 dspl_TextOut(32, 0, DSPL_TXTATTR_HLIGHT,"Create EMS");
519 #else
520 // xreddymn Aug-26-2004: Modified Title display
521 {
522 unsigned short width, height;
523 DeviceGetScreenMetrics(&width,&height);
524 dspl_SetBgdColour(COL_White);
525 dspl_Clear(0, gucMmsTitleBarHeight, width-1, gucMmsTitleBarHeight+height-1);
526 resources_setTitleColour(COLOUR_EDITOR);
527 dspl_Clear(0, 0, width-1, gucMmsTitleBarHeight-1);
528 dspl_TextOut(1, 0, DSPL_TXTATTR_HLIGHT,"Create EMS");
529 }
530 #endif
531 //xmzhou_trace_string("action_EMS_ResumeEditor in EMSCreate_exec_cb called");
532 action_EMS_ResumeEditor();
533 displaySoftKeys(TxtSoftOptions,TxtDelete);
534 dspl_Enable(1);
535 break;
536
537 // xreddymn Aug-09-2004
538 case MWM_SUSPEND:
539 TRACE_EVENT("MWM_SUSPEND");
540 //xreddymn Sep-16-2004 MMI-SPR-24735
541 dspl_Enable(1);
542 //xreddymn Aug-27-2004 MMI-SPR-23926 (TII_MMS12) and MMI-SPR-24115 (TII_MMS55): BMI will now use the display
543 g_M4_display_active=FALSE;
544 action_EMS_SuspendEditor();
545 break;
546
547 // xreddymn Aug-27-2004
548 case MWM_RESUME:
549 TRACE_EVENT("MWM_RESUME");
550 //xreddymn Aug-27-2004 MMI-SPR-23926 (TII_MMS12) and MMI-SPR-24115 (TII_MMS55): M4 client will now use the display
551 g_M4_display_active=TRUE;
552 //xreddymn Sep-16-2004 MMI-SPR-24735: Removed editor resume and refresh
553 //action_EMS_ResumeEditor();
554 //DAL_PostMessage(EMG4_Refresh, EMG4_Type_NotUsed, 0, 0);
555 break;
556
557 case MWM_DESTORY:
558 TRACE_EVENT("MWM_DESTROY");
559 //xreddymn Sep-16-2004: Changes related to MMI-SPR-24735
560 dspl_Enable(1);
561 //xmzhou_trace_string("EMSCreate_exec_cb EMG4_Exit be posted");
562 DAL_PostMessage(EMG4_Exit, EMG4_Type_NotUsed, 0, 0);
563 //xreddymn Aug-27-2004 MMI-SPR-23926 (TII_MMS12) and MMI-SPR-24115 (TII_MMS55): BMI will now use the display
564 g_M4_display_active=FALSE;
565 break;
566 default:
567 break;
568 }
569 }
570
571
572
573
574 /*******************************************************************************
575
576 $Function: MMSCreate_kbd_cb
577
578 $Description: Exec callback function for the Option window
579
580 $Returns: execution status
581
582 $Arguments: e - event id
583 k - keyboard info
584 $Author : pignhua add these code for EMS ()
585 *******************************************************************************/
586
587 static int EMSCreate_kbd_cb (MfwEvt e, MfwKbd *k)
588 /* SmsRead_R_OPT keyboard event handler */
589 {
590 T_MFW_HND win = mfwParent(mfw_header());
591
592
593 TRACE_FUNCTION ("MMSCreate_kbd_cb()");
594 //xreddymn Sep-16-2004 MMI-SPR-24735: Reduce screen flickering in EMS editor when user presses keys
595 dspl_Enable(0);
596 if (e & KEY_LONG)
597 {
598 switch (k->code)
599 {
600 case KCD_HUP: /* back to previous menu */
601 MMI_DestoryWindow(win);
602 break;
603 case KCD_RIGHT: /* delete one */
604 DAL_PostMessage(EMG4_BackSpace, EMG4_Type_NotUsed, 0, NULL);
605 break ;
606 case KCD_MNUUP:
607 DAL_PostMessage(EVT_StartOfMessage, EMG4_Type_NotUsed, 0, NULL);
608 break;
609 case KCD_MNUDOWN:
610 DAL_PostMessage(EVT_EndOfMessage, EMG4_Type_NotUsed, 0, NULL);
611 break;
612 case KCD_MNULEFT:
613 DAL_PostMessage(EVT_StartOfLine, EMG4_Type_NotUsed, 0, NULL);
614 break;
615 case KCD_MNURIGHT:
616 DAL_PostMessage(EVT_EndOfLine, EMG4_Type_NotUsed, 0, NULL);
617 break;
618 default: /* no response to all other keys */
619 return MFW_EVENT_CONSUMED;
620 }
621 }
622 else
623 {
624 switch (k->code)
625 {
626 case KCD_MNUSELECT:
627 case KCD_LEFT:
628 EMSCreate_OPT_start(win,0);
629 break;
630 case KCD_HUP: /* back to previous menu */
631 MMI_DestoryWindow(win);
632 break;
633 case KCD_RIGHT: /* delete one */
634 DAL_PostMessage(EMG4_BackSpace, EMG4_Type_NotUsed, 0, NULL);
635 break ;
636 case KCD_MNUUP:
637 DAL_PostMessage(EVT_CursorUp, EMG4_Type_NotUsed, 0, NULL);
638 break;
639 case KCD_MNUDOWN:
640 DAL_PostMessage(EVT_CursorDown, EMG4_Type_NotUsed, 0, NULL);
641 break;
642 case KCD_MNULEFT:
643 DAL_PostMessage(EMG4_CursorLeft, EMG4_Type_NotUsed, 0, NULL);
644 break;
645 case KCD_MNURIGHT:
646 DAL_PostMessage(EMG4_CursorRight, EMG4_Type_NotUsed, 0, NULL);
647 break;
648 default: /* no response to all other keys */
649 return MFW_EVENT_CONSUMED;
650 }
651 }
652 return MFW_EVENT_CONSUMED;
653 }
654
655
656 /*******************************************************************************
657
658 $Function: MMSCreate_start
659
660 $Description: Start the creation of the main window for Create MMS
661
662 $Returns: mfw window handler
663
664 $Arguments: parent_window - Parent window handler
665 menuAttr - Menu attributes.
666
667 *******************************************************************************/
668 T_MFW_HND EMSCreate_start(T_MFW_HND parent_window, MfwMnuAttr *menuAttr)
669 {
670 TRACE_FUNCTION ("MMSCreate_start()");
671 return MMI_CreateWindow(parent_window, (T_DIALOG_FUNC) EMSCreate_exec_cb, (void*)menuAttr,(MfwCb)EMSCreate_kbd_cb, 0,0);
672 }
673
674
675 #define MMS_SEND_SUBJUCT_NUMBER
676
677 static T_MFW_HND editor=NULL;
678 //CRR: 25302 - xpradipg 10 Nov 2004
679 //Global to hold the number editor handle
680 static T_MFW_HND number_edit=NULL;
681 static char text[MAX_EMS_TEXT_LEN];
682 char EmsNumber[MAX_PHB_NUM_LEN];
683 static char topic[MAX_EMS_TOPIC_LEN]="\0";
684
685
686 void Free_MMISafeString(void * paData)
687 {
688 MSafeString *pSafeString = (MSafeString *)paData;
689 if (pSafeString!= NULL)
690 {
691 mfwFree((U8 *)(pSafeString->pString), pSafeString->size);
692 pSafeString->pString = NULL;
693 }
694 }
695
696
697 UINT32 EMS_CaculateByteSize(MDword rawDataSize, MM_E_SMS_ENCODING encoding)
698 {
699 UINT32 ulBitLength;
700 UINT32 ulByteSize;
701
702 switch (encoding)
703 {
704 case EEncodingGSM7Bit:
705 case EEncoding7BitASCII:
706 {
707 ulBitLength = rawDataSize * 7;
708
709 if ((ulBitLength & 0x07) == 0)
710 {
711 ulByteSize = ulBitLength/8;
712 }
713 else
714 {
715 ulByteSize = ulBitLength/8 + 1;
716 }
717 break;
718 }
719 case EEncoding8BitASCII:
720 case EEncodingGSM8Bit:
721 {
722 ulByteSize = rawDataSize;
723 break;
724 }
725
726 case EEncodingUCS2:
727 case EEncodingUNICODE:
728 {
729 ulByteSize = rawDataSize;
730 break;
731 }
732 default:
733 {
734 //xmzhou_trace_string_value("EMS_CaculateByteSize error case encoding = ", encoding);
735 ulByteSize = 0;
736 break;
737 }
738 }/* end switch (encoding) */
739
740 return ulByteSize;
741 }/* end of EMS_CaculateByteSize */
742
743 LOCAL MM_S_MESSAGE *EmsMesg;
744 LOCAL UINT16 ulSendIndex;
745
746 //number
747 LOCAL void ems_submit_error_proc (T_ACI_AT_CMD cmdId, T_ACI_CMS_ERR err,
748 T_EXT_CMS_ERROR *ce)
749 {
750 //CRR: 24741 - xpradipg 17 Sept 2004
751 //The error message is displayed
752 T_MFW_HND win = mfwParent(mfw_header());
753 T_DISPLAY_DATA displayInfo;
754
755 TRACE_FUNCTION("ems_submit_error_proc called");
756 dlg_initDisplayData_TextStr(&displayInfo, TxtSoftOK,TxtNull, "EMS Send", "Failed", COLOUR_STATUS);
757 dlg_initDisplayData_events(&displayInfo, (T_VOID_FUNC)NULL, FOREVER, KEY_LEFT |KEY_HUP);
758 info_dialog(win,&displayInfo);
759 EmsMesg->memHdr.freeFunc(EmsMesg);
760 }
761
762
763 void ems_prepare8bitBufferforACIfrom7bit(MByte* textBuffer, UBYTE NumTxt, UBYTE OriginalOffest, UBYTE* SmsTextOut)
764 {
765 UBYTE ByteOne;
766 U16 ByteTwo;
767 U16 ulConcated2Bytes;
768 UBYTE TextBufferOffset = 0;
769 UBYTE ByteOffset = 0;
770 UBYTE BitOffset;
771 UINT16 i;
772
773 if ((textBuffer == NULL) || (SmsTextOut == NULL))
774 {
775 return;
776 }
777
778 BitOffset = OriginalOffest;
779
780 for (i = 0; i < NumTxt; i++)
781 {
782 ByteOne = textBuffer[TextBufferOffset];
783 ByteTwo = textBuffer[TextBufferOffset + 1];
784
785 ulConcated2Bytes = ByteOne;
786 ulConcated2Bytes = ulConcated2Bytes | ((ByteTwo <<8) & 0xFF00);
787
788 SmsTextOut[ByteOffset] = 0;
789
790 if (BitOffset == 0)
791 {
792 SmsTextOut[ByteOffset] = 0x7f & ByteOne;
793 BitOffset = 7;
794 //TextBufferOffset = TextBufferOffset;//do not change
795 }
796 else if (BitOffset == 1)
797 {
798 SmsTextOut[ByteOffset] = 0x7f & (ByteOne >> BitOffset);
799 BitOffset = 0;
800 TextBufferOffset++;
801 }
802 else
803 {
804 SmsTextOut[ByteOffset] = (UBYTE)(0x7f & (ulConcated2Bytes >> BitOffset));
805 BitOffset --;
806 TextBufferOffset++;
807 }
808
809 ByteOffset++;
810 }/* end of for */
811
812 return;
813 }
814 void ems_submit(UBYTE mr, UBYTE numSeg)
815 {
816 T_ACI_TOA toa;
817 T_ACI_TOA tosca;
818 SHORT rp;
819
820 T_ACI_UDH_DATA udh;
821 T_ACI_SM_DATA tar_data;
822
823 T_MFW_SMS_INFO sms_parameter;
824
825 MByte * rawData;
826 MDword rawDataSize;
827 UINT32 BytesSize;
828 UINT32 ulTextByteLengh;
829 MM_E_SMS_ENCODING M4Encoding;
830
831 T_ACI_RETURN AciReturn;
832
833 UBYTE OriginalOffest;
834
835 //xmzhou_trace_string_value("ems_submit called ulSendIndex = ", ulSendIndex);
836 TRACE_FUNCTION("ems_submit called");
837
838 if (ulSendIndex >= EmsMesg->pBody->numMessageParts)
839 {
840 /* xreddymn Dec-15-2004 MMI-SPR-27384
841 * Update EMS message header with the current time stamp and Destination Address
842 */
843 {
844 ESTATUS eResult= DAL_RetrieveMessageHeader(gEmsMsgId,&EmsMsgHeader);
845 if(eResult==ENoError)
846 {
847 UCS2 temp_string[128];
848 //CRR: 25291 - xrashmic 14 Oct 2004
849 //Once the EMS is sent successfully, move this EMS into Sent folder.
850 EmsMsgHeader->location=EMlSent;
851 MMS_Convert8BitStringToUcs2((MByte*)EmsNumber,strlen(EmsNumber),(UCS2*)temp_string);
852 EmsMsgHeader->messageTypeHeader.smsHeader.pszAddress=temp_string;
853 set_MMS_current_time_stamp(&EmsMsgHeader->timestamp);
854 g_EMS_event_struct.handler = EMS_update_header_handler;
855 g_EMS_event_struct.parentEvtHandle = NULL;
856 g_EMS_event_struct.pData = NULL;
857 g_EMS_event_struct.userFlag = 0;
858 DAL_ModifyMessageParamsAsync((EVT_HANDLE)&g_EMS_event_struct,gEmsMsgId,EmsMsgHeader);
859 }
860 }
861 //xmzhou_trace_string("EMS post success!");
862 //xrashmic 13 Sep, 2004 MMI-SPR-24744
863 //Displaying a dialog after all the parts of EMS are sent.
864 ems_dialog(TxtEMS,TxtSent,NULL,TxtSoftBack,FOREVER);
865 EmsMesg->memHdr.freeFunc(EmsMesg);
866 return;
867 }
868
869 rp = -1; /* reply path = default *//*for MFW_SMS_SUBMIT*/
870
871 toa.ton = phb_ncvtTon(NULL);
872 toa.npi = NPI_IsdnTelephony;
873 tosca.ton = phb_ncvtTon(NULL);
874 tosca.npi = NPI_IsdnTelephony;
875
876 SmsSend_get_config_data(&sms_parameter);
877
878 if ((EmsMesg->pHeader->messageTypeHeader.smsHeader.encoding == EEncodingGSM7Bit) ||
879 (EmsMesg->pHeader->messageTypeHeader.smsHeader.encoding == EEncoding7BitASCII))
880 {
881 sms_parameter.dcs = MFW_DCS_7bits;
882
883 }
884 else if ((EmsMesg->pHeader->messageTypeHeader.smsHeader.encoding == EEncodingUCS2) ||
885 (EmsMesg->pHeader->messageTypeHeader.smsHeader.encoding == EEncodingUNICODE))
886 {
887 sms_parameter.dcs = MFW_DCS_UCS2;
888 }
889 else if ((EmsMesg->pHeader->messageTypeHeader.smsHeader.encoding == EEncoding8BitASCII) ||
890 (EmsMesg->pHeader->messageTypeHeader.smsHeader.encoding == EEncodingGSM8Bit))
891 {
892 sms_parameter.dcs = MFW_DCS_8bits;
893 }
894 else
895 {
896 //xmzhou_trace_string_value("EMS_RetriveSendMsg error encoding = ",
897 // EmsMesg->pHeader->messageTypeHeader.smsHeader.encoding);
898 return;
899 }
900
901 rawData = EmsMesg->pBody->ppMessageParts[ulSendIndex]->pData;
902 rawDataSize = EmsMesg->pBody->ppMessageParts[ulSendIndex]->size;
903 M4Encoding = EmsMesg->pHeader->messageTypeHeader.smsHeader.encoding;
904 BytesSize = EMS_CaculateByteSize(rawDataSize, M4Encoding);
905
906 if ( EmsMesg->pBody->ppMessageParts[ulSendIndex]->xData == 0x40 ) //EMS
907 {
908 //xmzhou_trace_string_value("Call Send EMS, rawDataSize = ", rawDataSize);
909 //xmzhou_trace_n_bytes((char *) rawData, (UINT32) rawDataSize);
910
911 udh.len = rawData[0];
912 memcpy(udh.data, &rawData[1], udh.len);
913
914 //tar_data.len = BytesSize - udh.len - 1;
915 ulTextByteLengh = BytesSize - udh.len - 1;
916
917 if ((M4Encoding == EEncodingGSM7Bit) ||(M4Encoding == EEncoding7BitASCII))
918 {
919 tar_data.len = rawDataSize - (((udh.len + 1)*8 + 6) / 7);
920 OriginalOffest = (rawDataSize-tar_data.len) * 7 -(udh.len + 1) * 8; //filing bit of sms
921
922 //tar_data.data will be fit with 8bit buffer for ACI
923 ems_prepare8bitBufferforACIfrom7bit(&rawData[udh.len+1], tar_data.len, OriginalOffest, tar_data.data);
924 }
925 else if ((M4Encoding == EEncodingUCS2) ||(M4Encoding == EEncodingUNICODE))
926 {
927 memcpy(tar_data.data, &rawData[udh.len+1], ulTextByteLengh);
928
929 tar_data.data[ulTextByteLengh] = 0x00;
930 tar_data.data[ulTextByteLengh + 1] = 0x00;
931 tar_data.len = ulTextByteLengh + 2;
932 }
933 else
934 {
935 memcpy(tar_data.data, &rawData[udh.len+1], ulTextByteLengh);
936 tar_data.len = ulTextByteLengh;
937 }
938
939
940 AciReturn = sAT_PlusCMGS_Gl(CMD_SRC_LCL, EmsNumber, NULL, &tar_data, &udh, sms_parameter.sc_addr, NULL, rp, ems_submit, ems_submit_error_proc);
941 //AciReturn = sAT_PlusCMGS_Gl(CMD_SRC_LCL, EmsNumber, NULL, &tar_data, NULL, sms_parameter.sc_addr, NULL, rp, ems_submit, ems_submit_error_proc);
942 if (AciReturn NEQ AT_EXCT)
943 {
944 //xmzhou_trace_string("ems_submit sAT_PlusCMGS_Gl fail!");
945 }
946 }
947 else//SMS
948 {
949 tar_data.len = rawDataSize;
950
951 if ((M4Encoding == EEncodingGSM7Bit) ||(M4Encoding == EEncoding7BitASCII))
952 {
953 tar_data.len = rawDataSize;
954 OriginalOffest = 0; //filing bit of sms is 0 for text only
955
956 //tar_data.data will be fit with 8bit buffer for ACI
957 ems_prepare8bitBufferforACIfrom7bit(rawData, tar_data.len, OriginalOffest, tar_data.data);
958 }
959 else
960 {
961 memcpy(tar_data.data, rawData, ulTextByteLengh);
962 tar_data.len = rawDataSize;
963 }
964
965 AciReturn = sAT_PlusCMGS_Gl(CMD_SRC_LCL, EmsNumber,NULL, &tar_data, NULL, sms_parameter.sc_addr, NULL, rp, ems_submit, ems_submit_error_proc);
966 if (AciReturn NEQ AT_EXCT)
967 {
968 //xmzhou_trace_string("ems_submit sAT_PlusCMGS_Gl for sms fail!");
969 }
970 }
971
972 ulSendIndex++;
973
974 return ;
975 }/* end of ems_submit */
976
977
978 void EMS_RetriveSendMsg(UINT32 MsgId)
979 {
980 T_MFW_SMS_INFO sms_parameter;
981 ESTATUS estatus;
982 UBYTE mr;
983 UBYTE numSeg;
984
985 estatus = DAL_RetrieveMessageComplete(&EmsMesg, MsgId);
986
987 if ( estatus != ENoError )
988 {
989 //xmzhou_trace_string("EMS_RetriveSendMsg estatus != ENoError then return");
990 return;
991 }
992
993 if (EmsMesg->pBody->numMessageParts > 255)
994 {
995 //xmzhou_trace_string("EMS_RetriveSendMsg numMessageParts > 255 then return");
996 return;
997 }
998 ulSendIndex = 0;
999
1000 SmsSend_get_config_data(&sms_parameter);
1001
1002 if ((EmsMesg->pHeader->messageTypeHeader.smsHeader.encoding == EEncodingGSM7Bit) ||
1003 (EmsMesg->pHeader->messageTypeHeader.smsHeader.encoding == EEncoding7BitASCII))
1004 {
1005 sms_parameter.dcs = MFW_DCS_7bits;
1006 }
1007 else if ((EmsMesg->pHeader->messageTypeHeader.smsHeader.encoding == EEncodingUCS2) ||
1008 (EmsMesg->pHeader->messageTypeHeader.smsHeader.encoding == EEncodingUNICODE))
1009 {
1010 sms_parameter.dcs = MFW_DCS_UCS2;
1011 }
1012 else if ((EmsMesg->pHeader->messageTypeHeader.smsHeader.encoding == EEncoding8BitASCII) ||
1013 (EmsMesg->pHeader->messageTypeHeader.smsHeader.encoding == EEncodingGSM8Bit))
1014 {
1015 sms_parameter.dcs = MFW_DCS_8bits;
1016 }
1017 else
1018 {
1019 //xmzhou_trace_string_value("EMS_RetriveSendMsg error encoding = ",
1020 // EmsMesg->pHeader->messageTypeHeader.smsHeader.encoding);
1021 return;
1022 }
1023 SmsSend_set_dcs_number (&sms_parameter);
1024
1025 ems_submit(mr, numSeg);
1026
1027 return;
1028 }
1029 //CRR: 25302 - xpradipg 10 Nov 2004
1030 /*******************************************************************************
1031
1032 $Function: EmsSend_PHBK_exec_cb
1033
1034 $Description: Populates the text structure with the phone Number and sends
1035 an event to update the editor buffer
1036
1037 $Returns:
1038
1039 $Arguments:
1040 *******************************************************************************/
1041 void EmsSend_PHBK_exec_cb(T_MFW_HND win, USHORT event, void *parameter)
1042 {
1043 #ifdef NEW_EDITOR
1044 T_ATB_TEXT text; /* Used to insert phone numbers into editors */
1045 #endif
1046
1047 TRACE_FUNCTION ("EmsSend_PHBK_exec_cb()");
1048
1049 switch (event)
1050 {
1051 /* SPR#1428 - SH - New Editor changes. Insert phone number into editor */
1052 #ifdef NEW_EDITOR
1053 case MMS_EMS_PHBK_NUMBER: /* Service centre number */
1054 text.dcs = ATB_DCS_ASCII;
1055 text.len = strlen((char *)parameter);
1056 text.data = (UBYTE *)parameter;
1057 SEND_EVENT(number_edit, E_ED_INSERT, 0, (void *)&text);
1058 break;
1059 #endif /* NEW_EDITOR */
1060 break;
1061 default:
1062 TRACE_EVENT("Err: Default");
1063 break;
1064 }
1065 }
1066
1067
1068
1069 static void EMSCreate_SEND_edit_cb( T_MFW_HND win, USHORT Identifier,UBYTE reason)
1070 {
1071 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
1072 T_DISPLAY_DATA display_info;
1073 char temp[100];
1074 T_MFW_HND parent_win, parent_parent_win;// xrashmic 13 Sep, 2004 MMI-SPR-24744
1075
1076 TRACE_EVENT_P1("EMSCreate_SEND_edit_cb() %d", Identifier);
1077
1078
1079 switch (reason)
1080 {
1081 case INFO_KCD_LEFT: // confirm (press LEFT soft key)
1082 if (Identifier==E_MODE_TOPIC)
1083 {
1084 // subject input
1085 TRACE_EVENT_P1("topic: %s",topic);
1086 SEND_EVENT(win,E_MODE_NUMBER, 0, 0);
1087 // wait for getting number (below) and do it all together.
1088 }
1089 else if (Identifier==E_MODE_NUMBER)
1090 {
1091 // phone number input
1092 TRACE_EVENT_P2("topic: %s, number: %s",topic,EmsNumber);
1093
1094 //After phone number OK, retrive and send EMS
1095 if (gEmsMsgId != MM_INVALID_MESSAGE_ID)
1096 {
1097 EMS_RetriveSendMsg(gEmsMsgId);
1098 //xmzhou_trace_string("EMS_RetriveSendMsg return");
1099 }
1100 else
1101 {
1102 //xmzhou_trace_string("EMSCreate_SEND_edit_cb MM_INVALID_MESSAGE_ID error!!!");
1103 }
1104 // xrashmic 13 Sep, 2004 MMI-SPR-24744
1105 // Geting the Options and the Message preview screen.
1106 parent_win= MMI_ParentWindow(win);
1107 parent_parent_win= MMI_ParentWindow(parent_win);
1108
1109 MMI_DestoryWindow(win); //This deletes the number entry screen
1110
1111 // xrashmic 13 Sep, 2004 MMI-SPR-24744
1112 // Deleting the Options and the Message preview screens.
1113 MMI_DestoryWindow(parent_win);
1114 MMI_DestoryWindow(parent_parent_win);
1115 //CRR: 25302 - xpradipg 10 Nov 2004
1116 //the number editor needs to be destroyed explicitly
1117 AUI_edit_Destroy(number_edit);
1118 }
1119 else
1120 {
1121 TRACE_EVENT_P1("text: %s",text);
1122 ems_g_safeString.size=2*(strlen(text)+1);
1123 //ems_g_safeString.memHeader.freeFunc = DummyFreeFunc;
1124 ems_g_safeString.memHeader.freeFunc = Free_MMISafeString;
1125
1126 MMS_ConvertStringToUcs2((const MByte *)(text),
1127 strlen(text),
1128 ems_g_insertString);
1129 ems_g_safeString.pString = ems_g_insertString;
1130 DAL_PostMessage(EMG4_InsertString, EMG4_Type_NotUsed, (MESSAGE_PARAM)&ems_g_safeString, 0);
1131
1132 MMI_DestoryWindow(win);
1133 }
1134 break;
1135 //CRR: 25302 - xpradipg 10 Nov 2004
1136 //the alternate left softkey event is handled for the number entry screen
1137 case INFO_KCD_ALTERNATELEFT:
1138 bookPhonebookStart(win, PhbkFromMms);
1139 break;
1140 case INFO_KCD_RIGHT:
1141 case INFO_KCD_HUP:
1142 //CRR: 25302 - xpradipg 10 Nov 2004
1143 //the number editor needs to be destroyed explicitly
1144 AUI_edit_Destroy(number_edit);
1145 MMI_DestoryWindow(win);
1146 break;
1147 default:
1148 TRACE_EVENT("Err: Default");
1149 break;
1150 }
1151 }
1152
1153
1154 /*******************************************************************************
1155
1156 $Function: EMSCreate_SEND_exec_cb
1157
1158 $Description: Callback handler for events sent by the window itself
1159
1160 $Returns: none
1161
1162 $Arguments: win - current window
1163 event - event id
1164 parameter - optional data.
1165 *******************************************************************************/
1166 //CRR: 25302 - xpradipg 10 Nov 2004
1167 //added new parameter Identifier - optional - but helps decode the data
1168 static void EMSCreate_SEND_exec_cb(T_MFW_HND win, USHORT event, USHORT Identifier,void *parameter)
1169 {
1170 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
1171 T_AUI_EDITOR_DATA editor_data;
1172
1173 TRACE_FUNCTION ("EMSCreate_SEND_exec_cb()");
1174 //xmzhou_trace_string_value("EMSCreate_SEND_exec_cb called", event);
1175
1176 switch (event)
1177 {
1178 case MWM_CREATE:
1179 break;
1180 case E_MODE_TOPIC:
1181
1182 AUI_edit_SetDefault(&editor_data);
1183 AUI_edit_SetDisplay(&editor_data, ZONE_FULL_SK_TITLE_SCROLL, COLOUR_EDITOR, EDITOR_FONT);
1184 AUI_edit_SetEvents(&editor_data, E_MODE_TOPIC, TRUE, FOREVER, (T_AUI_EDIT_CB)EMSCreate_SEND_edit_cb);
1185 AUI_edit_SetTextStr(&editor_data, TxtSoftOK, TxtDelete, TxtTopics, NULL);
1186 AUI_edit_SetAltTextStr(&editor_data, 0, NULL, TRUE, TxtSoftBack);
1187 AUI_edit_SetMode(&editor_data,ED_MODE_ALPHA, ED_CURSOR_UNDERLINE);
1188 //void AUI_edit_SetBuffer(T_AUI_EDITOR_DATA *editor_data, UBYTE dcs, UBYTE *text, USHORT size)
1189 //void AUI_edit_SetBuffer(T_AUI_EDITOR_DATA *editor_data, UBYTE dcs, UBYTE *text, USHORT size);
1190 AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII,(UBYTE*) topic, sizeof(topic));
1191 editor = AUI_edit_Start(win, &editor_data);
1192
1193
1194 break;
1195 case E_MODE_NUMBER:
1196 TRACE_EVENT("enter number");
1197 //CRR: 23942 - xpradipg 26 Aug 2004
1198 //comment the hardcoded string. This will display an empty number editor.
1199 //strcpy(EmsNumber,"01792910943");//"13816687053");//13801639314//01792910943
1200 //CRR: 25302 - xpradipg 10 Nov 2004
1201 //the changes are made to hold the alternate softkey and functionality
1202 //for the same
1203 AUI_edit_SetDefault(&editor_data);
1204 AUI_edit_SetDisplay(&editor_data, PHNO_EDITOR, COLOUR_EDITOR_XX, EDITOR_FONT);
1205 AUI_edit_SetEvents(&editor_data, E_MODE_NUMBER, FALSE, FOREVER, (T_AUI_EDIT_CB)EMSCreate_SEND_edit_cb);
1206 AUI_edit_SetTextStr(&editor_data, TxtSend, TxtDelete, TxtSmsEnterNumber, NULL);
1207 AUI_edit_SetAltTextStr(&editor_data, 1, TxtNames, TRUE, TxtSoftBack);
1208 //AUI_edit_SetMode(&editor_data,ED_MODE_ALPHA, ED_CURSOR_UNDERLINE);
1209 AUI_edit_SetMode(&editor_data,0, ED_CURSOR_UNDERLINE);
1210 memset(EmsNumber,'\0',sizeof(EmsNumber));
1211 AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, (UBYTE*)EmsNumber, sizeof(EmsNumber));
1212 number_edit = AUI_edit_Start(win, &editor_data);
1213
1214 #if 0
1215 AUI_edit_SetDefault(&editor_data);
1216 AUI_edit_SetDisplay(&editor_data, PHNO_EDITOR, COLOUR_EDITOR_XX, EDITOR_FONT);
1217 AUI_edit_SetEvents(&editor_data, SMSSEND_ID_NBEDIT, FALSE, FOREVER, (T_AUI_EDIT_CB)SmsSend_NBEDIT_edit_cb);
1218 AUI_edit_SetTextStr(&editor_data, TxtSend, TxtDelete, TxtSmsEnterNumber, NULL);
1219 AUI_edit_SetAltTextStr(&editor_data, 1, TxtNames, TRUE, TxtSoftBack);
1220 AUI_edit_SetMode(&editor_data, 0, ED_CURSOR_UNDERLINE);
1221 AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, parent_data->edt_data.NumberBuffer, PHB_MAX_LEN);
1222 parent_data->number_editor = AUI_edit_Start(parent_data->win, &editor_data);
1223
1224 #endif
1225 break;
1226 case E_MODE_TEXT:
1227 TRACE_EVENT("enter text");
1228 AUI_edit_SetDefault(&editor_data);
1229 AUI_edit_SetDisplay(&editor_data, ZONE_FULL_SK_TITLE_SCROLL, COLOUR_EDITOR, EDITOR_FONT);
1230 AUI_edit_SetEvents(&editor_data, E_MODE_TEXT, TRUE, FOREVER, (T_AUI_EDIT_CB)EMSCreate_SEND_edit_cb);
1231 AUI_edit_SetTextStr(&editor_data, TxtSoftOK, TxtDelete, TxtMessage, NULL);
1232 AUI_edit_SetAltTextStr(&editor_data, 0, NULL, TRUE, TxtSoftBack);
1233 AUI_edit_SetMode(&editor_data,ED_MODE_ALPHA, ED_CURSOR_UNDERLINE);
1234 //CRR: 23942 - xpradipg 26 Aug 2004
1235 //reset the text buffer
1236 memset(text,'\0',MAX_EMS_TEXT_LEN);
1237 AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, (UBYTE*)text, sizeof(text));
1238 editor = AUI_edit_Start(win, &editor_data);
1239
1240 break;
1241 //CRR :25302 - xpradipg 10 Nov 2004
1242 case MMS_EMS_PHBK_NUMBER:
1243 // TRACE_EVENT("calling MmsSend_PHBK_exec_cb() from MmsCreate_send_exec_cb()");
1244 EmsSend_PHBK_exec_cb(number_edit, event, parameter);
1245 break;
1246 case MWM_ONDRAW:
1247 break;
1248 case MWM_DESTORY:
1249 break;
1250 default:
1251 TRACE_EVENT("Err: Default");
1252 break;
1253 }
1254 }
1255
1256
1257 /*******************************************************************************
1258
1259 $Function: MMSCreate_SEND_start
1260
1261 $Description: Create SMS send window
1262
1263 $Returns: execution status
1264
1265 $Arguments: parent_window - parent window.
1266 UserData - SMS data
1267 *******************************************************************************/
1268
1269 T_MFW_HND EMSCreate_SEND_start(T_MFW_HND parent_window, void *UserData)
1270 {
1271 T_MFW_HND win;
1272 TRACE_FUNCTION ("EMSCreate_SEND_start()");
1273 win=MMI_CreateWindow(parent_window, (T_DIALOG_FUNC) EMSCreate_SEND_exec_cb, (void*)UserData,0, 0,0);
1274 if(UserData) SEND_EVENT(win, (USHORT)UserData, 0, 0);
1275 return win;
1276 }
1277
1278 #define MMS_CREATE_OPTION
1279
1280
1281 /*******************************************************************************
1282
1283 $Function: MMSCreate_OPTexeSend
1284
1285 $Description: Called when the user press send in the Option menu
1286
1287 $Returns: event status.
1288
1289 $Arguments: m - pointer to menu.
1290 i - index if selected menu item.
1291 *******************************************************************************/
1292
1293 static int EMSCreate_OPTexeSend(MfwMnu* m, MfwMnuItem* i)
1294 {
1295 T_MFW_HND win = mfwParent(mfw_header());
1296
1297 DAL_PostMessage(EMG4_SaveMsg, EMG4_Type_NotUsed, 0, 0);
1298
1299 EMSCreate_SEND_start(win, (void*)E_MODE_NUMBER);
1300
1301
1302 }
1303
1304 /*******************************************************************************
1305
1306 $Function: EMSCreate_OPTexeInsPreDefPicture
1307
1308 $Description: Displays list of the pre-defined pictures for EMS
1309 //xrashmic 7 Dec, 2004 MMI-SPR-23965
1310 $Returns:
1311
1312 $Arguments:
1313
1314 *******************************************************************************/
1315
1316 static int EMSCreate_OPTexeInsPreDefPicture(MfwMnu* m, MfwMnuItem* i)
1317 {
1318 T_MFW_HND win = mfwParent(mfw_header());
1319 // MMSom_start(win, (MfwMnuAttr *) MMS_INSERT_PICTURE);
1320 // pinghua modify for test EMS
1321 MMSom_start(win, (MfwMnuAttr *) EMS_INSERT_PICTURE);
1322 }
1323
1324 /*******************************************************************************
1325
1326 $Function: EMSCreate_OPTexeInsPicture
1327
1328 $Description: Displays list of the user-defined pictures for EMS
1329 //xrashmic 7 Dec, 2004 MMI-SPR-23965
1330 $Returns:
1331
1332 $Arguments:
1333
1334 *******************************************************************************/
1335 static int EMSCreate_OPTexeInsPicture(MfwMnu* m, MfwMnuItem* i)
1336 {
1337 T_MFW_HND win = mfwParent(mfw_header());
1338 MMSom_start(win, (MfwMnuAttr *) EMS_INSERT_PICTURE_USR);
1339 }
1340
1341 /*******************************************************************************
1342
1343 $Function: EMSCreate_OPTexeInsPreDefSound
1344
1345 $Description: Displays list of the pre-defined sound for EMS
1346 //xrashmic 7 Dec, 2004 MMI-SPR-23965
1347 $Returns:
1348
1349 $Arguments:
1350
1351 *******************************************************************************/
1352 static int EMSCreate_OPTexeInsPreDefSound(MfwMnu* m, MfwMnuItem* i)
1353 {
1354 T_MFW_HND win = mfwParent(mfw_header());
1355 // MMSom_start(win, (MfwMnuAttr *) MMS_INSERT_SOUND);
1356 // pinghua modify for test EMS!!
1357 MMSom_start(win, (MfwMnuAttr *) EMS_INSERT_SOUND);
1358 }
1359
1360 /*******************************************************************************
1361
1362 $Function: EMSCreate_OPTexeInsSound
1363
1364 $Description: Displays list of the user-defined sound for EMS
1365 //xrashmic 7 Dec, 2004 MMI-SPR-23965
1366 $Returns:
1367
1368 $Arguments:
1369
1370 *******************************************************************************/
1371 static int EMSCreate_OPTexeInsSound(MfwMnu* m, MfwMnuItem* i)
1372 {
1373 T_MFW_HND win = mfwParent(mfw_header());
1374 MMSom_start(win, (MfwMnuAttr *) EMS_INSERT_SOUND_USR);
1375 }
1376
1377
1378 static int EMSCreate_OPTexeInsText(MfwMnu* m, MfwMnuItem* i)
1379 {
1380 T_MFW_HND win = mfwParent(mfw_header());
1381 EMSCreate_SEND_start(win, (void*)E_MODE_TEXT);
1382 }
1383 static int EMSCreate_OPTexeSave(MfwMnu* m, MfwMnuItem* i)
1384 {
1385 DAL_PostMessage(EMG4_SaveMsg, EMG4_Type_NotUsed, 0, 0);
1386
1387 // xreddymn Nov-27-2004 MMI-SPR-25278
1388 g_inSaveMode=TRUE;
1389 //xrashmic 08 Feb, 2005 MMI-SPR-27853
1390 //Added few more parameters for this function
1391 g_inSaveModeWin = information_dialog(TxtPleaseWait,TxtNull,NULL,NULL, TxtNull,TxtNull,FOREVER,0,NULL);
1392 }
1393 #if 0
1394 static int MMSCreate_OPTexeInsSlide(MfwMnu* m, MfwMnuItem* i)
1395 {
1396 TRACE_EVENT("insert pic into OM");
1397 M4_InsertPicObjectIntoOM();
1398 }
1399
1400 #endif
1401 /*******************************************************************************
1402
1403 $Function: MMSCreate_OPT_exec_cb
1404
1405 $Description: Exec callback function for the Option window
1406
1407 $Returns: none
1408
1409 $Arguments: win - current window
1410 event - event id
1411 value - unique id
1412 parameter - optional data.
1413
1414 *******************************************************************************/
1415
1416 void EMSCreate_OPT_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
1417 /* callback handler for events sent to to trigger execution */
1418 {
1419 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
1420 TRACE_FUNCTION ("MMSCreate_OPT_exec_cb()");
1421 //xmzhou_trace_string_value("EMSCreate_OPT_exec_cb called", event);
1422 switch (event)
1423 {
1424 case MWM_CREATE:
1425 TRACE_EVENT("MWM_CREATE");
1426 /* initialization of administrative data */
1427 winShow(win);
1428 break;
1429 case MWM_ONDRAW:
1430 dspl_ClearAll();
1431 displaySoftKeys(TxtSoftOK,TxtSoftBack);
1432 break;
1433 case MWM_DESTORY:
1434 //xmzhou_trace_string("action_EMS_ResumeEditor in EMSCreate_OPT_exec_cb called");
1435 // xreddymn Sep-14-2004 MMI-SPR-24735: EMS editor is now resumed in EMSCreate_exec_cb
1436 // action_EMS_ResumeEditor();
1437 break;
1438 default:
1439 return;
1440 }
1441 }
1442
1443 /*******************************************************************************
1444
1445 $Function: MMSCreate_OPT_start
1446
1447 $Description: Start the creation of the main window for Create MMS
1448
1449 $Returns: mfw window handler
1450
1451 $Arguments: parent_window - Parent window handler
1452 menuAttr - Menu attributes.
1453 $Authors : pinghua add for EMS test
1454
1455 *******************************************************************************/
1456 T_MFW_HND EMSCreate_OPT_start(T_MFW_HND parent_window, MfwMnuAttr *menuAttr)
1457 {
1458 TRACE_FUNCTION ("SmsRead_R_start()");
1459 // xreddymn Sep-14-2004 MMI-SPR-24735: EMS editor is now suspended in EMSCreate_exec_cb
1460 // action_EMS_SuspendEditor();
1461 return MMI_CreateWindow(parent_window, (T_DIALOG_FUNC)EMSCreate_OPT_exec_cb,(void*)menuAttr, (T_MFW_CB)0, &EMSCreate_OPTAttrib,0);
1462 }
1463
1464
1465 static void EMSCreate_Delete_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason)
1466 {
1467 TRACE_FUNCTION("EMSCreate_Delete_cb");
1468
1469 switch (reason)
1470 {
1471 case INFO_KCD_LEFT:
1472 switch(identifier)
1473 {
1474 case EMS_DELETE_PICTURE:
1475 DAL_PostMessage(EMG4_Edit,EMG4_Type_NotUsed,0,NULL);
1476 DAL_PostMessage(EMG4_DeleteObject,EMG4_Type_NotUsed, EDeleteImage,NULL);
1477 break;
1478 case EMS_DELETE_SOUND:
1479 DAL_PostMessage(EMG4_Edit,EMG4_Type_NotUsed,0,NULL);
1480 DAL_PostMessage(EMG4_DeleteObject,EMG4_Type_NotUsed, EDeleteAudio,NULL);
1481 break;
1482 case EMS_DELETE_TEXT:
1483 DAL_PostMessage(EMG4_Edit,EMG4_Type_NotUsed,0,NULL);
1484 DAL_PostMessage(EMG4_DeleteObject,EMG4_Type_NotUsed, EDeleteText,NULL);
1485 break;
1486 }
1487 MMI_DestoryWindow(win);
1488 break;
1489 case INFO_KCD_HUP:
1490 case INFO_KCD_RIGHT:
1491 case INFO_KCD_CLEAR:
1492 MMI_DestoryWindow(win);
1493 break;
1494 default:
1495 break;
1496 }
1497 }
1498 static int EMSCreate_OPTexeDelPicture(MfwMnu* m, MfwMnuItem* i)
1499 {
1500 T_MFW_HND win = mfwParent(mfw_header());
1501 T_DISPLAY_DATA display_info;
1502 dlg_initDisplayData_TextId( &display_info, TxtSoftOK, TxtSoftBack, TxtPressOk, TxtDelete, COLOUR_STATUS);
1503 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)EMSCreate_Delete_cb, FOREVER, KEY_LEFT |KEY_RIGHT|KEY_CLEAR|KEY_HUP);
1504 display_info.Identifier=EMS_DELETE_PICTURE;
1505 info_dialog (win, &display_info);
1506 }
1507 static int EMSCreate_OPTexeDelSound(MfwMnu* m, MfwMnuItem* i)
1508 {
1509 T_MFW_HND win = mfwParent(mfw_header());
1510 T_DISPLAY_DATA display_info;
1511 dlg_initDisplayData_TextId( &display_info, TxtSoftOK, TxtSoftBack, TxtPressOk, TxtDelete, COLOUR_STATUS);
1512 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)EMSCreate_Delete_cb, FOREVER, KEY_LEFT |KEY_RIGHT|KEY_CLEAR|KEY_HUP);
1513 display_info.Identifier=EMS_DELETE_SOUND;
1514 info_dialog (win, &display_info);
1515 }
1516 static int EMSCreate_OPTexeDelText(MfwMnu* m, MfwMnuItem* i)
1517 {
1518 T_MFW_HND win = mfwParent(mfw_header());
1519 T_DISPLAY_DATA display_info;
1520 dlg_initDisplayData_TextId( &display_info, TxtSoftOK, TxtSoftBack, TxtPressOk, TxtDelete, COLOUR_STATUS);
1521 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)EMSCreate_Delete_cb, FOREVER, KEY_LEFT |KEY_RIGHT|KEY_CLEAR|KEY_HUP);
1522 display_info.Identifier=EMS_DELETE_TEXT;
1523 info_dialog (win, &display_info);
1524 }
1525
1526 #if 0
1527 void FUN_TRACE_EVENT(char * text, unsigned long param)
1528 {
1529 TRACE_EVENT_P1(text, param);
1530 }
1531 #endif
1532
1533
1534 /*******************************************************************************
1535
1536 $Function: ems_cb
1537
1538 $Description: Call back for ems_dialog
1539 xrashmic 13 Sep, 2004 MMI-SPR-24744
1540
1541 $Returns: None.
1542
1543 $Arguments:
1544 *******************************************************************************/
1545
1546 static void ems_cb(T_MFW_HND win, USHORT identifier, USHORT reason)
1547 {
1548 TRACE_FUNCTION("ems_cb");
1549 }
1550
1551
1552 /*******************************************************************************
1553
1554 $Function: ems_dialog
1555
1556 $Description: To display the indication of EMS sent
1557 xrashmic 13 Sep, 2004 MMI-SPR-24744
1558
1559 $Returns: None.
1560
1561 $Arguments:
1562 *******************************************************************************/
1563
1564 void ems_dialog(USHORT TxtId1, USHORT TxtId2, USHORT SoftKeyTxtId1, USHORT SoftKeyTxtId2, int timer)
1565 {
1566 T_DISPLAY_DATA display_info;
1567 T_MFW_HND parent_win = mfwParent(mfw_header());
1568 T_MFW_HND win;
1569 TRACE_FUNCTION("ems_dialog");
1570 dlg_initDisplayData_TextId( &display_info, SoftKeyTxtId1, SoftKeyTxtId2, TxtId1, TxtId2, COLOUR_WAP_POPUP);
1571 dlg_initDisplayData_events( &display_info,(T_VOID_FUNC)ems_cb, timer, KEY_RIGHT);
1572 display_info.Identifier = 0;
1573 win=info_dialog(parent_win, &display_info);
1574 win_show(win);
1575 dspl_Enable(1);
1576 return;
1577 }
1578
1579
1580
1581
1582 #undef MMI_MMSCREATE_C