comparison src/aci2/bmi/mmimmscreate.c @ 3:93999a60b835

src/aci2, src/condat2: import of g23m/condat source pieces from TCS211
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 26 Sep 2016 00:29:36 +0000
parents
children
comparison
equal deleted inserted replaced
2:c41a534f33c6 3:93999a60b835
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: MmiMMSCreate.h
17 $Revision: 1.0
18
19 $Author: Yan Bin(bin-yan@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 Nov 05, 2005 REF: OMAPS00049502 Sumanth Kumar. C
33 Description: MMS: During MMS Reply, Enter Number shows Empty.
34 Solution: Senders number is extracted from the Message Header and is displayed.
35
36 xrashmic 17 Jun, 2005 MMI-SPR-29992
37 For sending MMS on CHT sim, the FROM address should be NULL.
38 May 11 2005 REF: MMI-SPR-29887 x0012849
39 To Implement the deferred MMS retrieval.
40
41 xreddymn Mar-08-2005, MMI-SPR-28820
42 Fix for flickering issue (drawing occuring more than once) when
43 forwarding MMS and creating new MMS
44
45 xreddymn Feb-07-2005, MMI-SPR-28277
46 Fix for blank content on entering the MMS Editor-Viewer when
47 forwarding MMS messages.
48 xreddymn Mar-04-2005 MMI-SPR-26144
49 Added changes for cancel sending MMS
50
51 xrashmic 08 Feb, 2005 MMI-SPR-27853
52 Error handling in sending MMS and also displaying the progress value
53
54 x0012849 Feb- 03 -2005 : MMI-SPR-28224
55 To allow user to scroll up and down if contents of MMS are bigger than screen size.
56
57 xrashmic 14 Dec, 2004 MMI-SPR-23921
58 Implementing the forward functionality for MMS
59
60 xrashmic 30 Nov, 2004 MMI-SPR-26145
61 xrashmic 22 Dec, 2004 MMI-SPR-27798
62 Moving the MMS to sent folder after it is sent
63
64 xrashmic 3 Nov, 2004 MMI-SPR-26145
65 Deleting the compose and option window after sending the MMS
66
67 MMI-SPR-25278: Nov-29-2004 - xreddymn
68 Implemented FFS limits for MMS/EMS storage
69
70 CRR: 25302 - xpradipg 10 Nov 2004
71 Description: Should be able to select the number from the phonebook while
72 sending MMS/EMS.
73 Solution: The new feature to select the number from phonebook while sending
74 MMS/EMS is added
75
76 xrashmic 9 Nov, 2004 MMI-SPR-26147
77 Description: The inserted text in the MMS message was not editable and the
78 text editor was limited to a maximum of 32 characters.
79 Solution: The text buffer is memset to '\0' only once at the time of
80 MMS create - MWM_CREATE and increased the editor max size to 512.
81
82 xrashmic 6 Oct, 2004 MMI-SPR-25147
83 MMS not saving to unsent folder for all scenarios.
84
85 MMI-SPR-24735: Sep-16-2004 - xreddymn
86 Changes related to EMS screen flickering issue
87
88 MMI-SPR-24733, Sep-17-2004 - xreddymn
89 Modified case MWM_REFRESH to prevent edit mode being disabled
90
91 CRR: 23942 - xpradipg 26 Aug 2004
92 Description: Default values to be removed in text editor of MMS and EMS
93 Solution: The buffer assigned to the text editor is reset.
94
95 xreddymn 03 Sep, 2004
96 Display issue MMI-SPR-23961 related changes: Modified suspend and resume operation of MMS editor
97
98 CRR:23923 - xpradipg 06 Sept 2004
99 Description: MMS Preview not working
100 Solution: The preview is displayed in a new window by posting the
101 appropriate events to MMS client
102
103 CRR: 23942 - xpradipg 26 Aug 2004
104 Description: Default values to be removed in number editor of MMS and EMS
105 Solution: The strcpy() of the hardcoded numbers to the editor buffer are commented
106
107 xreddymn 20 Aug, 2004
108 Display issue MMI-SPR-23926 (TII_MMS12) and MMI-SPR-24115 (TII_MMS55): Added mechanism to prevent MMS/EMS display, while outside the MMS/EMS editor
109 MMS save issue MMI-SPR-24113 (TII_MMS53): Prevented creation of entries for unsaved messages on pressing back from MMS editor
110
111 xrashmic 19 Aug, 2004 Bug: 2, 3, 36 and 42
112 All the status screen, .i.e sending, receiving etc. are displayed separatly for the MMS module.
113 Previously the WAP screens were being used.
114
115 Bug Id 23 : 16 Aug, 2004 - xpradipg
116 Description:Remove insert slide from options menu
117 Solution: removed the insert slide item from the menu item array
118
119 17/01/04 Replace mfw edit with AUI edit.
120 26/08/03 Original TI(Shanghai) BMI version.
121
122 $End
123
124 *******************************************************************************/
125 #define MMI_MMSCREATE_C
126
127 #define ENTITY_MFW
128
129 /* includes */
130 #include <string.h>
131 #include <stdio.h>
132 #include <stdlib.h>
133
134 #if defined (NEW_FRAME)
135
136 #include "typedefs.h"
137 #include "vsi.h"
138 #include "pei.h"
139 #include "custom.h"
140 #include "gsm.h"
141
142 #else
143
144 #include "STDDEFS.H"
145 #include "custom.h"
146 #include "gsm.h"
147 #include "vsi.h"
148
149 #endif
150 #include "prim.h"
151
152
153 #include "mfw_mfw.h"
154 #include "mfw_win.h"
155 #include "mfw_kbd.h"
156 //#include "mfw_edt.h"
157 #include "mfw_tim.h"
158 #include "mfw_phb.h"
159 #include "ksd.h"
160 #include "psa.h"
161 #include "mfw_sms.h"
162 #include "mfw_smsi.h"
163 #include "mfw_icn.h"
164 #include "mfw_mnu.h"
165 #include "mfw_lng.h"
166 #include "mfw_sat.h"
167 #include "mfw_kbd.h"
168 #include "mfw_nm.h"
169
170 #include "psa_util.h"
171
172 #include "dspl.h"
173 // #include "unicode_types.h"
174
175 #include "MmiMain.h"
176 #include "MmiDummy.h"
177 //#include "MmiLists.h"
178 #include "MmiMmi.h"
179 #include "mmiCall.h"//GW 29/11/01 for 'callNumber'
180
181 #include "MmiDialogs.h"
182 #include "MmiLists.h"
183 #include "MmiMenu.h"
184 #include "MmiSoftKeys.h"
185
186 #ifdef NEW_EDITOR
187 #include "ATBCommon.h"
188 #include "ATBDisplay.h"
189 #include "ATBEditor.h"
190 #include "AUIEditor.h"
191 #else /* NEW_EDITOR */
192 #ifdef EASY_TEXT_ENABLED
193 #include "MmiLatinPredText.h"
194 #endif /* EASY_TEXT_ENABLED */
195 #include "MmiEditor.h"
196 #endif /* NEW_EDITOR */
197
198 #include "MmiBookShared.h" // MZ
199 #include "mmimmsmenu.h"
200 #include "mmimmscreate.h"
201 #include "mmimmsom.h"
202 #include "mmiwindow.h"
203 #include "mfw_ffs.h"
204
205 #include "cus_aci.h"
206
207 #include "prim.h"
208 #ifndef PCM_2_FFS
209 #include "pcm.h"
210 #endif
211
212
213 #include "aci_cmh.h" //GW 29/11/01 added for types in aci_fd.h
214 #include "aci_fd.h" //GW 29/11/01 added for types in 'cmh.h'
215 #include "cmh.h" //GW 29/11/01 added for types in 'cmh_phb.h'
216 #include "cmh_phb.h" //GW 29/11/01 added for cmhPHB_getAdrStr
217
218 #include "mmiColours.h"
219
220 //CRR: 25302 - xpradipg 10 Nov 2004
221 #include "mmiSmsMenu.h"
222 #include "mmismssend.h"
223
224 // ronaldc 8-5
225
226 #include "mg4def.h"
227 #include "evtdefs.h"
228 #include "mg4stu.h"
229 #include "Mg4Dal.h"
230 #include "mg4devif.h"
231 #include "dalevt.h"
232 #include "evif.h"
233 #include "mg4str.h"
234 #include "mmif.h"
235 #include "mg4mem.h"
236
237 #include "AUIWapext.h"
238 #include "ATBData.h"
239 #include "AUIWap.h"
240 //xmzhou02 to include definition for ALL_WIN & WAP_MMS
241
242
243
244 //GW 29/11/01 - added header file - removed extern void callNumber(UBYTE* number);
245 MfwWin* getWinData( MfwHnd win);
246
247 //xrashmic 19 Aug, 2004 Bug: 2, 3, 36 and 42
248 extern int MMSactive;
249
250 extern void M4_DebugMessage(unsigned long para);
251 //CRR:23923 - xpradipg 06 Sept 2004
252 extern int MMSBox_Read_kbd_cb (MfwEvt e, MfwKbd *k);
253
254 //xrashmic 30 Nov, 2004 MMI-SPR-26145
255 //xrashmic 20 Dec, 2004 MMI-SPR-23921
256 T_MFW_HND mms_create_opt_hnd=NULL;
257 T_MFW_HND mms_create_hnd=NULL;
258
259 //xrashmic 14 Dec, 2004 MMI-SPR-23921
260 T_MFW_HND mms_Fwdcreate_hnd=NULL;
261 extern MM_S_MESSAGE_HEADER_LIST* g_pMessageHeaderList;
262 extern int g_currentMessage;
263 MM_S_MESSAGE_HEADER *fwd_msg_header;
264
265
266 /*********************************************************************
267
268 DYNAMIC MENU WINDOW. DECLARATION
269
270 **********************************************************************/
271
272
273 static int MMSCreate_OPTexeSend(MfwMnu* m, MfwMnuItem* i);
274 static int MMSCreate_OPTexeInsPicture(MfwMnu* m, MfwMnuItem* i);
275 static int MMSCreate_OPTexeInsSound(MfwMnu* m, MfwMnuItem* i);
276 static int MMSCreate_OPTexeInsText(MfwMnu* m, MfwMnuItem* i);
277 static int MMSCreate_OPTexeInsSlide(MfwMnu* m, MfwMnuItem* i);
278 static int MMSCreate_OPTexeDelPicture(MfwMnu* m, MfwMnuItem* i);
279 static int MMSCreate_OPTexeDelSound(MfwMnu* m, MfwMnuItem* i);
280 static int MMSCreate_OPTexeDelText(MfwMnu* m, MfwMnuItem* i);
281 static int MMSCreate_OPTexeSave(MfwMnu* m, MfwMnuItem* i);
282 //CRR:23923 - xpradipg 06 Sept 2004
283 static int MMSCreate_OPTpreviewMsg(MfwMnu* m, MfwMnuItem* i);
284
285 static MfwMnuItem MMSCreate_OPTDeleteItems [] =
286 {
287 {0,0,0,(char *)TxtMMSDeletePicture,0,(MenuFunc)MMSCreate_OPTexeDelPicture,item_flag_none},
288 {0,0,0,(char *)TxtMMSDeleteSound,0,(MenuFunc)MMSCreate_OPTexeDelSound,item_flag_none},
289 {0,0,0,(char *)TxtMMSDeleteText,0,(MenuFunc)MMSCreate_OPTexeDelText,item_flag_none}
290 };
291 static MfwMnuAttr MMSCreate_OPTDeleteAttrib =
292 {
293 &SmsRead_R_OPTArea,
294 MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */
295 -1, /* use default font */
296 MMSCreate_OPTDeleteItems, /* with these items */
297 sizeof(MMSCreate_OPTDeleteItems)/sizeof(MfwMnuItem), /* number of items */
298 COLOUR_LIST_SMS, TxtNull, MNUATTRSPARE
299 };
300
301 static MfwMnuItem MMSCreate_OPTItems [] =
302 {
303 {0,0,0,(char *)TxtSend,0,(MenuFunc)MMSCreate_OPTexeSend,item_flag_none},
304 {0,0,0,(char *)TxtMMSInsertPicture,0,(MenuFunc)MMSCreate_OPTexeInsPicture,item_flag_none},
305 {0,0,0,(char *)TxtMMSInsertSound,0,(MenuFunc)MMSCreate_OPTexeInsSound,item_flag_none},
306 {0,0,0,(char *)TxtMMSInsertText,0,(MenuFunc)MMSCreate_OPTexeInsText,item_flag_none},
307 //Bug Id 23 : 16 Aug, 2004 - xpradipg
308 //Description:Remove insert slide from options menu
309 //{0,0,0,(char *)TxtMMSInsertSlide,0,(MenuFunc)MMSCreate_OPTexeInsSlide,item_flag_none},
310 {0,0,0,(char *)TxtSave,0,(MenuFunc)MMSCreate_OPTexeSave,item_flag_none},
311 {0,0,0,(char *)TxtMMSDelete,&MMSCreate_OPTDeleteAttrib,0,item_flag_none},
312 //CRR:23923 - xpradipg 06 Sept 2004
313 //Added the functionality for preview message
314 //xrashmic 6 Oct, 2004 MMI-SPR-25147
315 //Since the Compose screen itself is in preview mode, no need for this
316 //in the options menu
317 // {0,0,0,(char *)TxtMMSPreview,0,(MenuFunc)MMSCreate_OPTpreviewMsg,item_flag_none}
318 };
319
320 static MfwMnuAttr MMSCreate_OPTAttrib =
321 {
322 &SmsRead_R_OPTArea,
323 MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */
324 -1, /* use default font */
325 MMSCreate_OPTItems, /* with these items */
326 sizeof(MMSCreate_OPTItems)/sizeof(MfwMnuItem), /* number of items */
327 COLOUR_LIST_SMS, TxtNull, MNUATTRSPARE
328
329 };
330
331 #if 1
332
333 // bernards bbssoo 25.9.2003 begin
334
335 typedef enum
336 {
337 MMI2_NEW_MSG= -9,
338 MMI2_DELETE_MSG,
339 MMI2_STORE_MSG_HDR,
340 MMI2_SEND_MSG,
341 MMI2_GET_MSG,
342 MMI2_FWD_MSG,
343 MMI2_PROCESSACK
344 }MMI2_EVT_TYPE;
345
346 typedef struct
347 {
348 EVT_STRUCT evtStruct;
349 MMI2_EVT_TYPE eType;
350 }MMI2_EVT_STRUCT;
351
352 typedef MMI2_EVT_STRUCT* MMI2_EVT_HANDLE;
353
354 static ESTATUS MMI_2_EventHandler(EVENT_ID aeId, EVENT_TYPE aeType, MESSAGE_PARAM ampParam, EVT_HANDLE evtHandle);
355
356
357 MM_S_MESSAGE_HEADER *msgHeader=NULL;
358
359 // ronaldc 9-4 to 9-5: add start
360 MM_S_MESSAGE_HEADER g_msg_header;
361 EVT_STRUCT g_event_struct;
362 EVT_STRUCT g_doc_event_struct;
363 MM_MESSAGE_ID g_msg_id;
364 EV_S_NEWSLIDE_INFO g_NewSlideInfo;
365 UCS2 g_insertString[128] = {'t','e','s','t',0};
366 MSafeString g_safeString;
367 BOOL g_inSendMode=FALSE;
368
369 //xreddymn Aug-16-2004 MMI-SPR-23926 (TII_MMS12) and MMI-SPR-24115 (TII_MMS55): To keep track of MMS display
370 BOOL g_M4_display_active=FALSE;
371 //xreddymn Aug-18-2004 MMI-SPR-24113 (TII_MMS53): To keep track of saved messages
372 BOOL g_M4_message_saved=FALSE;
373 BOOL g_inSaveMode=FALSE;
374 //xreddymn Aug-26-2004
375 extern UINT8 gucMmsTitleBarHeight;
376 //xreddymn Nov-26-2004 MMI-SPR-25278
377 T_MFW_HND g_inSaveModeWin;
378 //xrashmic 08 Feb, 2005 MMI-SPR-27853
379 extern void AUI_mms_status_notify(int status);
380
381 //xrashmic 9 Nov, 2004 MMI-SPR-26147
382 static char text[MAX_MMS_TEXT_LEN];
383 //xreddymn Feb-02-2005 MMI-SPR-28277: Used to trigger EMG4_Refresh when forwarding MMS
384 BOOL gMmsForwardStart=FALSE;
385
386 void DummyFreeFunc(void *pMemBlock)
387 {
388 return;
389 }
390 //xrashmic 08 Feb, 2005 MMI-SPR-27853
391 int progressValue=0;
392
393 ESTATUS MMI_1_EventHandler(EVENT_ID aeId, EVENT_TYPE aeType, MESSAGE_PARAM ampParam, EVT_HANDLE evtHandle)
394 {
395
396 M4_DebugMessage((unsigned long) 0x9700);
397 M4_DebugMessage((unsigned long) aeId);
398 M4_DebugMessage((unsigned long) aeType);
399 M4_DebugMessage((unsigned long) ampParam);
400 M4_DebugMessage((unsigned long) evtHandle);
401
402
403 switch(aeId)
404 {
405 #if 0
406
407 case EMG4_PlayComplete:
408 switch(MMI1EvtHandle->mmievtType)
409 {
410 case MMI1_EV_PLAY_MSG:
411 // Message has finished playing, so tell user thru EV window
412 aPoint.uX = 0;
413 aPoint.uY = 0;
414 DeviceClearOffscreenBuffer();
415 DAL_DrawText(&aPoint, _T("(End of show)"), 13, afmStyle, &aColour);
416 DeviceUpdateScreen();
417 break;
418 };
419 break;
420
421 case EMG4_PreviewComplete:
422 switch(MMI1EvtHandle->mmievtType)
423 {
424 case MMI1_EV_CREATE_MSG:
425 case MMI1_EV_OPEN_MSG:
426 /*Call Preview Routine to post end Preview */
427 if(l_bIsPreview)
428 {
429 MMI_1_Preview(g_hwndMMI1);
430 }
431 break;
432 default:
433 break;
434 };
435 break;
436 #endif
437
438 /********************* Editor Viewer CallBacks *********************/
439 case EMG4_FileOpDone:
440 M4_DebugMessage((unsigned long) 0x9701);
441 // xreddymn Feb-02-2005 MMI-SPR-28277: If forwarding an MMS message, post EMG4_Refresh
442 if(gMmsForwardStart == TRUE)
443 {
444 // xreddymn Mar-08-2005 MMI-SPR-28820: change sequence of posting
445 // EMG4_Preview and EMG4_Resume
446 action_PreviewMessage();
447 action_ResumeEditor();
448 gMmsForwardStart = FALSE;
449 }
450 if (g_inSendMode == TRUE)
451 {
452 M4_DebugMessage((unsigned long) 0x9702);
453 //xrashmic 08 Feb, 2005 MMI-SPR-27853
454 //Indicate the saving is done and sending has started
455 // xreddymn Mar-04-2005 MMI-SPR-26144
456 // MMS send progress is updated by WAP FSM
457 // progressValue=0;
458 // AUI_mms_status_notify(MMS_SEND_PROGRESS);
459 MMI_2_OnSendMessage();
460 //xrashmic 08 Feb, 2005 MMI-SPR-27853
461 //Indicate the saving is done and sending has started
462 // progressValue=0;
463 // AUI_mms_status_notify(MMS_SEND_PROGRESS);
464 g_inSendMode=FALSE;
465
466 // xreddymn Aug-18-2004 MMI-SPR-24113 (TII_MMS53): To keep track of saved messages
467 g_M4_message_saved=TRUE;
468 }
469 // xreddymn Aug-18-2004 MMI-SPR-24113 (TII_MMS53): To keep track of saved messages
470 if(g_inSaveMode == TRUE)
471 {
472 winDelete(g_inSaveModeWin);
473 g_inSaveMode=FALSE;
474 g_M4_message_saved=TRUE;
475 // xreddymn Nov-27-2004 MMI-SPR-25278: Display "Saved" dialog here
476 //xrashmic 08 Feb, 2005 MMI-SPR-27853
477 //Added few more parameters for this function
478 information_dialog(TxtSaved,TxtNull,NULL,NULL, TxtNull,TxtSoftBack,FOREVER,KEY_CLEAR|KEY_RIGHT|KEY_HUP,NULL);
479 }
480 break;
481 // xrashmic Nov-17-2004 MMI-SPR-25278: Changes for FFS error handling
482 case EMG4_OpError:
483 {
484 MDword reason;
485
486 // xreddymn Feb-02-2005 MMI-SPR-28277: If forwarding an MMS message and OpenDocument fails, reset gMmsForwardStart
487 if(gMmsForwardStart==TRUE)
488 {
489 gMmsForwardStart=FALSE;
490 }
491 if(g_inSaveMode == TRUE)
492 {
493 winDelete(g_inSaveModeWin);
494 g_inSaveMode=FALSE;
495 g_M4_message_saved=FALSE;
496 }
497
498 reason = (ampParam & 0x3FFF);
499 switch(reason)
500 {
501 case EFileOpFailed:
502 //xrashmic 08 Feb, 2005 MMI-SPR-27853
503 //When sending MMS if there are file op erros, we need to handle them here
504 if (g_inSendMode == TRUE)
505 {
506 g_inSendMode=FALSE;
507 AUI_mms_status_notify(MMS_SEND_FAIL);
508 }
509 else
510 {
511 // xreddymn Nov-27-2004 MMI-SPR-25278: Display "Error" dialog here
512 //xrashmic 08 Feb, 2005 MMI-SPR-27853
513 //Added few more parameters for this function
514 information_dialog(TxtFailed,TxtFatalError,NULL,NULL, TxtNull,TxtSoftBack,FOREVER,KEY_CLEAR|KEY_RIGHT|KEY_HUP,NULL);
515 }
516 break;
517 }
518
519 }
520 break;
521 default:
522 break;
523 }
524
525 return ENoError;
526
527 }
528
529
530
531
532
533
534 ESTATUS Handler_MM_CreateMessageEntryAsync(EVENT_ID aeId, EVENT_TYPE aeType, MESSAGE_PARAM ampParam, EVT_HANDLE evtHandle)
535 {
536
537 ESTATUS eStatus;
538
539 // TRACE_EVENT("MAGIC4: Handler_MM_CreateMessageEntryAsync()");
540
541 g_msg_id = (MM_MESSAGE_ID) ampParam;
542
543 M4_DebugMessage((unsigned long) 0x30000);
544 M4_DebugMessage((unsigned long) g_msg_id);
545
546
547 g_doc_event_struct.handler = MMI_1_EventHandler;
548 g_doc_event_struct.parentEvtHandle = NULL;
549 g_doc_event_struct.pData = NULL;
550 g_doc_event_struct.userFlag = 0;
551
552 eStatus=EV_CreateDocument(&g_doc_event_struct, EMtMmsSmil, g_msg_id);
553
554 if (eStatus!=ENoError) {
555 M4_DebugMessage((unsigned long) 0x34000);
556 M4_DebugMessage((unsigned long) eStatus);
557 }
558
559 g_NewSlideInfo.omh.freeFunc = DummyFreeFunc;
560 // xreddymn Aug-27-2004 MMI-SPR-23919 (TII_MMS6): Modified slide duration to infinite
561 // g_NewSlideInfo.slideDuration = 5000;
562 g_NewSlideInfo.slideDuration = 0;
563 g_NewSlideInfo.slidePosition = 1;
564
565 // rvf_delay(10);
566 DAL_PostMessage(EMG4_InsertNewSlide, EMG4_Type_NotUsed, (MESSAGE_PARAM)&g_NewSlideInfo, 0);
567 #if 0
568 // rvf_delay(10);
569 DAL_PostMessage(EMG4_InsertString, EMG4_Type_NotUsed, (MESSAGE_PARAM)g_TestString, 0);
570 // rvf_delay(10);
571 DAL_PostMessage(EMG4_SaveMsg, EMG4_Type_NotUsed, 0, 0);
572 // rvf_delay(10);
573 DAL_PostMessage(EMG4_Exit, EMG4_Type_NotUsed, 0, 0);
574 // rvf_delay(10);
575 #endif
576 M4_DebugMessage((unsigned long) 0x30001);
577 return ENoError;
578 }
579
580 void OrthusCreateMessageEntryAsync(void)
581 {
582 ESTATUS eResult;
583
584 TRACE_EVENT("MAGIC4: OrthusCreateMessageEntryAsync()");
585
586 g_msg_header.memHdr.freeFunc = DummyFreeFunc;
587
588 g_msg_header.id = MM_INVALID_MESSAGE_ID;
589 g_msg_header.messageFlags = 0;
590 g_msg_header.reference = 0;
591 g_msg_header.read = EFalse;
592 g_msg_header.complete = EFalse;
593 g_msg_header.drmSet = EFalse;
594
595 memset(&(g_msg_header.timestamp), 0, sizeof(MM_S_TIME_STAMP));
596
597 g_msg_header.timestamp.type = ETimestampAbsolute;
598 g_msg_header.location = EMlDraft;
599
600 g_msg_header.type = EMtMmsSmil;
601
602 g_msg_header.messageTypeHeader.mmsHeader.pBccList = NULL;
603 g_msg_header.messageTypeHeader.mmsHeader.pCcList = NULL;
604 g_msg_header.messageTypeHeader.mmsHeader.pContentType = NULL;
605 g_msg_header.messageTypeHeader.mmsHeader.pFrom = NULL;
606 g_msg_header.messageTypeHeader.mmsHeader.pMmsTransactionId = NULL;
607 g_msg_header.messageTypeHeader.mmsHeader.pServerMessageId = NULL;
608 g_msg_header.messageTypeHeader.mmsHeader.pSubject = NULL;
609 g_msg_header.messageTypeHeader.mmsHeader.pToList = NULL;
610 g_msg_header.messageTypeHeader.mmsHeader.pUrl = NULL;
611 g_msg_header.messageTypeHeader.mmsHeader.size = 0;
612 g_msg_header.messageTypeHeader.mmsHeader.version = 1;
613 g_msg_header.messageTypeHeader.mmsHeader.deliveryReport = EFalse;
614 g_msg_header.messageTypeHeader.mmsHeader.readReport = EFalse;
615
616 memset(&(g_msg_header.messageTypeHeader.mmsHeader.expiryTime), 0, sizeof(MM_S_TIME_STAMP));
617 memset(&(g_msg_header.messageTypeHeader.mmsHeader.currentDate), 0, sizeof(MM_S_TIME_STAMP));
618
619 g_msg_header.messageTypeHeader.mmsHeader.currentDate.type = ETimestampAbsolute;
620
621 g_msg_header.messageTypeHeader.mmsHeader.expiryTime.type = ETimestampRelative;
622
623 g_msg_header.messageTypeHeader.mmsHeader.priority = EMPnormal;
624
625 g_msg_header.messageTypeHeader.mmsHeader.setDeferred = EFalse;
626 g_msg_header.messageTypeHeader.mmsHeader.setRejected = EFalse;
627 g_msg_header.messageTypeHeader.mmsHeader.expired = EFalse;
628 g_msg_header.messageTypeHeader.mmsHeader.retrieved = EFalse;
629 g_msg_header.messageTypeHeader.mmsHeader.readRemote = EFalse;
630
631 g_event_struct.handler = Handler_MM_CreateMessageEntryAsync;
632 g_event_struct.parentEvtHandle = NULL;
633 g_event_struct.pData = NULL;
634 g_event_struct.userFlag = 0;
635
636 M4_DebugMessage((unsigned long) g_event_struct.handler);
637
638 eResult = MM_CreateMessageEntryAsync((EVT_HANDLE) &g_event_struct, &g_msg_header);
639 if(eResult!=ENoError)
640 {
641 TRACE_EVENT("MAGIC4: MM_CreateMessageEntryAsync() fail");
642 }
643 // xreddymn Aug-18-2004 MMI-SPR-24113 (TII_MMS53): To keep track of when the MMS is saved
644 else
645 {
646 g_M4_message_saved=FALSE;
647 }
648
649 g_safeString.memHeader.freeFunc = DummyFreeFunc; /*!< Pointer to memory deallocation function */
650 g_safeString.size=10; /*!< size of the string */
651 g_safeString.pString=g_insertString; /*!< Pointer to UCS2 string */
652 }
653
654
655 /*************************************************************************/
656 /**
657 Send the selected message...
658
659 \param hWnd [in] Of this Window...i.e MMI_2
660
661 \return <???>
662
663 /*************************************************************************/
664 BOOL MMI_2_OnSendMessage()
665 {
666 //MInt32 nSel=0;
667 MMI2_EVT_HANDLE pHandle=NULL;
668 ESTATUS eResult=ENoError;
669
670 pHandle = (MMI2_EVT_HANDLE)malloc(sizeof(MMI2_EVT_STRUCT));
671 if(!pHandle)
672 {
673 //M4_SIM_DisplayError(hWnd,_T("Mem Alloc Error"));
674 return TRUE;
675 }
676
677 pHandle->evtStruct.handler = MMI_2_EventHandler;
678 pHandle->evtStruct.parentEvtHandle = NULL;
679 pHandle->evtStruct.pData = NULL;
680 pHandle->evtStruct.userFlag = 0;
681 pHandle->eType = MMI2_SEND_MSG;
682
683 M4_DebugMessage((unsigned long) 0x94001);
684
685 eResult= TM_SendMessageAsync((EVT_HANDLE)pHandle, g_msg_id);
686
687 M4_DebugMessage((unsigned long)g_msg_id);
688
689
690 if(eResult!=ENoError)
691 {
692 //M4_SIM_ReportError(eResult,hWnd);
693 free(pHandle);
694 pHandle=NULL;
695 }
696 return TRUE;
697 }
698
699 /*********************/
700
701 //NM moved this function to mmimmsbox.c
702 #if 0
703 UCS2 * MMS_ConvertStringToUcs2 (const MByte * const p8BitString,
704 const MUint uLength,
705 UCS2 * pUcs2String)
706 {
707 if ((UCS2 *) NULL == pUcs2String)
708 {
709 pUcs2String = (UCS2 *)MM_MALLOC(sizeof(UCS2) * (1 + uLength));
710 }
711
712 if ((UCS2 *)NULL != pUcs2String)
713 {
714 register MUint uIndex;
715 for (uIndex = 0; uIndex < uLength; ++uIndex)
716 {
717 pUcs2String[uIndex] = (UCS2)p8BitString[uIndex];
718 }
719 pUcs2String[uIndex] = NULLCHAR;
720 }
721
722 return pUcs2String;
723 }
724
725 #endif
726
727 /*******************************************************************************
728
729 $Function: cancel_TMsend
730
731 $Description: Posts MMS send cancel to MMS client
732
733 $Returns: none
734
735 $Arguments: none
736
737 *******************************************************************************/
738
739 //xrashmic 26144
740 void cancel_TMsend(void)
741 {
742 char temp[100];
743 ESTATUS eResult=ENoError;
744 TRACE_EVENT("cancelSendingMMS");
745 sprintf(temp, "####cancelSendingMMS");
746 M4_DebugStringMessage(temp, strlen(temp), 0);
747 eResult= TM_SendMessageCancel( g_msg_id);
748 if(eResult!=ENoError)
749 {
750 sprintf(temp, "####cancelSendingMMS done");
751 M4_DebugStringMessage(temp, strlen(temp), 0);
752 }
753 }
754
755 //May 17 2005 REF: MMI-SPR-29887 x0012849
756 // Called when user cancels the recieving operation
757 void cancel_TMrecieve(void)
758 {
759 ESTATUS eResult=ENoError;
760 TRACE_EVENT("cancel_TMrecieve");
761 eResult= TM_GetMessageCancel ( g_pMessageHeaderList->ppList[g_currentMessage].id);
762 if(eResult!=ENoError)
763 {
764 TRACE_EVENT("CancelRecievingMMS done");
765 }
766 }
767 //Jun 28 2005 REF: MMI-SPR-29887 x0012849
768 ESTATUS Handler_MM_DeleteMessageBodyEntryAsync(EVENT_ID aeId, EVENT_TYPE aeType, MESSAGE_PARAM ampParam, EVT_HANDLE evtHandle)
769 {
770 return ENoError;
771 }
772 //Jun 28 2005 REF: MMI-SPR-29887 x0012849
773 void Delete_Body(void)
774 {
775 g_event_struct.handler = Handler_MM_DeleteMessageBodyEntryAsync;
776 g_event_struct.parentEvtHandle = NULL;
777 g_event_struct.pData = NULL;
778 g_event_struct.userFlag = 0;
779 MM_DeleteMessageBodyAsync((EVT_HANDLE) &g_event_struct, g_pMessageHeaderList->ppList[g_currentMessage].id);
780 }
781
782 void MMI_2_SaveHeaderInfo(char *topic, char *number)
783 {
784
785 //char from[]="13801639314/TYPE=PLMN";//bernard
786 //char from[]="60765943/TYPE=PLMN";
787 char from[]="/TYPE=PLMN";
788
789 UCS2 *pUcsFrom= NULL;
790 UCS2 *pUcsTopic = NULL;
791 UCS2 *pUcsNumber = NULL;
792 MMI2_EVT_HANDLE evtHandle=NULL;
793 ESTATUS eResult;
794
795 char temp[100];
796 char tempNumber[100];
797
798 sprintf(temp, "MMI_2_SaveHeaderInfo called %s, %s", topic, number);
799 //M4_DebugStringMessage(temp, strlen(temp), 0);
800
801 //xrashmic 17 Jun, 2005 MMI-SPR-29992
802 //For sending MMS on CHT sim, the FROM address should be NULL.
803 /*pUcsFrom= (UCS2 *)MMS_ConvertStringToUcs2((const MByte *)from,
804 GetByteStringLength((const MByte *)from),
805 pUcsFrom);
806 */
807 pUcsTopic = (UCS2 *)MMS_ConvertStringToUcs2((const MByte *)topic,
808 GetByteStringLength((const MByte *)topic),
809 pUcsTopic);
810 if (NULL == pUcsTopic)
811 {
812 sprintf(temp, "MMI_2_SaveHeaderInfo called pUcsTopic = NULL");
813 //M4_DebugStringMessage(temp, strlen(temp), 0);
814 return;
815 }
816
817 sprintf(temp, "MMI_2_SaveHeaderInfo number=%s", number);
818 //M4_DebugStringMessage(temp, strlen(temp), 0);
819
820 strcpy(tempNumber, number);
821 strcat(tempNumber,"/TYPE=PLMN");
822
823 sprintf(temp, "MMI_2_SaveHeaderInfo tempNumber=%s", tempNumber);
824 //M4_DebugStringMessage(temp, strlen(temp), 0);
825
826 pUcsNumber= (UCS2 *)MMS_ConvertStringToUcs2((const MByte *)tempNumber,
827 GetByteStringLength((const MByte *)tempNumber),
828 pUcsNumber);
829
830 if (pUcsNumber == NULL)
831 {
832 sprintf(temp, "MMI_2_SaveHeaderInfo pUcsNumber == NULL");
833 //M4_DebugStringMessage(temp, strlen(temp), 0);
834 }
835
836 if (NULL == pUcsNumber)
837 {
838 MMS_FREE(pUcsTopic);
839 return;
840 }
841
842 //-----------------------
843
844 eResult= DAL_RetrieveMessageHeader(g_msg_id,&msgHeader);
845 if(eResult!=ENoError)
846 {
847 M4_DebugMessage((unsigned long)0x4400);
848 return;
849 }
850
851 msgHeader->messageTypeHeader.mmsHeader.pFrom = pUcsFrom;
852 msgHeader->messageTypeHeader.mmsHeader.pToList = pUcsNumber;
853 msgHeader->messageTypeHeader.mmsHeader.pSubject = pUcsTopic;
854
855
856 //-----------------------
857
858
859 /* Form the event Handler */
860 evtHandle = (MMI2_EVT_HANDLE)malloc(sizeof(MMI2_EVT_STRUCT));
861 evtHandle->evtStruct.handler = MMI_2_EventHandler;
862 evtHandle->evtStruct.parentEvtHandle = NULL;
863 evtHandle->evtStruct.pData = NULL;
864 evtHandle->evtStruct.userFlag = 0;
865 evtHandle->eType = MMI2_STORE_MSG_HDR;
866
867 DAL_ModifyMessageParamsAsync((EVT_HANDLE)evtHandle,g_msg_id,msgHeader);
868
869 //msgHeader->memHdr.freeFunc(msgHeader);
870
871 }
872
873
874 /*************************************************************************/
875 /**
876 EVENT HANDLER: Message Dialog (MMI_2)
877
878 \param aeId [in] EVENT_ID
879 \param ampParam [in] MESSAGE_PARAM
880 \param evtHandle [in] EVT_HANDLE
881 \return None [out]
882 /*************************************************************************/
883 ESTATUS MMI_2_EventHandler(EVENT_ID aeId, EVENT_TYPE aeType, MESSAGE_PARAM ampParam, EVT_HANDLE EvtHandle)
884 {
885 MMI2_EVT_HANDLE MMI2evtHandle = (MMI2_EVT_HANDLE) EvtHandle;
886 BOOL bProcessed = FALSE;
887 T_WAP_DATA *data = AUI_wap_data();
888 data->View->Title[0] = 0;
889
890 M4_DebugMessage((unsigned long) 0x9800);
891 M4_DebugMessage((unsigned long) aeId);
892 M4_DebugMessage((unsigned long) aeType);
893 M4_DebugMessage((unsigned long) ampParam);
894 M4_DebugMessage((unsigned long) EvtHandle);
895
896
897 switch(aeId)
898 {
899 case EMG4_NetworkOpDone:
900 switch(MMI2evtHandle->eType)
901 {
902 case MMI2_SEND_MSG:
903 //xrashmic 22 Dec, 2004 MMI-SPR-27798
904 // MMS send is successful, save it to sent folder
905 MM_BeginUpdateHeader(g_msg_id);
906 MM_UtilSetFolder(g_msg_id,EMlSent);
907 MM_CommitUpdateHeaderAsync(NULL, g_msg_id);
908
909 //xrashmic 19 Aug, 2004 Bug: 2, 3, 36 and 42
910 // To display the MMS send Success dialog here.
911 //xrashmic 08 Feb, 2005 MMI-SPR-27853
912 AUI_mms_status_notify(MMS_SEND_SUCCESS);
913 bProcessed=TRUE;
914 break;
915 default:
916 break;
917 }
918 break;
919 //xrashmic 08 Feb, 2005 MMI-SPR-27853
920 // Need to display to the user the send progress infomation
921 case EMG4_OpProgress:
922 switch(MMI2evtHandle->eType)
923 {
924 case MMI2_SEND_MSG:
925 // xreddymn Mar-04-2005 MMI-SPR-26144
926 // MMS progress is updated by WAP FSM
927 // progressValue=ampParam;
928 // AUI_mms_status_notify(MMS_SEND_PROGRESS);
929 break;
930 default:
931 break;
932 }
933 break;
934 //xrashmic 08 Feb, 2005 MMI-SPR-27853
935 //Need to catch the errors when the sending fails
936 case EMG4_OpError:
937 switch(MMI2evtHandle->eType)
938 {
939 case MMI2_SEND_MSG:
940 AUI_mms_status_notify(MMS_SEND_FAIL);
941 break;
942 }
943 break;
944
945 }
946
947 if(MMI2evtHandle && bProcessed)
948 {
949 free(MMI2evtHandle);
950 MMI2evtHandle= NULL;
951 }
952 return ENoError;
953 }
954
955
956
957 /* 1. User selects 'Preview' from user menu (MMI) */
958 /* 2. MMI calls action_ResumeEditor() to resume the magic4 client and suspends the menu system */
959
960 void action_ResumeEditor()
961 {
962 /* resume magic4 editor */
963 DAL_PostMessage(EMG4_Resume,EMG4_Type_NotUsed,0,NULL);
964 /* if necessary, add code here to suspend display of the menu system */
965 }
966
967
968 /* 3. After action_ResumeEditor has been completed, MMI then calls action_PreviewMessage() to preview the message currently in the magic4 editor */
969
970 void action_PreviewMessage()
971 {
972 /* inform magic4 editor to preview the current message */
973 DAL_PostMessage(EMG4_Preview,EMG4_Type_NotUsed,0,NULL);
974 }
975
976 /* 4. After action_PreviewMessage has been completed, MMI then calls action_SuspendEditor() to suspend the magic4 client and resume the menu system */
977
978 void action_SuspendEditor()
979 {
980 /* suspend magic4 editor */
981 DAL_PostMessage(EMG4_Suspend,EMG4_Type_NotUsed,0,NULL);
982 DAL_PostMessage(EMG4_PlayMode,EMG4_Type_NotUsed, EPlayModeStop,NULL);
983 /* if necessary, add code here to resume display of the menu system */
984 }
985
986 /* 5. Done */
987
988
989
990 #endif
991 // ronaldc 9-4 to 9-5: add end
992
993
994 /*******************************************************************************
995
996 $Function: MMSCreate_exec_cb
997
998 $Description: Exec callback function of the MMS Create window
999
1000 $Returns: none
1001
1002 $Arguments: win - window handler
1003 event - mfw event
1004 parameter - optional data.
1005
1006 *******************************************************************************/
1007 void MMSCreate_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
1008 /* callback handler for events sent to to trigger execution */
1009 {
1010 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
1011
1012 TRACE_FUNCTION ("MMSCreate_exec_cb()");
1013
1014 switch (event)
1015 {
1016 case MWM_CREATE:
1017 /* initialization of administrative data */
1018 TRACE_EVENT("MWM_CREATE");
1019
1020 //yanbin init MMS create bbssoo - EV_createmessageasync()
1021 // ronaldc 9-5
1022 OrthusCreateMessageEntryAsync();
1023 //TraceOrthusCreateMessageEntryAsyncReturn();
1024
1025 //xrashmic 9 Nov, 2004 MMI-SPR-26147
1026 //The text buffer is memset to '\0' only once at the time of MMS create - MWM_CREATE
1027 memset(text,'\0',MAX_MMS_TEXT_LEN);
1028
1029 //xreddymn Aug-16-2004 MMI-SPR-23926 (TII_MMS12) and MMI-SPR-24115 (TII_MMS55): M4 client will now use the display
1030 g_M4_display_active=TRUE;
1031 break;
1032 case MWM_ONDRAW:
1033 TRACE_EVENT("MWM_ONDRAW");
1034 dspl_Enable(0);
1035 // xreddymn Aug-26-2004: Modified Title display
1036 {
1037 unsigned short width, height;
1038 DeviceGetScreenMetrics(&width,&height);
1039 dspl_SetBgdColour(COL_White);
1040 dspl_Clear(0, gucMmsTitleBarHeight, width-1, height-1);
1041 resources_setTitleColour(COLOUR_EDITOR);
1042 dspl_Clear(0, 0, width-1, gucMmsTitleBarHeight-1);
1043 dspl_TextOut(1, 0, DSPL_TXTATTR_HLIGHT,"Create MMS");
1044 }
1045 //yanbin: here call Magic4 functions to show MMS slides
1046 // bbssoo - After Creating MMS, display the "create MMS display" in the middle screen.
1047 // xreddymn Mar-08-2005 MMI-SPR-28820: changed order of posting EMG4_Preview and EMG4_Resume
1048 action_PreviewMessage();
1049 action_ResumeEditor();
1050 //xrashmic 6 Oct, 2004 MMI-SPR-25147
1051 //comenting action_SuspendEditor() as the Sound was not heard in the
1052 //compose screen
1053 //action_SuspendEditor();
1054 displaySoftKeys(TxtSoftOptions,TxtSoftBack);
1055 dspl_Enable(1);
1056 break;
1057 case MWM_DESTORY:
1058 TRACE_EVENT("MWM_DESTROY");
1059 //xreddymn Sep-16-2004: Changes related to MMI-SPR-24735
1060 dspl_Enable(1);
1061 DAL_PostMessage(EMG4_Exit, EMG4_Type_NotUsed, 0, 0);
1062 //xreddymn Aug-16-2004 MMI-SPR-23926 (TII_MMS12) and MMI-SPR-24115 (TII_MMS55): BMI will now use the display
1063 g_M4_display_active=FALSE;
1064 //xrashmic 20 Dec, 2004 MMI-SPR-23921
1065 // On deleting the window, set the handler to NULL
1066 mms_create_hnd=NULL;
1067 break;
1068 case MWM_SUSPEND:
1069 TRACE_EVENT("MWM_SUSPEND");
1070 //xreddymn Sep-16-2004: Changes related to MMI-SPR-24735
1071 dspl_Enable(1);
1072 //xreddymn Aug-16-2004 MMI-SPR-23926 (TII_MMS12) and MMI-SPR-24115 (TII_MMS55): BMI will now use the display
1073 g_M4_display_active=FALSE;
1074 // xreddymn Sep-03-2004 MMI-SPR-23961
1075 DAL_PostMessage(EMG4_Suspend,EMG4_Type_NotUsed,0,NULL);
1076 DAL_PostMessage(EMG4_PlayMode,EMG4_Type_NotUsed, EPlayModeStop,NULL);
1077 //xrashmic 6 Oct, 2004 MMI-SPR-25147
1078 //The editor needs to be in EDIT mode when inserting, Saving, etc.
1079 DAL_PostMessage(EMG4_Edit,EMG4_Type_NotUsed,0,NULL);
1080 break;
1081 case MWM_RESUME:
1082 TRACE_EVENT("MWM_RESUME");
1083 //xreddymn Aug-16-2004 MMI-SPR-23926 (TII_MMS12) and MMI-SPR-24115 (TII_MMS55): M4 client will now use the display
1084 g_M4_display_active=TRUE;
1085 // xreddymn Sep-03-2004 MMI-SPR-23961
1086 // xreddymn Sep-17-2004 MMI-SPR-24733: Removed EMG4_Preview from here as it was disabling edit mode
1087 // xreddymn Sep-17-2004, Removed EMG4_Resume here as it is redundant (See MWM_ONDRAW of this function)
1088 // DAL_PostMessage(EMG4_Preview,EMG4_Type_NotUsed,0,NULL);
1089 // DAL_PostMessage(EMG4_Resume,EMG4_Type_NotUsed,0,NULL);
1090 break;
1091 default:
1092 break;
1093 }
1094 }
1095
1096 // xreddymn Aug-18-2004 MMI-SPR-24113 (TII_MMS53): Delete message handler
1097 ESTATUS Handler_MM_DeleteMessageEntryAsync(EVENT_ID aeId, EVENT_TYPE aeType, MESSAGE_PARAM ampParam, EVT_HANDLE evtHandle)
1098 {
1099 return ENoError;
1100 }
1101
1102 /*******************************************************************************
1103
1104 $Function: MMSCreate_kbd_cb
1105
1106 $Description: Exec callback function for the Option window
1107
1108 $Returns: execution status
1109
1110 $Arguments: e - event id
1111 k - keyboard info
1112 *******************************************************************************/
1113
1114 static int MMSCreate_kbd_cb (MfwEvt e, MfwKbd *k)
1115 /* SmsRead_R_OPT keyboard event handler */
1116 {
1117 T_MFW_HND win = mfwParent(mfw_header());
1118
1119
1120 TRACE_FUNCTION ("MMSCreate_kbd_cb()");
1121
1122 if (e & KEY_LONG)
1123 {
1124 switch (k->code)
1125 {
1126 case KCD_HUP: /* back to previous menu */
1127 //xrashmic 19 Aug, 2004 Bug: 2, 3, 36 and 42
1128 //Once outside the MMS create screen, this flag needs to be unset
1129 MMSactive=FALSE;
1130 /* xreddymn Aug-18-2004 MMI-SPR-24113 (TII_MMS53): Delete message on pressing back,
1131 * if it has not been saved. (Otherwise, it appears in the Unsent messages folder)
1132 */
1133 if(g_M4_message_saved == FALSE)
1134 {
1135 g_event_struct.handler = Handler_MM_DeleteMessageEntryAsync;
1136 g_event_struct.parentEvtHandle = NULL;
1137 g_event_struct.pData = NULL;
1138 g_event_struct.userFlag = 0;
1139 MM_DeleteMessageAsync((EVT_HANDLE) &g_event_struct, g_msg_id);
1140 }
1141 MMI_DestoryWindow(win);
1142 break;
1143 case KCD_RIGHT: /* Power Down */
1144 return MFW_EVENT_REJECTED; /* handled by idle */
1145 default: /* no response to all other keys */
1146 return MFW_EVENT_CONSUMED;
1147 }
1148 }
1149 else
1150 {
1151 switch (k->code)
1152 {
1153 case KCD_MNUSELECT:
1154 case KCD_LEFT:
1155 MMSCreate_OPT_start(win,0);
1156 break;
1157 case KCD_HUP: /* back to previous menu */
1158 case KCD_RIGHT: /* back to previous menu */
1159 //xrashmic 19 Aug, 2004 Bug: 2, 3, 36 and 42
1160 //Once outside the MMS create screen, this flag needs to be unset
1161 MMSactive=FALSE;
1162 /* xreddymn Aug-18-2004 MMI-SPR-24113 (TII_MMS53): Delete message on pressing back,
1163 * if it has not been saved. (Otherwise, it appears in the Unsent messages folder)
1164 */
1165 if(g_M4_message_saved == FALSE)
1166 {
1167 g_event_struct.handler = Handler_MM_DeleteMessageEntryAsync;
1168 g_event_struct.parentEvtHandle = NULL;
1169 g_event_struct.pData = NULL;
1170 g_event_struct.userFlag = 0;
1171 MM_DeleteMessageAsync((EVT_HANDLE) &g_event_struct, g_msg_id);
1172 }
1173 MMI_DestoryWindow(win);
1174 break;
1175 //x0012849 Feb-03-2005 MMI-SPR-28224 :
1176 //Handled the cases of scroll up and down
1177 case KCD_MNUDOWN:
1178 DAL_PostMessage(EMG4_ScrollDown,EMG4_Type_NotUsed,0,NULL);
1179 break;
1180 case KCD_MNUUP :
1181 DAL_PostMessage(EMG4_ScrollUp,EMG4_Type_NotUsed,0,NULL);
1182 break;
1183
1184 default: /* no response to all other keys */
1185 return MFW_EVENT_CONSUMED;
1186 }
1187 }
1188 return MFW_EVENT_CONSUMED;
1189 }
1190
1191
1192 /*******************************************************************************
1193
1194 $Function: MMSCreate_start
1195
1196 $Description: Start the creation of the main window for Create MMS
1197
1198 $Returns: mfw window handler
1199
1200 $Arguments: parent_window - Parent window handler
1201 menuAttr - Menu attributes.
1202
1203 *******************************************************************************/
1204 T_MFW_HND MMSCreate_start(T_MFW_HND parent_window, MfwMnuAttr *menuAttr)
1205 {
1206 TRACE_FUNCTION ("MMSCreate_start()");
1207 //xrashmic 3 Nov, 2004 MMI-SPR-26145
1208 //Storing the handle of the create window to delete later
1209 mms_create_hnd =MMI_CreateWindow(parent_window, (T_DIALOG_FUNC) MMSCreate_exec_cb, (void*)menuAttr,(MfwCb)MMSCreate_kbd_cb, 0,0);
1210 return mms_create_hnd ;
1211 }
1212
1213
1214 #define MMS_SEND_SUBJUCT_NUMBER
1215
1216 static T_MFW_HND editor=NULL;
1217 //CRR: 25302 - xpradipg 10 Nov 2004
1218 //global to hold the number editor handle
1219 static T_MFW_HND number_edit=NULL;
1220 static char number[MAX_PHB_NUM_LEN];
1221 static char topic[MAX_MMS_TOPIC_LEN]="\0";
1222
1223
1224
1225 static void MMSCreate_SEND_edit_cb( T_MFW_HND win, USHORT Identifier,UBYTE reason)
1226 {
1227 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
1228 T_DISPLAY_DATA display_info;
1229 char temp[100];
1230
1231 TRACE_EVENT_P1("MMSCreate_SEND_edit_cb() %d", Identifier);
1232
1233
1234 switch (reason)
1235 {
1236 case INFO_KCD_LEFT: // confirm (press LEFT soft key)
1237 if (Identifier==E_MODE_TOPIC)
1238 {
1239 // subject input
1240 TRACE_EVENT_P1("topic: %s",topic);
1241 SEND_EVENT(win,E_MODE_NUMBER, 0, 0);
1242 // wait for getting number (below) and do it all together.
1243 }
1244 else if (Identifier==E_MODE_NUMBER)
1245 {
1246 // phone number input
1247 TRACE_EVENT_P2("topic: %s, number: %s",topic,number);
1248
1249 //yanbin: Call magic4 function to send MMS, bbssoo - send MMS with the topic (subject) and number, then save the MMS.
1250 //topic: topic;
1251 //number: number;
1252
1253 M4_DebugMessage(0x93000);
1254
1255 //xrashmic 19 Aug, 2004 Bug: 2, 3, 36 and 42
1256 //This dialog screen is displayed as soon as the user selects the left softkey after entering the number to start sending MMS
1257 //xrashmic 08 Feb, 2005 MMI-SPR-27853
1258 AUI_mms_status_notify(MMS_PLEASEWAIT);
1259 MMI_2_SaveHeaderInfo(topic,number);
1260
1261 DAL_PostMessage(EMG4_SaveMsg, EMG4_Type_NotUsed, 0, 0);
1262 //DAL_PostMessage(EMG4_Exit,EMG4_Type_NotUsed,0,NULL);
1263
1264 g_inSendMode=TRUE;
1265
1266 M4_DebugMessage(0x93001);
1267 MMI_DestoryWindow(win);
1268 //CRR: 25302 - xpradipg 10 Nov 2004
1269 //Number entry editor needs to be deleted explicitly
1270 AUI_edit_Destroy(number_edit);
1271 }
1272 else
1273 {
1274 TRACE_EVENT_P1("text: %s",text);
1275 M4_DebugMessage(0x92000);
1276 // rvf_delay(10);
1277 g_safeString.size=2*(strlen(text)+1);
1278 MMS_ConvertStringToUcs2((const MByte *)(text), strlen(text), g_insertString);
1279 g_safeString.pString=g_insertString;
1280 DAL_PostMessage(EMG4_Edit,EMG4_Type_NotUsed,0,NULL);
1281 //xrashmic 9 Nov, 2004 MMI-SPR-26147
1282 //Text in the MMS message needs to be deleted, before inserting the edited text.
1283 DAL_PostMessage(EMG4_DeleteObject,EMG4_Type_NotUsed, EDeleteText,NULL);
1284 DAL_PostMessage(EMG4_InsertString, EMG4_Type_NotUsed, (MESSAGE_PARAM)&g_safeString, 0);
1285 // M4_DebugMessage(g_safeString.size);
1286 M4_DebugMessage(0x92001);
1287
1288 // rvf_delay(10);
1289 MMI_DestoryWindow(win);
1290 //yanbin: Call magic4 function to insert text into MMS
1291 //text: text;
1292 // bbssoo - insert string to MMS message.
1293 }
1294 break;
1295 //CRR: 25302 - xpradipg 10 Nov 2004
1296 //the alternate left softkey event is handled for the number entry screen
1297 case INFO_KCD_ALTERNATELEFT:
1298 bookPhonebookStart(win, PhbkFromMms);
1299 break;
1300 case INFO_KCD_RIGHT:
1301 case INFO_KCD_HUP:
1302 //CRR: 25302 - xpradipg 10 Nov 2004
1303 //The number editor needs to be explicitly destroyed on pressing back sk
1304 if(E_MODE_NUMBER == Identifier)
1305 AUI_edit_Destroy(number_edit);
1306 MMI_DestoryWindow(win);
1307 break;
1308 default:
1309 TRACE_EVENT("Err: Default");
1310 break;
1311 }
1312 }
1313
1314 // Nov 05, 2005 REF: OMAPS00049502 Sumanth Kumar. C
1315 // Fix: A global variable to store the Mms Number extracted from the message header.
1316 char MmsNumber[MAX_PHB_NUM_LEN];
1317
1318 /*******************************************************************************
1319
1320 $Function: MMSCreate_SEND_exec_cb
1321
1322 $Description: Callback handler for events sent by the window itself and to recieve the data
1323
1324 $Returns: none
1325
1326 $Arguments: win - current window
1327 event - event id
1328 Identifier - optional data
1329 parameter - optional data.
1330 *******************************************************************************/
1331
1332 static void MMSCreate_SEND_exec_cb(T_MFW_HND win, USHORT event, USHORT Identifier,void *parameter)
1333 {
1334 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
1335 T_AUI_EDITOR_DATA editor_data;
1336
1337 TRACE_FUNCTION ("MMSCreate_SEND_exec_cb()");
1338
1339 switch (event)
1340 {
1341 case MWM_CREATE:
1342 break;
1343 case E_MODE_TOPIC:
1344
1345 AUI_edit_SetDefault(&editor_data);
1346 AUI_edit_SetDisplay(&editor_data, ZONE_FULL_SK_TITLE_SCROLL, COLOUR_EDITOR, EDITOR_FONT);
1347 AUI_edit_SetEvents(&editor_data, E_MODE_TOPIC, TRUE, FOREVER, (T_AUI_EDIT_CB)MMSCreate_SEND_edit_cb);
1348 AUI_edit_SetTextStr(&editor_data, TxtSoftOK, TxtDelete, TxtTopics, NULL);
1349 AUI_edit_SetAltTextStr(&editor_data, 0, NULL, TRUE, TxtSoftBack);
1350 AUI_edit_SetMode(&editor_data,ED_MODE_ALPHA, ED_CURSOR_UNDERLINE);
1351 //void AUI_edit_SetBuffer(T_AUI_EDITOR_DATA *editor_data, UBYTE dcs, UBYTE *text, USHORT size)
1352 //void AUI_edit_SetBuffer(T_AUI_EDITOR_DATA *editor_data, UBYTE dcs, UBYTE *text, USHORT size);
1353 AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII,(UBYTE*) topic, sizeof(topic));
1354 editor = AUI_edit_Start(win, &editor_data);
1355
1356
1357 break;
1358 case E_MODE_NUMBER:
1359
1360 TRACE_EVENT("enter number");
1361 //CRR: 23942 - xpradipg 26 Aug 2004
1362 //comment the hardcoded string. This will display an empty number editor.
1363 //strcpy(number,"01705713488");//"13816687053");//13801639314
1364 //strcpy(number,"+38516610401");
1365 //CRR: 25302 - xpradipg 10 Nov 2004
1366 // The editor attributes are changed to hold alternate strings
1367 AUI_edit_SetDefault(&editor_data);
1368 AUI_edit_SetDisplay(&editor_data, PHNO_EDITOR, COLOUR_EDITOR_XX, EDITOR_FONT);
1369 AUI_edit_SetEvents(&editor_data, E_MODE_NUMBER, FALSE, FOREVER, (T_AUI_EDIT_CB)MMSCreate_SEND_edit_cb);
1370 AUI_edit_SetTextStr(&editor_data, TxtSend, TxtDelete, TxtSmsEnterNumber, NULL);
1371 AUI_edit_SetAltTextStr(&editor_data, 1, TxtNames, TRUE, TxtSoftBack);
1372 AUI_edit_SetMode(&editor_data,0, ED_CURSOR_UNDERLINE);
1373 memset(number,'\0', sizeof(number));
1374
1375 //Nov 05, 2005 REF: OMAPS00049502 Sumanth Kumar. C
1376 //Fix: Get only the 13digits corresponding to the senders phone number from the senders address
1377 strncpy(number,MmsNumber,13);
1378
1379 AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, (UBYTE*)number, sizeof(number));
1380 number_edit = AUI_edit_Start(win, &editor_data);
1381 break;
1382 case E_MODE_TEXT:
1383 TRACE_EVENT("enter text");
1384 AUI_edit_SetDefault(&editor_data);
1385 AUI_edit_SetDisplay(&editor_data, ZONE_FULL_SK_TITLE_SCROLL, COLOUR_EDITOR, EDITOR_FONT);
1386 AUI_edit_SetEvents(&editor_data, E_MODE_TEXT, TRUE, FOREVER, (T_AUI_EDIT_CB)MMSCreate_SEND_edit_cb);
1387 AUI_edit_SetTextStr(&editor_data, TxtSoftOK, TxtDelete, TxtMessage, NULL);
1388 AUI_edit_SetAltTextStr(&editor_data, 0, NULL, TRUE, TxtSoftBack);
1389 AUI_edit_SetMode(&editor_data,ED_MODE_ALPHA, ED_CURSOR_UNDERLINE);
1390 //CRR: 23942 - xpradipg 26 Aug 2004
1391 //reset the text buffer
1392 //xrashmic 9 Nov, 2004 MMI-SPR-26147
1393 //Moved it to MMCreate_exec_cb MWM_CREATE as the user should be able to edit the inserted text. Hence we need to
1394 // retain the data in "text" buffer.
1395 //memset(text,'\0',MAX_MMS_TEXT_LEN);
1396 AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, (UBYTE*)text, sizeof(text));
1397 editor = AUI_edit_Start(win, &editor_data);
1398
1399 break;
1400 // case PHBK_ID:
1401 //CRR: 25302 - xpradipg 10 Nov 2004
1402 //handle the even sent back by the phone number module
1403 case MMS_EMS_PHBK_NUMBER:
1404 MmsSend_PHBK_exec_cb(number_edit, event, parameter);
1405 break;
1406 case MWM_ONDRAW:
1407 break;
1408 case MWM_DESTORY:
1409 break;
1410 default:
1411 TRACE_EVENT("Err: Default");
1412 break;
1413 }
1414 }
1415
1416
1417 /*******************************************************************************
1418
1419 $Function: MMSCreate_SEND_start
1420
1421 $Description: Create SMS send window
1422
1423 $Returns: execution status
1424
1425 $Arguments: parent_window - parent window.
1426 UserData - SMS data
1427 *******************************************************************************/
1428
1429 T_MFW_HND MMSCreate_SEND_start(T_MFW_HND parent_window, void *UserData)
1430 {
1431 T_MFW_HND win;
1432 TRACE_FUNCTION ("MMSCreate_SEND_start()");
1433 win=MMI_CreateWindow(parent_window, (T_DIALOG_FUNC) MMSCreate_SEND_exec_cb, (void*)UserData,0, 0,0);
1434 if(UserData) SEND_EVENT(win, (USHORT)UserData, 0, 0);
1435 return win;
1436 }
1437
1438 //CRR:23923 - xpradipg 06 Sept 2004
1439 /*******************************************************************************
1440
1441 $Function: MMSCreate_Prev_exec_cb
1442
1443 $Description: Callback handler for events sent by the window itself
1444
1445 $Returns: none
1446
1447 $Arguments: win - current window
1448 event - event id
1449 parameter - optional data.
1450 *******************************************************************************/
1451
1452 void MMSCreate_Prev_exec_cb(T_MFW_HND win, USHORT event, SHORT value, void * parameter)
1453 /* callback handler for events sent to to trigger execution */
1454 {
1455 TRACE_FUNCTION ("MMSBox_read_exec_cb()");
1456
1457 switch (event)
1458 {
1459 case MWM_CREATE:
1460 g_M4_display_active = TRUE;
1461 break;
1462 case MWM_ONDRAW:
1463 dspl_Enable(0);
1464 dspl_SetBgdColour(COL_White);
1465 dspl_ClearAll();
1466 DAL_PostMessage(EMG4_Resume,EMG4_Type_NotUsed,0,NULL);
1467 //xrashmic 6 Oct, 2004 MMI-SPR-25147
1468 //EMG4_Preview does not require any EPlayModeRun.
1469 DAL_PostMessage(EMG4_Preview, EMG4_Type_NotUsed, 0, 0);
1470 displaySoftKeys(TxtNull,TxtSoftBack);
1471 dspl_Enable(1);
1472 break;
1473 case MWM_DESTORY:
1474 DAL_PostMessage(EMG4_Suspend,EMG4_Type_NotUsed,0,NULL);
1475 //xrashmic 6 Oct, 2004 MMI-SPR-25147
1476 //Exiting the Preview screen, the editor should be in editable mode.
1477 DAL_PostMessage(EMG4_Edit,EMG4_Type_NotUsed,0,NULL);
1478 g_M4_display_active=FALSE;
1479 break;
1480 case MWM_SUSPEND:
1481 g_M4_display_active=FALSE;
1482 DAL_PostMessage(EMG4_Suspend,EMG4_Type_NotUsed,0,NULL);
1483 DAL_PostMessage(EMG4_Preview,EMG4_Type_NotUsed, EPlayModeStop,NULL);
1484 break;
1485 case MWM_RESUME:
1486 g_M4_display_active=TRUE;
1487 DAL_PostMessage(EMG4_Resume,EMG4_Type_NotUsed,0,NULL);
1488 DAL_PostMessage(EMG4_Refresh, EMG4_Type_NotUsed, 0, 0);
1489 break;
1490 default:
1491 break;
1492 }
1493 }
1494
1495 //CRR:23923 - xpradipg 06 Sept 2004
1496 /*******************************************************************************
1497
1498 $Function: MMSCreate_Prev_start
1499
1500 $Description: Create Preview window
1501
1502 $Returns: window handler
1503
1504 $Arguments: parent_window - parent window.
1505 menuAttr - Menu attributes
1506 *******************************************************************************/
1507
1508 T_MFW_HND MMSCreate_Prev_start(T_MFW_HND parent_window, MfwMnuAttr *menuAttr)
1509 {
1510 return MMI_CreateWindow(parent_window, (T_DIALOG_FUNC)MMSCreate_Prev_exec_cb,(void*)menuAttr,(T_MFW_CB)MMSBox_Read_kbd_cb,0,0);
1511 }
1512
1513 #define MMS_CREATE_OPTION
1514 /*******************************************************************************
1515
1516 $Function: MMSCreate_OPTexeSend
1517
1518 $Description: Called when the user press send in the Option menu
1519
1520 $Returns: event status.
1521
1522 $Arguments: m - pointer to menu.
1523 i - index if selected menu item.
1524 *******************************************************************************/
1525 static int MMSCreate_OPTexeSend(MfwMnu* m, MfwMnuItem* i)
1526 {
1527 T_MFW_HND win = mfwParent(mfw_header());
1528 MMSCreate_SEND_start(win, (void*)E_MODE_TOPIC);
1529 }
1530
1531 //CRR:23923 - xpradipg 06 Sept 2004
1532 /*******************************************************************************
1533
1534 $Function: MMSCreate_OPTpreviewMsg
1535
1536 $Description: Called when the user press Preview in the Option menu
1537
1538 $Returns: event status.
1539
1540 $Arguments: m - pointer to menu.
1541 i - index if selected menu item.
1542 *******************************************************************************/
1543 static int MMSCreate_OPTpreviewMsg(MfwMnu* m, MfwMnuItem* i)
1544 {
1545 T_MFW_HND win = mfwParent(mfw_header());
1546
1547 MMSCreate_Prev_start(win,NULL);
1548 }
1549 static int MMSCreate_OPTexeInsPicture(MfwMnu* m, MfwMnuItem* i)
1550 {
1551 T_MFW_HND win = mfwParent(mfw_header());
1552 MMSom_start(win, (MfwMnuAttr *) MMS_INSERT_PICTURE);
1553 }
1554
1555 static int MMSCreate_OPTexeInsSound(MfwMnu* m, MfwMnuItem* i)
1556 {
1557 T_MFW_HND win = mfwParent(mfw_header());
1558 MMSom_start(win, (MfwMnuAttr *) MMS_INSERT_SOUND);
1559 }
1560
1561 static int MMSCreate_OPTexeInsText(MfwMnu* m, MfwMnuItem* i)
1562 {
1563 T_MFW_HND win = mfwParent(mfw_header());
1564 MMSCreate_SEND_start(win, (void*)E_MODE_TEXT);
1565 }
1566 static int MMSCreate_OPTexeSave(MfwMnu* m, MfwMnuItem* i)
1567 {
1568
1569 //xrashmic 6 Oct, 2004 MMI-SPR-25147
1570 //The Messages are saved only in EDIT mode.
1571 DAL_PostMessage(EMG4_Edit,EMG4_Type_NotUsed,0,NULL);
1572 DAL_PostMessage(EMG4_SaveMsg, EMG4_Type_NotUsed, 0, 0);
1573
1574 //xreddymn Aug-18-2004 MMI-SPR-24113 (TII_MMS53): To keep track of saved messages
1575 g_inSaveMode=TRUE;
1576
1577 // xreddymn Nov-26-2004 MMI-SPR-25278: Display an "In Progress" screen
1578 //xrashmic 08 Feb, 2005 MMI-SPR-27853
1579 //Added few more parameters for this function
1580 g_inSaveModeWin=information_dialog(TxtPleaseWait,TxtNull,NULL,NULL, TxtNull,TxtNull,FOREVER,0,NULL);
1581
1582 }
1583 static int MMSCreate_OPTexeInsSlide(MfwMnu* m, MfwMnuItem* i)
1584 {
1585 TRACE_EVENT("insert pic into OM");
1586 M4_InsertPicObjectIntoOM();
1587 }
1588
1589 //CRR: 25302 - xpradipg 10 Nov 2004
1590 /*******************************************************************************
1591
1592 $Function: MmsSend_PHBK_exec_cb
1593
1594 $Description: Populates the text structure with the phone Number and sends
1595 an event to update the editor buffer
1596
1597 $Returns:
1598
1599 $Arguments:
1600 *******************************************************************************/
1601 void MmsSend_PHBK_exec_cb(T_MFW_HND win, USHORT event, void *parameter)
1602 {
1603 #ifdef NEW_EDITOR
1604 T_ATB_TEXT text; /* Used to insert phone numbers into editors */
1605 #endif
1606
1607 TRACE_FUNCTION ("MmsSend_PHBK_exec_cb()");
1608
1609 switch (event)
1610 {
1611 /* SPR#1428 - SH - New Editor changes. Insert phone number into editor */
1612 #ifdef NEW_EDITOR
1613 case MMS_EMS_PHBK_NUMBER: /* Service centre number */
1614 text.dcs = ATB_DCS_ASCII;
1615 text.len = strlen((char *)parameter);
1616 text.data = (UBYTE *)parameter;
1617 SEND_EVENT(number_edit, E_ED_INSERT, 0, (void *)&text);
1618 break;
1619 #endif /* NEW_EDITOR */
1620 break;
1621 default:
1622 TRACE_EVENT("Err: Default");
1623 break;
1624 }
1625 }
1626
1627
1628 /*******************************************************************************
1629
1630 $Function: MMSCreate_OPT_exec_cb
1631
1632 $Description: Exec callback function for the Option window
1633
1634 $Returns: none
1635
1636 $Arguments: win - current window
1637 event - event id
1638 value - unique id
1639 parameter - optional data.
1640
1641 *******************************************************************************/
1642
1643 void MMSCreate_OPT_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
1644 /* callback handler for events sent to to trigger execution */
1645 {
1646 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
1647 TRACE_FUNCTION ("MMSCreate_OPT_exec_cb()");
1648 switch (event)
1649 {
1650 case MWM_CREATE:
1651 TRACE_EVENT("MWM_CREATE");
1652 /* initialization of administrative data */
1653 winShow(win);
1654 break;
1655 case MWM_ONDRAW:
1656 dspl_ClearAll();
1657 displaySoftKeys(TxtSoftOK,TxtSoftBack);
1658 break;
1659 case MWM_DESTORY:
1660 //xrashmic 20 Dec, 2004 MMI-SPR-23921
1661 // On deleting the window, set the handler to NULL
1662 mms_create_opt_hnd=NULL;
1663 break;
1664 default:
1665 return;
1666 }
1667 }
1668
1669 /*******************************************************************************
1670
1671 $Function: MMSCreate_OPT_start
1672
1673 $Description: Start the creation of the main window for Create MMS
1674
1675 $Returns: mfw window handler
1676
1677 $Arguments: parent_window - Parent window handler
1678 menuAttr - Menu attributes.
1679
1680 *******************************************************************************/
1681 T_MFW_HND MMSCreate_OPT_start(T_MFW_HND parent_window, MfwMnuAttr *menuAttr)
1682 {
1683 TRACE_FUNCTION ("MMSCreate_OPT_start()");
1684 //xrashmic 3 Nov, 2004 MMI-SPR-26145
1685 //Storing the handle of the options window to delete later
1686 mms_create_opt_hnd = MMI_CreateWindow(parent_window, (T_DIALOG_FUNC)MMSCreate_OPT_exec_cb,(void*)menuAttr, (T_MFW_CB)0, &MMSCreate_OPTAttrib,0);
1687 return mms_create_opt_hnd;
1688 }
1689
1690 #define MMS_DELETE_PICTURE 0
1691 #define MMS_DELETE_SOUND 1
1692 #define MMS_DELETE_TEXT 2
1693
1694 static void MMSCreate_Delete_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason)
1695 {
1696 TRACE_FUNCTION("MMSCreate_Delete_cb");
1697
1698 switch (reason)
1699 {
1700 case INFO_KCD_LEFT:
1701 switch(identifier)
1702 {
1703 case MMS_DELETE_PICTURE:
1704 DAL_PostMessage(EMG4_Edit,EMG4_Type_NotUsed,0,NULL);
1705 DAL_PostMessage(EMG4_DeleteObject,EMG4_Type_NotUsed, EDeleteImage,NULL);
1706 break;
1707 case MMS_DELETE_SOUND:
1708 DAL_PostMessage(EMG4_Edit,EMG4_Type_NotUsed,0,NULL);
1709 DAL_PostMessage(EMG4_DeleteObject,EMG4_Type_NotUsed, EDeleteAudio,NULL);
1710 break;
1711 case MMS_DELETE_TEXT:
1712 DAL_PostMessage(EMG4_Edit,EMG4_Type_NotUsed,0,NULL);
1713 DAL_PostMessage(EMG4_DeleteObject,EMG4_Type_NotUsed, EDeleteText,NULL);
1714 //xrashmic 9 Nov, 2004 MMI-SPR-26147
1715 //The text buffer should be reset when the text data
1716 //is deleted in the MMS message
1717 memset(text,'\0',MAX_MMS_TEXT_LEN);
1718 break;
1719 }
1720 MMI_DestoryWindow(win);
1721 break;
1722 case INFO_KCD_HUP:
1723 case INFO_KCD_RIGHT:
1724 case INFO_KCD_CLEAR:
1725 MMI_DestoryWindow(win);
1726 break;
1727 default:
1728 break;
1729 }
1730 }
1731 static int MMSCreate_OPTexeDelPicture(MfwMnu* m, MfwMnuItem* i)
1732 {
1733 T_MFW_HND win = mfwParent(mfw_header());
1734 T_DISPLAY_DATA display_info;
1735 dlg_initDisplayData_TextId( &display_info, TxtSoftOK, TxtSoftBack, TxtPressOk, TxtDelete, COLOUR_STATUS);
1736 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)MMSCreate_Delete_cb, FOREVER, KEY_LEFT |KEY_RIGHT|KEY_CLEAR|KEY_HUP);
1737 display_info.Identifier=MMS_DELETE_PICTURE;
1738 info_dialog (win, &display_info);
1739 }
1740 static int MMSCreate_OPTexeDelSound(MfwMnu* m, MfwMnuItem* i)
1741 {
1742 T_MFW_HND win = mfwParent(mfw_header());
1743 T_DISPLAY_DATA display_info;
1744 dlg_initDisplayData_TextId( &display_info, TxtSoftOK, TxtSoftBack, TxtPressOk, TxtDelete, COLOUR_STATUS);
1745 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)MMSCreate_Delete_cb, FOREVER, KEY_LEFT |KEY_RIGHT|KEY_CLEAR|KEY_HUP);
1746 display_info.Identifier=MMS_DELETE_SOUND;
1747 info_dialog (win, &display_info);
1748 }
1749 static int MMSCreate_OPTexeDelText(MfwMnu* m, MfwMnuItem* i)
1750 {
1751 T_MFW_HND win = mfwParent(mfw_header());
1752 T_DISPLAY_DATA display_info;
1753 dlg_initDisplayData_TextId( &display_info, TxtSoftOK, TxtSoftBack, TxtPressOk, TxtDelete, COLOUR_STATUS);
1754 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)MMSCreate_Delete_cb, FOREVER, KEY_LEFT |KEY_RIGHT|KEY_CLEAR|KEY_HUP);
1755 display_info.Identifier=MMS_DELETE_TEXT;
1756 info_dialog (win, &display_info);
1757 }
1758
1759 void FUN_TRACE_EVENT(char * text, unsigned long param)
1760 {
1761 TRACE_EVENT_P1(text, param);
1762 }
1763
1764
1765 /*******************************************************************************
1766 $Function: Handler_Fwd_CreateMessageEntryAsync
1767
1768 $Description: Callback function for MM_CreateMessageEntryAsync for forward.
1769 //xrashmic 14 Dec, 2004 MMI-SPR-23921
1770
1771 $Returns: None.
1772
1773 $Arguments:
1774 *******************************************************************************/
1775
1776 ESTATUS Handler_Fwd_CreateMessageEntryAsync(EVENT_ID aeId, EVENT_TYPE aeType, MESSAGE_PARAM ampParam, EVT_HANDLE evtHandle)
1777 {
1778 ESTATUS eResult;
1779 //Using the same create editor event handler for forward editor
1780 g_doc_event_struct.handler = MMI_1_EventHandler;
1781 g_doc_event_struct.parentEvtHandle = NULL;
1782 g_doc_event_struct.pData = NULL;
1783 g_doc_event_struct.userFlag = 0;
1784 g_msg_id= (MM_MESSAGE_ID) ampParam;
1785 eResult = DAL_OpenDocument((EVT_HANDLE) &g_doc_event_struct, g_pMessageHeaderList->ppList[g_currentMessage].id, g_msg_id);
1786 }
1787
1788 /*******************************************************************************
1789
1790 $Function: MMSBox_Forward
1791
1792 $Description: Creating a new Id for the MMS message being forwarded
1793 //xrashmic 14 Dec, 2004 MMI-SPR-23921
1794
1795 $Returns: None.
1796
1797 $Arguments:
1798 *******************************************************************************/
1799 void MMSBox_Forward(void)
1800 {
1801 ESTATUS eResult;
1802 MDword MessageID = g_pMessageHeaderList->ppList[g_currentMessage].id;
1803 TRACE_FUNCTION ("MMSBox_Forward()");
1804 eResult = DAL_RetrieveMessageHeader(MessageID,&fwd_msg_header);
1805 fwd_msg_header->location = EMlDraft;
1806 g_event_struct.handler = Handler_Fwd_CreateMessageEntryAsync;
1807 g_event_struct.parentEvtHandle = NULL;
1808 g_event_struct.pData = NULL;
1809 g_event_struct.userFlag = 0;
1810 eResult=MM_CreateMessageEntryAsync((EVT_HANDLE) &g_event_struct, fwd_msg_header);
1811 g_safeString.memHeader.freeFunc = DummyFreeFunc; /*!< Pointer to memory deallocation function */
1812 g_safeString.size=10; /*!< size of the string */
1813 g_safeString.pString=g_insertString; /*!< Pointer to UCS2 string */
1814
1815 }
1816
1817 /*******************************************************************************
1818
1819 $Function: MMSFwd_exec_cb
1820
1821 $Description: Event handler for the MMS forward window
1822 //xrashmic 14 Dec, 2004 MMI-SPR-23921
1823
1824 $Returns: None.
1825
1826 $Arguments:
1827 *******************************************************************************/
1828
1829 void MMSFwd_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
1830 /* callback handler for events sent to to trigger execution */
1831 {
1832 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
1833
1834 TRACE_FUNCTION ("MMSFwd_exec_cb()");
1835
1836 switch (event)
1837 {
1838 case MWM_CREATE:
1839 //xrashmic 14 Dec, 2004 MMI-SPR-23921
1840 // Create a new Msg ID, Open the editor and copy the message being forwarded, into this editor.
1841 MMSBox_Forward();
1842 //xrashmic 9 Nov, 2004 MMI-SPR-26147
1843 //The text buffer is memset to '\0' only once at the time of MMS create - MWM_CREATE
1844 memset(text,'\0',MAX_MMS_TEXT_LEN);
1845 g_M4_display_active=TRUE;
1846 // xreddymn Feb-02-2005 MMI-SPR-28277: This is set to TRUE when forwarding MMS messages
1847 gMmsForwardStart=TRUE;
1848 break;
1849 case MWM_ONDRAW:
1850 TRACE_EVENT("MWM_ONDRAW");
1851 dspl_Enable(0);
1852 {
1853 unsigned short width, height;
1854 DeviceGetScreenMetrics(&width,&height);
1855 dspl_SetBgdColour(COL_White);
1856 dspl_Clear(0, gucMmsTitleBarHeight, width-1, height-1);
1857 resources_setTitleColour(COLOUR_EDITOR);
1858 dspl_Clear(0, 0, width-1, gucMmsTitleBarHeight-1);
1859 dspl_TextOut(1, 0, DSPL_TXTATTR_HLIGHT,"Forwarding MMS");
1860 }
1861
1862 //yanbin: here call Magic4 functions to show MMS slides
1863 // bbssoo - After Creating MMS, display the "create MMS display" in the middle screen.
1864 // xreddymn Mar-08-2005 MMI-SPR-28820: changed order of posting
1865 // EMG4_Preview and EMG4_Resume.
1866 // When forwarding MMS, the first Preview-Resume occurs
1867 // through the callback MMI_1_EventHandler
1868 if(FALSE == gMmsForwardStart)
1869 {
1870 action_PreviewMessage();
1871 action_ResumeEditor();
1872 }
1873 //xrashmic 6 Oct, 2004 MMI-SPR-25147
1874 //comenting action_SuspendEditor() as the Sound was not heard in the
1875 //compose screen
1876 //action_SuspendEditor();
1877 displaySoftKeys(TxtSoftOptions,TxtSoftBack);
1878 dspl_Enable(1);
1879 break;
1880 case MWM_DESTORY:
1881 TRACE_EVENT("MWM_DESTROY");
1882 //xreddymn Sep-16-2004: Changes related to MMI-SPR-24735
1883 dspl_Enable(1);
1884 DAL_PostMessage(EMG4_Exit, EMG4_Type_NotUsed, 0, 0);
1885 //xreddymn Aug-16-2004 MMI-SPR-23926 (TII_MMS12) and MMI-SPR-24115 (TII_MMS55): BMI will now use the display
1886 g_M4_display_active=FALSE;
1887 //xrashmic 20 Dec, 2004 MMI-SPR-23921
1888 // On deleting the window, set the handler to NULL
1889 mms_Fwdcreate_hnd=NULL;
1890 break;
1891 case MWM_SUSPEND:
1892 TRACE_EVENT("MWM_SUSPEND");
1893 //xreddymn Sep-16-2004: Changes related to MMI-SPR-24735
1894 dspl_Enable(1);
1895 //xreddymn Aug-16-2004 MMI-SPR-23926 (TII_MMS12) and MMI-SPR-24115 (TII_MMS55): BMI will now use the display
1896 g_M4_display_active=FALSE;
1897 // xreddymn Sep-03-2004 MMI-SPR-23961
1898 DAL_PostMessage(EMG4_Suspend,EMG4_Type_NotUsed,0,NULL);
1899 DAL_PostMessage(EMG4_PlayMode,EMG4_Type_NotUsed, EPlayModeStop,NULL);
1900 //xrashmic 6 Oct, 2004 MMI-SPR-25147
1901 //The editor needs to be in EDIT mode when inserting, Saving, etc.
1902 DAL_PostMessage(EMG4_Edit,EMG4_Type_NotUsed,0,NULL);
1903 break;
1904 case MWM_RESUME:
1905 TRACE_EVENT("MWM_RESUME");
1906 //xreddymn Aug-16-2004: M4 client will now use the display
1907 g_M4_display_active=TRUE;
1908 break;
1909 default:
1910 break;
1911 }
1912 }
1913
1914
1915 /*******************************************************************************
1916
1917 $Function: MMSFwd_kbd_cb
1918
1919 $Description: Keyboard handler for the MMS forward window
1920 //xrashmic 14 Dec, 2004 MMI-SPR-23921
1921
1922 $Returns: None.
1923
1924 $Arguments:
1925 *******************************************************************************/
1926
1927 static int MMSFwd_kbd_cb (MfwEvt e, MfwKbd *k)
1928 {
1929 T_MFW_HND win = mfwParent(mfw_header());
1930 TRACE_FUNCTION ("MMSFwd_kbd_cb()");
1931 if (e & KEY_LONG)
1932 {
1933 switch (k->code)
1934 {
1935 case KCD_HUP: /* back to previous menu */
1936 //xrashmic 19 Aug, 2004 Bug: 2, 3, 36 and 42
1937 //Once outside the MMS create screen, this flag needs to be unset
1938 MMSactive=FALSE;
1939 if(g_M4_message_saved == FALSE)
1940 {
1941 g_event_struct.handler = Handler_MM_DeleteMessageEntryAsync;
1942 g_event_struct.parentEvtHandle = NULL;
1943 g_event_struct.pData = NULL;
1944 g_event_struct.userFlag = 0;
1945 MM_DeleteMessageAsync((EVT_HANDLE) &g_event_struct, g_msg_id);
1946 }
1947 MMI_DestoryWindow(win);
1948 break;
1949 case KCD_RIGHT: /* Power Down */
1950 return MFW_EVENT_REJECTED; /* handled by idle */
1951 default: /* no response to all other keys */
1952 return MFW_EVENT_CONSUMED;
1953 }
1954 }
1955 else
1956 {
1957 switch (k->code)
1958 {
1959 case KCD_MNUSELECT:
1960 case KCD_LEFT:
1961 MMSCreate_OPT_start(win,0);
1962 break;
1963 case KCD_HUP: /* back to previous menu */
1964 case KCD_RIGHT: /* back to previous menu */
1965 //xrashmic 19 Aug, 2004 Bug: 2, 3, 36 and 42
1966 //Once outside the MMS create screen, this flag needs to be unset
1967 MMSactive=FALSE;
1968 if(g_M4_message_saved == FALSE)
1969 {
1970 g_event_struct.handler = Handler_MM_DeleteMessageEntryAsync;
1971 g_event_struct.parentEvtHandle = NULL;
1972 g_event_struct.pData = NULL;
1973 g_event_struct.userFlag = 0;
1974 MM_DeleteMessageAsync((EVT_HANDLE) &g_event_struct, g_msg_id);
1975 }
1976 MMI_DestoryWindow(win);
1977 break;
1978 case KCD_MNUUP:
1979 //x0012849 Feb-03-2005 MMI-SPR-28224
1980 //send the scrollup event to see the contents above the screen
1981 DAL_PostMessage(EMG4_ScrollUp,EMG4_Type_NotUsed,0,NULL);
1982 break;
1983 case KCD_MNUDOWN:
1984 //x0012849 Feb-03-2005 MMI-SPR-28224
1985 //send the scrolldown event to see the contents below the screen
1986 DAL_PostMessage(EMG4_ScrollDown,EMG4_Type_NotUsed,0,NULL);
1987 break;
1988 case KCD_MNULEFT:
1989 case KCD_MNURIGHT:
1990
1991 break;
1992 return MFW_EVENT_CONSUMED;
1993 }
1994 }
1995 return MFW_EVENT_CONSUMED;
1996 }
1997
1998 /*******************************************************************************
1999
2000 $Function: MMSFwd_start
2001
2002 $Description: Creates Forward window for the selected MMS.
2003 //xrashmic 14 Dec, 2004 MMI-SPR-23921
2004
2005 $Returns: None.
2006
2007 $Arguments:
2008 *******************************************************************************/
2009
2010 T_MFW_HND MMSFwd_start(void)
2011 {
2012 T_MFW_HND win = mfwParent(mfw_header());
2013 TRACE_FUNCTION ("MMSCreate_start()");
2014 mms_Fwdcreate_hnd=MMI_CreateWindow(win, (T_DIALOG_FUNC) MMSFwd_exec_cb, NULL,(MfwCb)MMSFwd_kbd_cb, 0,0);
2015 return mms_Fwdcreate_hnd;
2016 }
2017
2018
2019 #undef MMI_MMSCREATE_C
2020