FreeCalypso > hg > fc-magnetite
comparison src/aci2/bmi/mmiMmsBox.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/mmimmsbox.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: mmimmsbox.h | |
17 $Revision: 1.0 | |
18 | |
19 $Author: Yan Bin(bin-yan@ti.com) | |
20 $Date: 28/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: MmiMmsBox.c | |
32 | |
33 xrashmic 23 Nov, 2005 MMI-SPR-OMAPS00047637 | |
34 Play mms error restart rectified. Removing unwanted screens in the callback of the "New mms" | |
35 dialog screen. | |
36 xrashmic 29 Nov, 2005 MMI-SPR-OMAPS00050170 | |
37 Changed from static allocations for g_mmstopic and g_mmsstatus to dynamic allocation. | |
38 | |
39 Nov 05, 2005 REF: OMAPS00049502 Sumanth Kumar. C | |
40 Description: MMS: During MMS Reply, Enter Number shows Empty. | |
41 Solution: Senders number is extracted from the Message Header and is displayed. | |
42 | |
43 Nov 02, 2005 REF:ER OMAPS00039044 xdeepadh | |
44 Description: Mp3 Ringer Implementation | |
45 Solution: The Midi Ringer application has been enhanced to support mp3 as ringer. | |
46 The interface function names have been modified. | |
47 | |
48 May 11 2005 REF: MMI-SPR-29887 x0012849 | |
49 To Implement the deferred MMS retrieval. | |
50 Apr 07 2005 REF: MMI-SPR-27826 x0012849 | |
51 To avoid crash when a user replies to the MMS which is there in Inbox | |
52 | |
53 xrashmic 08 Feb, 2005 MMI-SPR-27853 | |
54 Added more parameters to the information_dialog function | |
55 | |
56 Apr 05, 2005 REF: ENH 29994 xdeepadh | |
57 Description: Implementation of Generic Midi Ringer and Modification of existing Midi Test Application | |
58 Solution: Generic Midi Ringer and Midi Test Application were implemented. | |
59 | |
60 xreddymn Jan-31-2004 MMI-SPR-28483: Support for MIDI objects | |
61 | |
62 x0012849 Feb-03-2005 MMI-SPR-28224 : | |
63 To allow the user to scroll up and down while creating, reading or forwarding MMS . | |
64 | |
65 xrashmic 14 Dec, 2004 MMI-SPR-23921 | |
66 Implementing the forward functionality for MMS | |
67 | |
68 | |
69 xreddymn Dec-20-2004 MMI-SPR-27382 | |
70 (1) Added "Please Wait" screen when deleting messages from a folder. | |
71 This prevents the user from navigating menus during the process. | |
72 (2) Modified inbox refresh to occur only when inside the inbox list screen. | |
73 | |
74 MMI-SPR-27384: Dec-17-2004 - xreddymn | |
75 Changes for MMS/EMS Inbox/Sent/Unsent folder presentation | |
76 | |
77 xrashmic 7 Dec, 2004 MMI-SPR-23965 | |
78 Description: Not able to extract the objects in EMS message | |
79 Solution: Extract and store the objects in the Object Manager | |
80 | |
81 MMI-SPR-23981: Nov-30-2004 - xreddymn | |
82 Modified delete message behaviour. | |
83 Fixed "Play MMS Error" message that appears when trying to read messages | |
84 | |
85 MMI-SPR-25278: Nov-29-2004 - xreddymn | |
86 Implemented FFS limits for MMS/EMS storage | |
87 | |
88 CRR 24456: 19 Oct 2004 - xpradipg | |
89 Description: On opening MMS with PNG image "Play MMS Error" is displayed. | |
90 On pressing Back D-sample resets. | |
91 Solution: The EPlayModeStop was posted even if the EPlayModeRun was not | |
92 posted. The EPlayModeStop event posting is controled. | |
93 | |
94 CRR: 25291 - xrashmic 14 Oct 2004 | |
95 Description: The sent EMS is stored in unsent folder. | |
96 Solution: The Outbox has been removed, instead we now have Sent folder for the sent EMS | |
97 | |
98 MMI-SPR-25273: Oct-14-2004 - xreddymn | |
99 Description: EMS forward not working | |
100 Solution: Added changes to implement the EMS forward feature | |
101 | |
102 CRR 25268: 13 Oct 2004 - xpradipg | |
103 Description: Unable to see the Number / name and the status read/unread of | |
104 the received EMS/MMS | |
105 Solution: The status of each message is updated as soon as the Message is | |
106 read, and "old"/"new" is appended based on the status flag | |
107 | |
108 CRR 25270: 13 Oct 2004 - xpradipg | |
109 Description: EMS: Titles such as "no name" is added to EMSs with no titles | |
110 Solution: The corresponding name is retrieved from the phone book for the | |
111 number from which EMS is received, if name is not present number is | |
112 displayed in Inbox | |
113 | |
114 CRR 25277: 06 Oct 2004 - xpradipg | |
115 Description: Recieving an ems when inbox is open | |
116 Solution: A refresh event is sent to the Inbox list which inturn updates | |
117 the list | |
118 | |
119 MMI-SPR-25148: Sep-24-2004 - xreddymn | |
120 Changes to map object index correctly to displayed list index | |
121 in case of extractable object list. | |
122 | |
123 xrashmic 22 Sep, 2004 MMI-SPR-25032 | |
124 To play the buzzer when there are sound objects in EMS message | |
125 | |
126 MMI-SPR-24735: Sep-16-2004 - xreddymn | |
127 Changes related to EMS screen flickering issue | |
128 | |
129 MMI-SPR-23962 (TII_MMS31): Aug-20-2004 - xreddymn | |
130 Extract objects modified not to include text and unknown objects | |
131 | |
132 MMI-SPR-23933 (TII_MMS17): Aug-17-2004 - xreddymn | |
133 Display a more meaningful error message when playback fails. | |
134 | |
135 MMI-SPR-23972 (TII_MMS41) Aug-27-2004 - xreddymn | |
136 Correctly close message session when extracting objects or reading the message | |
137 | |
138 MMI-SPR-23926 (TII_MMS12) and MMI-SPR-24115 (TII_MMS55): Aug-26-2004 - xreddymn | |
139 Keep track of MMS/EMS display | |
140 | |
141 CRR 23963: xpradipg 26 Aug 2004 | |
142 Description: Remove "Reply" option from Unsent folder | |
143 Solution: The current selected folder is stored in a variable and depending on the selected folder | |
144 the menu item display is controled. | |
145 | |
146 CRR 23959: xpradipg 26 Aug 2004 | |
147 Description: List not updated after deleting the messages in Unsent/Inbox folder | |
148 Solution: The list is refreshed everytime the user returns from the options menu | |
149 | |
150 xrashmic 26 Aug, 2004 MMI-SPR-23931 | |
151 Only the complete message will be displayed in the inbox, outbox, unsent folders | |
152 | |
153 Bug Id 19 : 13 Aug, 2004 - xrashmic | |
154 Description: MMS compose is displayed when reply option is selected | |
155 for an EMS message | |
156 Solution: When reply is selected for a message from the inbox, we need to display corresponding | |
157 compose screen i.e either EMS compose or MMS compose screen | |
158 | |
159 17/01/04 Replace mfw edit with AUI edit. | |
160 28/08/03 Original TI(Shanghai) BMI version. | |
161 | |
162 $End | |
163 | |
164 *******************************************************************************/ | |
165 #define MMI_MMSBOX_C | |
166 | |
167 #define ENTITY_MFW | |
168 | |
169 /* includes */ | |
170 #include <string.h> | |
171 #include <stdio.h> | |
172 #include <stdlib.h> | |
173 #include <stdarg.h> | |
174 | |
175 #if defined (NEW_FRAME) | |
176 | |
177 #include "typedefs.h" | |
178 #include "vsi.h" | |
179 #include "pei.h" | |
180 #include "custom.h" | |
181 #include "gsm.h" | |
182 | |
183 #else | |
184 | |
185 #include "STDDEFS.H" | |
186 #include "custom.h" | |
187 #include "gsm.h" | |
188 #include "vsi.h" | |
189 | |
190 #endif | |
191 #include "prim.h" | |
192 | |
193 | |
194 #include "mfw_mfw.h" | |
195 #include "mfw_win.h" | |
196 #include "mfw_kbd.h" | |
197 #include "mfw_edt.h" | |
198 #include "mfw_tim.h" | |
199 #include "mfw_phb.h" | |
200 #include "ksd.h" | |
201 #include "psa.h" | |
202 #include "mfw_sms.h" | |
203 #include "mfw_smsi.h" | |
204 #include "mfw_icn.h" | |
205 #include "mfw_mnu.h" | |
206 #include "mfw_lng.h" | |
207 #include "mfw_sat.h" | |
208 #include "mfw_kbd.h" | |
209 #include "mfw_nm.h" | |
210 | |
211 #include "psa_util.h" | |
212 | |
213 #include "dspl.h" | |
214 // #include "unicode_types.h" | |
215 | |
216 #include "MmiMain.h" | |
217 #include "MmiDummy.h" | |
218 //#include "MmiLists.h" | |
219 #include "MmiMmi.h" | |
220 #include "mmiCall.h"//GW 29/11/01 for 'callNumber' | |
221 | |
222 #include "MmiDialogs.h" | |
223 #include "MmiLists.h" | |
224 #include "MmiMenu.h" | |
225 #include "MmiSoftKeys.h" | |
226 | |
227 #ifdef NEW_EDITOR | |
228 #include "ATBCommon.h" | |
229 #include "ATBDisplay.h" | |
230 #include "ATBEditor.h" | |
231 #include "AUIEditor.h" | |
232 #else /* NEW_EDITOR */ | |
233 #ifdef EASY_TEXT_ENABLED | |
234 #include "MmiLatinPredText.h" | |
235 #endif /* EASY_TEXT_ENABLED */ | |
236 #include "MmiEditor.h" | |
237 #endif /* NEW_EDITOR */ | |
238 | |
239 #include "MmiBookShared.h" // MZ | |
240 #include "mmimmsmenu.h" | |
241 #include "mmimmsbox.h" | |
242 #include "mfw_ffs.h" | |
243 #include "mmiwindow.h" | |
244 | |
245 #include "cus_aci.h" | |
246 | |
247 #include "prim.h" | |
248 #ifndef PCM_2_FFS | |
249 #include "pcm.h" | |
250 #endif | |
251 | |
252 #include "aci_cmh.h" //GW 29/11/01 added for types in aci_fd.h | |
253 #include "aci_fd.h" //GW 29/11/01 added for types in 'cmh.h' | |
254 #include "cmh.h" //GW 29/11/01 added for types in 'cmh_phb.h' | |
255 #include "cmh_phb.h" //GW 29/11/01 added for cmhPHB_getAdrStr | |
256 | |
257 #include "mmiColours.h" | |
258 //xrashmic 22 Sep, 2004 MMI-SPR-25032 | |
259 #include "audio.h" | |
260 | |
261 | |
262 #include "mg4def.h" | |
263 #include "evtdefs.h" | |
264 #include "mg4stu.h" | |
265 #include "Mg4Dal.h" | |
266 #include "mg4devif.h" | |
267 #include "dalevt.h" | |
268 #include "evif.h" | |
269 #include "mg4str.h" | |
270 #include "mmif.h" | |
271 #include "mg4mem.h" | |
272 //Apr 05, 2005 REF: ENH 29994 xdeepadh | |
273 #ifdef FF_MIDI_RINGER | |
274 #include "mfw_midi.h" | |
275 #include "MmiSounds.h" | |
276 #endif | |
277 //xrashmic 14 Dec, 2004 MMI-SPR-23921 | |
278 #include "mmimmscreate.h" | |
279 extern int MMSactive; | |
280 | |
281 | |
282 //xreddymn Aug-26-2004 MMI-SPR-23926 (TII_MMS12) and MMI-SPR-24115 (TII_MMS55): To keep track of MMS display | |
283 extern BOOL g_M4_display_active; | |
284 | |
285 //CRR 25270: 13 Oct 2004 - xpradipg | |
286 extern T_idle idle_data; | |
287 extern int bookFindNameInPhonebook( const char *p_pszNumber, T_MFW_PHB_ENTRY *p_pEntry ); | |
288 int MMS_Is_Unread_Msgs_Inbox(void); | |
289 | |
290 //CRR 23959: xpradipg 26 Aug 2004 | |
291 //CRR 23963: xpradipg 26 Aug 2004 | |
292 //Holdsthe current selected folder value. Default is set to 0xFF - | |
293 //indicating no folder is assigned | |
294 UBYTE folder=0xFF; | |
295 // May 12 2005 REF: MMI-SPR-29887 | |
296 // is_deferdownload will be TRUE when Deferred retrieval of MMS starts | |
297 BOOL is_deferdownload = FALSE; | |
298 #define MMS_RECEIVE_PROGRESS -27 | |
299 // May 12 2005 REF: MMI-SPR-29887 | |
300 //Used to check whther control went to DeviceEndAck while Retrieving the MMS | |
301 // If that is the case then dont display NewNotificaion dialog. | |
302 BOOL is_notifyResponse = FALSE; | |
303 // Jun 23 2005 REF: MMI-SPR-29887 x0012849 | |
304 extern BOOL is_downloadcancelled; | |
305 extern UBYTE rtvprogressValue; | |
306 //CRR 25277: xpradipg 06 Oct 2004 | |
307 extern MfwHnd mmsboxwinhnd; | |
308 //GW 29/11/01 - added header file - removed extern void callNumber(UBYTE* number); | |
309 MfwWin* getWinData( MfwHnd win); | |
310 | |
311 // xreddymn Nov-29-2004: Added externals | |
312 //xrashmic 08 Feb, 2005 MMI-SPR-27853 | |
313 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); | |
314 | |
315 extern T_MFW_HND g_inSaveModeWin; | |
316 | |
317 // xreddymn Nov-30-2004 MMI-SPR-23981 | |
318 T_MFW_HND g_OptionsWin; | |
319 T_MFW_HND g_MmsBoxWin; | |
320 //xrashmic 23 Nov, 2005 MMI-SPR-OMAPS00047637 | |
321 T_MFW_HND g_MmsReadWin; | |
322 T_MFW_HND g_MmsExtractEdtWin; | |
323 // xreddymn Dec-20-2004 MMI-SPR-27382 | |
324 T_MFW_HND g_MmsBoxWinSavedHnd; | |
325 T_MFW_HND g_MmsPleaseWaitWin; | |
326 | |
327 //xrashmic 7 Dec, 2004 MMI-SPR-23965 | |
328 int attachmentInEMS=0; | |
329 EV_S_EXTRACTABLE_IN_MESSAGE apExtractableInMessage; | |
330 PP_S_OBJECT_DATA *appObj; | |
331 | |
332 /********************************************************************* | |
333 | |
334 DYNAMIC MENU WINDOW. DECLARATION | |
335 | |
336 **********************************************************************/ | |
337 | |
338 /* xreddymn Dec-16-2004 MMI-SPR-27384: MMS/EMS message list is now displayed as a two line per item list */ | |
339 static MfwMnuAttr MmsBox_menuAttrib = | |
340 { | |
341 &melody_menuArea, | |
342 MNU_LEFT | MNU_LIST_2_LINE | MNU_CUR_LINE, /* double line menu */ | |
343 -1, /* use default font */ | |
344 NULL, /* with these items */ | |
345 0, /* number of items */ | |
346 COLOUR_LIST_XX, TxtNull, MNUATTRSPARE | |
347 | |
348 }; | |
349 | |
350 static MfwMnuAttr MmsBox_ExtractMedia_menuAttrib = | |
351 { | |
352 &melody_menuArea, | |
353 MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */ | |
354 -1, /* use default font */ | |
355 NULL, /* with these items */ | |
356 0, /* number of items */ | |
357 COLOUR_LIST_XX, TxtNull, MNUATTRSPARE | |
358 | |
359 }; | |
360 | |
361 static int MMSBox_OPTexeRead(MfwMnu* m, MfwMnuItem* i); | |
362 // May 12 2005 REF: MMI-SPR-29887 x0012849 | |
363 //Prototyes of the functions. START | |
364 static int MMSBox_OPTexeDeferDownload(MfwMnu* m, MfwMnuItem* i); | |
365 static void DeferDownloadMsg(MM_MESSAGE_ID msgId); | |
366 void MMSDownLoadNow(MM_MESSAGE_ID msgId); | |
367 static ESTATUS DeferDownloadMsgCallback(EVENT_ID aeId, | |
368 EVENT_TYPE aeType, | |
369 MESSAGE_PARAM ampParam, | |
370 EVT_HANDLE evtHandle); | |
371 // May 12 2005 REF: MMI-SPR-29887 x0012849 | |
372 //Prototyes of the functions. END | |
373 static int MMSBox_OPTexeExtract(MfwMnu* m, MfwMnuItem* i); | |
374 static int MMSBox_OPTexeForward(MfwMnu* m, MfwMnuItem* i); | |
375 static int MMSBox_OPTexeDelete(MfwMnu* m, MfwMnuItem* i); | |
376 static int MMSBox_OPTexeReply(MfwMnu* m, MfwMnuItem* i); | |
377 //CRR 23963: xpradipg 26 Aug 2004 | |
378 USHORT MMSBox_Is_Unsent( struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi ); | |
379 // May 12 2005 REF: MMI-SPR-29887 x0012849 | |
380 //Prototyes of the function | |
381 USHORT MMSBox_Is_NotRetrieved( struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi ); | |
382 // May 12 2005 REF: MMI-SPR-29887 x0012849 | |
383 //Prototyes of the function | |
384 USHORT MMSBox_Is_Retrieved( struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi ); | |
385 void MMSBox_Extract_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter); | |
386 | |
387 | |
388 static MfwMnuItem MMSBox_OPTItems [] = | |
389 { | |
390 // May 11 2005 REF: MMI-SPR-29887 x0012849 | |
391 //Choose either of one Read or Retrieve based on the type of MMS. | |
392 {0,0,0,(char *)TxtRead,0,(MenuFunc)MMSBox_OPTexeRead,MMSBox_Is_Retrieved}, | |
393 // May 11 2005 REF: MMI-SPR-29887 x0012849 | |
394 //Retrieve will be showed in case if the MMS is not complete | |
395 {0,0,0,(char *)TxtRetrieve,0,(MenuFunc)MMSBox_OPTexeDeferDownload,MMSBox_Is_NotRetrieved}, | |
396 {0,0,0,(char *)TxtExtract,0,(MenuFunc)MMSBox_OPTexeExtract,MMSBox_Is_Retrieved}, | |
397 //CRR 23963: xpradipg 26 Aug 2004 | |
398 //added MMSBox_Is_Unsent which controls the display of the menu item | |
399 {0,0,0,(char *)TxtReply,0,(MenuFunc)MMSBox_OPTexeReply,MMSBox_Is_Unsent}, | |
400 {0,0,0,(char *)TxtForward,0,(MenuFunc)MMSBox_OPTexeForward,MMSBox_Is_Retrieved}, | |
401 {0,0,0,(char *)TxtDelete,0,(MenuFunc)MMSBox_OPTexeDelete,item_flag_none}, | |
402 }; | |
403 | |
404 //xrashmic 7 Dec, 2004 MMI-SPR-23965 | |
405 // Separate options list for the EMS message. The extract menu item is removed from this list | |
406 static MfwMnuItem EMSBox_OPTItems [] = | |
407 { | |
408 {0,0,0,(char *)TxtRead,0,(MenuFunc)MMSBox_OPTexeRead,item_flag_none}, | |
409 //CRR 23963: xpradipg 26 Aug 2004 | |
410 //added MMSBox_Is_Unsent which controls the display of the menu item | |
411 {0,0,0,(char *)TxtReply,0,(MenuFunc)MMSBox_OPTexeReply,MMSBox_Is_Unsent}, | |
412 {0,0,0,(char *)TxtForward,0,(MenuFunc)MMSBox_OPTexeForward,item_flag_none}, | |
413 {0,0,0,(char *)TxtDelete,0,(MenuFunc)MMSBox_OPTexeDelete,item_flag_none}, | |
414 }; | |
415 | |
416 static MfwMnuAttr MMSBox_OPTAttrib = | |
417 { | |
418 &SmsRead_R_OPTArea, | |
419 MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */ | |
420 -1, /* use default font */ | |
421 MMSBox_OPTItems, /* with these items */ | |
422 sizeof(MMSBox_OPTItems)/sizeof(MfwMnuItem), /* number of items */ | |
423 COLOUR_LIST_SMS, TxtNull, MNUATTRSPARE | |
424 | |
425 }; | |
426 //xrashmic 7 Dec, 2004 MMI-SPR-23965 | |
427 // Separate options list for the EMS message. The extract menu item is removed from this list | |
428 static MfwMnuAttr EMSBox_OPTAttrib = | |
429 { | |
430 &SmsRead_R_OPTArea, | |
431 MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */ | |
432 -1, /* use default font */ | |
433 EMSBox_OPTItems, /* with these items */ | |
434 sizeof(EMSBox_OPTItems)/sizeof(MfwMnuItem), /* number of items */ | |
435 COLOUR_LIST_SMS, TxtNull, MNUATTRSPARE | |
436 | |
437 }; | |
438 | |
439 #define MMS_BOX_LISTALLMMS_BEGIN | |
440 | |
441 /* pointer used to get mms list */ | |
442 MM_S_MESSAGE_HEADER_LIST* g_pMessageHeaderList = NULL; | |
443 int g_currentMessage=0; | |
444 | |
445 //CRR 25270 & CRR 25268: 14 Oct 2004 - xpradipg | |
446 // xreddymn Dec-16-2004 MMI-SPR-27384: Modified string lengths for Inbox/Unsent/Sent presentation | |
447 #define MMS_BOX_LIST_STRING_MAX_LENGTH 72 | |
448 #define MMS_BOX_LIST_LINE_MAX_LENGTH 36 | |
449 #define MMS_BOX_LIST_SUB_MAX_LENGTH 28 | |
450 //xrashmic 29 Nov, 2005 MMI-SPR-OMAPS00050170 | |
451 //Changed the static allocation to dynamic for the following variables | |
452 char *g_mmstopic; | |
453 char *g_mmsstatus; | |
454 | |
455 static ListMenuData *box_menu_list_data=NULL; | |
456 static ListMenuData *extra_menu_list_data=NULL; | |
457 | |
458 // xreddymn Sep-24-2004 MMI-SPR-25148 : An array that maps displayed index to an index in the list of objects extracted | |
459 static S16 *extra_menu_list_indices=NULL; | |
460 | |
461 //CRR 24456: 19 Oct 2004 - xpradipg | |
462 //flag to control the posting of EPlayModeStop | |
463 static int MmsReadStatus =ENoError; | |
464 void M4_FreeListFolderMemory(void) | |
465 { | |
466 /* If there is any data */ | |
467 if (g_pMessageHeaderList != NULL) | |
468 { | |
469 g_pMessageHeaderList->memHdr.freeFunc(g_pMessageHeaderList); | |
470 | |
471 g_pMessageHeaderList = NULL; | |
472 } | |
473 | |
474 return; | |
475 } | |
476 //CRR 23963: xpradipg 26 Aug 2004 | |
477 /******************************************************************************* | |
478 | |
479 $Function: MMSBox_Is_Unsent | |
480 | |
481 $Description: decides if the Reply menu item needs to be displayed or not | |
482 | |
483 $Returns: False if it should be displayed | |
484 | |
485 $Arguments: | |
486 *******************************************************************************/ | |
487 USHORT MMSBox_Is_Unsent( struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi ) | |
488 { | |
489 // May 11 2005 REF: MMI-SPR-29887 x0012849 | |
490 if(folder == MMS_UNSENT ||(g_pMessageHeaderList->ppList[g_currentMessage].complete == FALSE )) | |
491 { | |
492 return 1; | |
493 } | |
494 return 0; | |
495 } | |
496 // May 11 2005 REF: MMI-SPR-29887 x0012849 | |
497 // New Function added | |
498 /******************************************************************************* | |
499 $Function: MMSBox_Is_NotRetrieved | |
500 $Description: decides whether Retrieve option need to be displayed or not | |
501 $Returns: False if it should be displayed | |
502 $Arguments: | |
503 *******************************************************************************/ | |
504 USHORT MMSBox_Is_NotRetrieved( struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi ) | |
505 { | |
506 if(g_pMessageHeaderList->ppList[g_currentMessage].complete == FALSE) | |
507 { | |
508 return 0; | |
509 } | |
510 return 1; | |
511 } | |
512 // May 11 2005 REF: MMI-SPR-29887 x0012849 | |
513 // New Function added | |
514 /******************************************************************************* | |
515 $Function: MMSBox_Is_Retrieved | |
516 $Description: decides whether Read options need to be displayed or not | |
517 $Returns: False if it should be displayed | |
518 $Arguments: | |
519 *******************************************************************************/ | |
520 USHORT MMSBox_Is_Retrieved( struct MfwMnuTag *m, struct MfwMnuAttrTag *ma, struct MfwMnuItemTag *mi ) | |
521 { | |
522 if(g_pMessageHeaderList->ppList[g_currentMessage].complete == TRUE) | |
523 { | |
524 return 0; | |
525 } | |
526 return 1; | |
527 } | |
528 | |
529 /******************************************************************************* | |
530 | |
531 $Function: MMSBoxList_cb | |
532 | |
533 $Description: Callback function for the melody list. | |
534 | |
535 $Returns: none | |
536 | |
537 $Arguments: Parent - parent window. | |
538 ListData - Menu item list | |
539 *******************************************************************************/ | |
540 | |
541 void MMSBoxList_cb(T_MFW_HND * Parent, ListMenuData * ListData) | |
542 { | |
543 T_MFW_HND win = mfwParent(mfw_header()); | |
544 | |
545 TRACE_EVENT_P1("MMSBoxList_cb : %d", ListData->Reason); | |
546 if ((ListData->Reason EQ LISTS_REASON_BACK) || (ListData->Reason EQ LISTS_REASON_CLEAR) | |
547 || (ListData->Reason EQ LISTS_REASON_HANGUP)) // sbh - added hangup key | |
548 { | |
549 listsDestroy(ListData->win); | |
550 MMI_DestoryWindow(Parent); | |
551 } | |
552 else if(ListData->Reason EQ LISTS_REASON_SELECT) | |
553 { | |
554 g_currentMessage=ListData->CursorPosition; | |
555 MMSBox_OPT_start(ListData->win,0); | |
556 } | |
557 } | |
558 | |
559 static void MMSBox_info_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason) | |
560 { | |
561 TRACE_FUNCTION("MMSBox_info_cb"); | |
562 switch (reason) | |
563 { | |
564 case INFO_KCD_LEFT: | |
565 MMI_DestoryWindow(win); | |
566 break; | |
567 case INFO_KCD_HUP: | |
568 case INFO_KCD_RIGHT: | |
569 case INFO_KCD_CLEAR: | |
570 MMI_DestoryWindow(win); | |
571 break; | |
572 default: | |
573 break; | |
574 } | |
575 } | |
576 | |
577 /******************************************************************************* | |
578 | |
579 $Function: MMSBox_DT_string | |
580 | |
581 $Description: Forms a string from a date/time structure | |
582 | |
583 $Returns: none | |
584 | |
585 $Arguments: s - String into which the output is written. | |
586 Must be sufficiently large: Doesn't perform any bounds check. | |
587 t - MMS time stamp structure | |
588 | |
589 xreddymn Dec-16-2004 | |
590 | |
591 *******************************************************************************/ | |
592 void MMSBox_DT_string(char *s,MM_S_TIME_STAMP *t) | |
593 { | |
594 sprintf(s,"%02d/%02d %02d:%02d",t->day,t->month,t->hour,t->min); | |
595 } | |
596 | |
597 /******************************************************************************* | |
598 | |
599 $Function: MMSBox_exec_cb | |
600 | |
601 $Description: Exec callback function of the MMS Create window | |
602 | |
603 $Returns: none | |
604 | |
605 $Arguments: win - window handler | |
606 event - mfw event | |
607 parameter - optional data. | |
608 | |
609 *******************************************************************************/ | |
610 void MMSBox_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter) | |
611 /* callback handler for events sent to to trigger execution */ | |
612 { | |
613 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
614 int i; | |
615 ESTATUS eStatus=0; | |
616 MM_LIST_PARAM listParams = 0; | |
617 //CRR 25270 && CRR 25268: 13 Oct 2004 - xpradipg | |
618 //moved the declaration to the start of the function | |
619 int lenSub=0; | |
620 T_MFW_PHB_ENTRY phonebook_entry; | |
621 // May 17 2005 REF: MMI-SPR-29887 xreddymn | |
622 //list_size will give the value - No of Messages presently in the list | |
623 int list_size; | |
624 TRACE_FUNCTION ("MMSBox_exec_cb()"); | |
625 | |
626 switch (event) | |
627 { | |
628 //CRR 23963: xpradipg 26 Aug 2004 | |
629 //New case added, this is invoked when ever the user returns back from the | |
630 //options screen. This cleans the list of messages and re-populates the list | |
631 case MWM_REDRAW: | |
632 // we delete the list - free the list - before actually allocating and drawing. | |
633 list_size = box_menu_list_data->ListLength; | |
634 if(box_menu_list_data->win) | |
635 listsDestroy(box_menu_list_data->win); | |
636 if(box_menu_list_data) | |
637 { | |
638 if(box_menu_list_data->List && g_pMessageHeaderList) | |
639 { | |
640 // May 17 2005 REF: MMI-SPR-29887 xreddymn | |
641 // Use list_size to while freeing the memory | |
642 FREE_MEMORY((void*)(box_menu_list_data->List), list_size * sizeof(T_MFW_MNU_ITEM )); | |
643 } | |
644 FREE_MEMORY((void*)(box_menu_list_data),sizeof(ListMenuData)); | |
645 } | |
646 //xrashmic 29 Nov, 2005 MMI-SPR-OMAPS00050170 | |
647 //Freeing the allocated memory on exiting the list screen | |
648 if(g_mmsstatus) | |
649 FREE_MEMORY((void*)g_mmsstatus,MMS_BOX_LIST_STRING_MAX_LENGTH); | |
650 if(g_mmstopic) | |
651 FREE_MEMORY((void*)g_mmstopic,MMS_BOX_LIST_STRING_MAX_LENGTH*g_pMessageHeaderList->size); | |
652 | |
653 //CRR 23963: xpradipg 26 Aug 2004 | |
654 //the break; is omitted intentionally, since the list is recreated using the below code | |
655 case MWM_CREATE: | |
656 //CRR 25277: xpradipg 06 Oct 2004 | |
657 //the display needs to be refreshed forcibly | |
658 dspl_Enable(0); | |
659 /* initialization of administrative data */ | |
660 TRACE_EVENT(" Event: MWM_CREATE"); | |
661 //yanbin: call magic4 function to create MMS list | |
662 /* make sure g_pMessageHeaderList be freed if not free */ | |
663 M4_FreeListFolderMemory(); | |
664 box_menu_list_data=NULL; | |
665 //CRR 23963: xpradipg 26 Aug 2004 | |
666 //CRR 23963: xpradipg 26 Aug 2004 | |
667 //check if no folder number is assigned before assigning | |
668 if(folder == 0xFF) | |
669 folder = (UBYTE)parameter; | |
670 else | |
671 parameter=(void*)folder; | |
672 TRACE_EVENT_P1("the value of folder is %d",folder); | |
673 //parameter=(folder==0xFF)?parameter:(void*)folder; | |
674 if (parameter == (void *)MMS_INBOX) | |
675 { | |
676 //xrashmic 26 Aug, 2004 MMI-SPR-23931 | |
677 //added MM_LIST_COMPLETE so that the list does not contain | |
678 //incomplete messages | |
679 //listParams = MM_LIST_INBOX|MM_LIST_COMPLETE; | |
680 //May 17 2005 REF: MMI-SPR-29887 x0012849 | |
681 //To Implement the deferred MMS retrieval. | |
682 listParams = MM_LIST_INBOX|MM_LIST_NOT_RETRIEVED; | |
683 } | |
684 //CRR: 25291 - xrashmic 14 Oct 2004 | |
685 //To display a list of the sent messages. | |
686 else if (parameter == (void *)MMS_SENT) | |
687 { | |
688 // xreddymn May-18-2005 MMI-SPR-29887: Removed MM_LIST_COMPLETE | |
689 // as it causes messages from Inbox to be listed, with the new MMS library | |
690 listParams = MM_LIST_SENT; | |
691 } | |
692 else | |
693 { | |
694 // xreddymn May-18-2005 MMI-SPR-29887: Removed MM_LIST_COMPLETE | |
695 // as it causes messages from Sent to be listed, with the new MMS library | |
696 listParams = MM_LIST_DRAFT; | |
697 } | |
698 | |
699 eStatus = DAL_ListMessagesByParam(&g_pMessageHeaderList, listParams); | |
700 | |
701 if(eStatus != ENoError) | |
702 { | |
703 //M4_DebugStringMessage("MMSBox_exec_cb: eStatus != ENoError",sizeof("MMSBox_exec_cb: eStatus != ENoError"),0); | |
704 } | |
705 | |
706 if(g_pMessageHeaderList == NULL || g_pMessageHeaderList->size ==0 ) | |
707 { | |
708 T_DISPLAY_DATA display_info; | |
709 //M4_DebugStringMessage("g_pMessageHeaderList->size==0",sizeof("g_pMessageHeaderList->size==0"),0); | |
710 if(g_pMessageHeaderList != NULL) M4_FreeListFolderMemory(); | |
711 | |
712 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtSoftBack,TxtEmptyList, TxtNull, COLOUR_STATUS); | |
713 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)MMSBox_info_cb, FOREVER, KEY_RIGHT|KEY_CLEAR|KEY_HUP); | |
714 display_info.Identifier=0; | |
715 info_dialog (win, &display_info); | |
716 dspl_Enable(1); | |
717 break; | |
718 } | |
719 | |
720 box_menu_list_data =(ListMenuData *) ALLOC_MEMORY(sizeof(ListMenuData)); | |
721 box_menu_list_data->List = (T_MFW_MNU_ITEM *)ALLOC_MEMORY( g_pMessageHeaderList->size * sizeof(T_MFW_MNU_ITEM) ); | |
722 //xrashmic 29 Nov, 2005 MMI-SPR-OMAPS00050170 | |
723 //dynamically allocating memory for g_mmstopic. Total size = max size of one string in the list X total number of mms | |
724 g_mmstopic=(char*)ALLOC_MEMORY(MMS_BOX_LIST_STRING_MAX_LENGTH*g_pMessageHeaderList->size); | |
725 g_mmsstatus=(char*)ALLOC_MEMORY(MMS_BOX_LIST_STRING_MAX_LENGTH); | |
726 | |
727 // xreddymn Dec-15-2004 MMI-SPR-27384: Modifications for Inbox/Unsent/Sent box presentation | |
728 // xrashmicn OMAPS00050170 | |
729 for (i = 0; (i < g_pMessageHeaderList->size) ; i++) | |
730 { | |
731 //CRR 25270: xpradipg | |
732 mnuInitDataItem(&box_menu_list_data->List[i]); | |
733 box_menu_list_data->List[i].flagFunc = item_flag_none; | |
734 //CRR 25270 && CRR 25268: 14 Oct 2004 - xpradipg | |
735 //the temporary buffer is reset after every iteration | |
736 memset(g_mmsstatus,'\0',MMS_BOX_LIST_STRING_MAX_LENGTH); | |
737 | |
738 //CRR 25270 & CRR 25268: 13 Oct 2004 - xpradipg | |
739 //Set the title to Saved if the folder being listed is Unsent | |
740 //Otherwise append thestring "New"/"Old" depending on the | |
741 //status of the read flag in the message header | |
742 if(!(listParams & MM_LIST_DRAFT)) | |
743 { | |
744 //xrashmic 29 Nov, 2005 MMI-SPR-OMAPS00050170 | |
745 //Changed from static allocations for g_mmstopic and g_mmsstatus to dynamic allocation. | |
746 if(g_pMessageHeaderList->ppList[i].read== TRUE) | |
747 strcpy(&g_mmstopic[i*MMS_BOX_LIST_STRING_MAX_LENGTH],"Old: "); | |
748 else | |
749 strcpy(&g_mmstopic[i*MMS_BOX_LIST_STRING_MAX_LENGTH],"New: "); | |
750 } | |
751 else | |
752 { | |
753 //xrashmic 29 Nov, 2005 MMI-SPR-OMAPS00050170 | |
754 //Changed from static allocations for g_mmstopic and g_mmsstatus to dynamic allocation. | |
755 strcpy(&g_mmstopic[i*MMS_BOX_LIST_STRING_MAX_LENGTH],"Saved: "); | |
756 box_menu_list_data->List[i].str = &g_mmstopic[i*MMS_BOX_LIST_STRING_MAX_LENGTH]; | |
757 // continue; | |
758 } | |
759 //CRR 25270 & CRR 25268: 13 Oct 2004 - xpradipg | |
760 //The Topic is displayed for the mms, if the topic is not present | |
761 //then the name is searched for corresponding to the number from | |
762 //which the message was received. For EMS only the number /name is | |
763 //displayed | |
764 if(g_pMessageHeaderList->ppList[i].type!=EMtSms) | |
765 { | |
766 lenSub=GetStringBytes(g_pMessageHeaderList->ppList[i].messageTypeHeader.mmsHeader.pSubject); | |
767 //CRR 25270: xpradipg | |
768 if(lenSub==0) | |
769 { | |
770 // xreddymn Dec-15-2004 MMI-SPR-27384 | |
771 switch((UBYTE)parameter) | |
772 { | |
773 case MMS_INBOX: | |
774 lenSub=GetStringBytes(g_pMessageHeaderList->ppList[i].messageTypeHeader.mmsHeader.pFrom); | |
775 break; | |
776 case MMS_SENT: | |
777 lenSub=GetStringBytes(g_pMessageHeaderList->ppList[i].messageTypeHeader.mmsHeader.pToList); | |
778 break; | |
779 default: | |
780 lenSub=0; | |
781 break; | |
782 } | |
783 if(lenSub==0) | |
784 { | |
785 strcpy(g_mmsstatus,"No name"); | |
786 } | |
787 else | |
788 { | |
789 if(lenSub>MMS_BOX_LIST_SUB_MAX_LENGTH) lenSub=MMS_BOX_LIST_SUB_MAX_LENGTH; | |
790 // xreddymn Dec-15-2004 MMI-SPR-27384 | |
791 switch((UBYTE)parameter) | |
792 { | |
793 case MMS_INBOX: | |
794 ConvertUcs2To8BitString(g_pMessageHeaderList->ppList[i].messageTypeHeader.mmsHeader.pFrom, lenSub, (MByte*)g_mmsstatus); | |
795 break; | |
796 case MMS_SENT: | |
797 ConvertUcs2To8BitString(g_pMessageHeaderList->ppList[i].messageTypeHeader.mmsHeader.pToList, lenSub, (MByte*)g_mmsstatus); | |
798 break; | |
799 default: | |
800 strcpy(g_mmsstatus,""); | |
801 break; | |
802 } | |
803 if (bookFindNameInPhonebook( g_mmsstatus, &phonebook_entry )) | |
804 { | |
805 if (phonebook_entry.name.len >0) | |
806 { | |
807 strncpy(g_mmsstatus,(const char*)phonebook_entry.name.data,lenSub); | |
808 } | |
809 } | |
810 } | |
811 } | |
812 else | |
813 { | |
814 if(lenSub>MMS_BOX_LIST_SUB_MAX_LENGTH) lenSub=MMS_BOX_LIST_SUB_MAX_LENGTH; | |
815 ConvertUcs2To8BitString(g_pMessageHeaderList->ppList[i].messageTypeHeader.mmsHeader.pSubject, lenSub, (MByte*)g_mmsstatus); | |
816 } | |
817 //xrashmic 29 Nov, 2005 MMI-SPR-OMAPS00050170 | |
818 //Changed from static allocations for g_mmstopic and g_mmsstatus to dynamic allocation. | |
819 strcat(&g_mmstopic[i*MMS_BOX_LIST_STRING_MAX_LENGTH],g_mmsstatus); | |
820 /* Dec-15-2004 MMI-SPR-27384: Insert the time stamp information */ | |
821 MMSBox_DT_string((char*)g_mmsstatus,&g_pMessageHeaderList->ppList[i].timestamp); | |
822 strcat(&g_mmstopic[i*MMS_BOX_LIST_STRING_MAX_LENGTH],"\n"); | |
823 strcat(&g_mmstopic[i*MMS_BOX_LIST_STRING_MAX_LENGTH],g_mmsstatus); | |
824 } | |
825 //CRR 25270 & CRR 25268: 13 Oct 2004 - xpradipg | |
826 //retrieve the number from the ems and look for the | |
827 //corresponding entry in the phonebook, populate the | |
828 //name if present else display the number | |
829 else | |
830 { | |
831 lenSub=GetStringBytes(g_pMessageHeaderList->ppList[i].messageTypeHeader.smsHeader.pszAddress); | |
832 if(lenSub>0) | |
833 { | |
834 if(lenSub>MMS_BOX_LIST_SUB_MAX_LENGTH) lenSub=MMS_BOX_LIST_SUB_MAX_LENGTH; | |
835 ConvertUcs2To8BitString(g_pMessageHeaderList->ppList[i].messageTypeHeader.smsHeader.pszAddress, lenSub, (MByte*)g_mmsstatus); | |
836 if (bookFindNameInPhonebook( g_mmsstatus, &phonebook_entry )) | |
837 { | |
838 if (phonebook_entry.name.len >0) | |
839 { | |
840 strncpy(g_mmsstatus,(const char*)phonebook_entry.name.data,lenSub); | |
841 } | |
842 } | |
843 } | |
844 //xrashmic 29 Nov, 2005 MMI-SPR-OMAPS00050170 | |
845 //Changed from static allocations for g_mmstopic and g_mmsstatus to dynamic allocation. | |
846 strcat(&g_mmstopic[i*MMS_BOX_LIST_STRING_MAX_LENGTH],g_mmsstatus); | |
847 /* Dec-15-2004 MMI-SPR-27384: Insert the time stamp information */ | |
848 MMSBox_DT_string((char*)g_mmsstatus,&g_pMessageHeaderList->ppList[i].timestamp); | |
849 strcat(&g_mmstopic[i*MMS_BOX_LIST_STRING_MAX_LENGTH],"\n"); | |
850 strcat(&g_mmstopic[i*MMS_BOX_LIST_STRING_MAX_LENGTH],g_mmsstatus); | |
851 } | |
852 box_menu_list_data->List[i].str = &g_mmstopic[i*MMS_BOX_LIST_STRING_MAX_LENGTH]; | |
853 } | |
854 | |
855 box_menu_list_data->ListLength =g_pMessageHeaderList->size; | |
856 box_menu_list_data->ListPosition = 1; | |
857 box_menu_list_data->CursorPosition = 1; | |
858 box_menu_list_data->SnapshotSize = g_pMessageHeaderList->size; | |
859 box_menu_list_data->Font = 0; | |
860 box_menu_list_data->LeftSoftKey = TxtSoftSelect; | |
861 box_menu_list_data->RightSoftKey = TxtSoftBack; | |
862 box_menu_list_data->KeyEvents = KEY_ALL; | |
863 box_menu_list_data->Reason = 0; | |
864 box_menu_list_data->Strings = TRUE; | |
865 box_menu_list_data->Attr = &MmsBox_menuAttrib; | |
866 box_menu_list_data->autoDestroy = FALSE; | |
867 listDisplayListMenu(win,box_menu_list_data,(ListCbFunc)MMSBoxList_cb,0); | |
868 //CRR 25277: xpradipg 06 Oct 2004 | |
869 //the display needs to be refreshed forcibly | |
870 dspl_Enable(1); | |
871 break; | |
872 | |
873 case MWM_DESTORY: | |
874 TRACE_EVENT(" Event: MWM_DESTORY"); | |
875 if(box_menu_list_data) | |
876 { | |
877 if(box_menu_list_data->List && g_pMessageHeaderList) | |
878 { | |
879 FREE_MEMORY((void*)(box_menu_list_data->List),g_pMessageHeaderList->size * sizeof(T_MFW_MNU_ITEM )); | |
880 } | |
881 FREE_MEMORY((void*)(box_menu_list_data),sizeof(ListMenuData)); | |
882 } | |
883 //xrashmic 29 Nov, 2005 MMI-SPR-OMAPS00050170 | |
884 //Freeing the allocated memory on exiting the list screen | |
885 if(g_mmsstatus) | |
886 FREE_MEMORY((void*)g_mmsstatus,MMS_BOX_LIST_STRING_MAX_LENGTH); | |
887 if(g_mmstopic) | |
888 FREE_MEMORY((void*)g_mmstopic,MMS_BOX_LIST_STRING_MAX_LENGTH*g_pMessageHeaderList->size); | |
889 | |
890 //CRR 23963: xpradipg 26 Aug 2004 | |
891 //reset the folder value to default | |
892 folder = 0xFF; | |
893 //CRR 25277: xpradipg 06 Oct 2004 | |
894 //set the handle to NULL on destroying the window | |
895 mmsboxwinhnd=NULL; | |
896 g_MmsBoxWin=NULL;//xrashmic 23 Nov, 2005 MMI-SPR-OMAPS00047637 | |
897 //xrashmic 29 Nov, 2005 MMI-SPR-OMAPS00050170 | |
898 //M4_FreeListFolderMemory frees the memory for g_pMessageHeaderList. But g_pMessageHeaderList->size is used to | |
899 //free memory for various dynamically allocated pointers eg. g_mmstopic. Hence this should be done at the end . | |
900 M4_FreeListFolderMemory(); | |
901 break; | |
902 case MWM_ONDRAW: | |
903 TRACE_EVENT(" Event: MWM_ONDRAW"); | |
904 displaySoftKeys(TxtSoftOptions,TxtSoftBack); | |
905 break; | |
906 | |
907 // xreddymn Dec-20-2004 MMI-SPR-27382: Save the handle to Inbox window | |
908 case MWM_SUSPEND: | |
909 g_MmsBoxWinSavedHnd=mmsboxwinhnd; | |
910 mmsboxwinhnd=NULL; | |
911 break; | |
912 | |
913 // xreddymn Dec-20-2004 MMI-SPR-27382: Restore the handle to Inbox window | |
914 case MWM_RESUME: | |
915 if(!mmsboxwinhnd) | |
916 { | |
917 mmsboxwinhnd=g_MmsBoxWinSavedHnd; | |
918 } | |
919 break; | |
920 | |
921 default: | |
922 break; | |
923 } | |
924 | |
925 return; | |
926 } | |
927 | |
928 | |
929 /**/ | |
930 | |
931 /******************************************************************************* | |
932 | |
933 $Function: MMSBox_start | |
934 | |
935 $Description: Start the creation of the main window for Create MMS | |
936 | |
937 $Returns: mfw window handler | |
938 | |
939 $Arguments: parent_window - Parent window handler | |
940 menuAttr - Menu attributes. | |
941 | |
942 *******************************************************************************/ | |
943 T_MFW_HND MMSBox_start(T_MFW_HND parent_window, MfwMnuAttr *menuAttr) | |
944 { | |
945 TRACE_FUNCTION ("MMSBox_start()"); | |
946 mmeBackLight(64); | |
947 // xreddymn Nov-30-2004 MMI-SPR-23981: Retain the handle to the Message List menu window | |
948 g_MmsBoxWin=MMI_CreateWindow(parent_window, (T_DIALOG_FUNC)MMSBox_exec_cb,(void*)menuAttr,(T_MFW_CB)0,0,0); | |
949 return g_MmsBoxWin; | |
950 } | |
951 | |
952 | |
953 #define MMS_BOX_EXTERACT_MEDIA | |
954 #define MWM_EXTRACT_MEDIA_LIST (MWM_USER+1) | |
955 #define MWM_EXTRACT_MEDIA_NONE (MWM_USER+2) | |
956 #define MMS_EXTRACT_MEDIA_ERROR (MWM_USER+3) | |
957 | |
958 #if 1 | |
959 | |
960 PP_MESSAGE_HANDLE msgHandle = PP_MESSAGE_HANDLE_INVALID; | |
961 | |
962 PP_S_OBJECT_DATA *pObjData = NULL; | |
963 | |
964 PP_S_OBJECT_ATTRIB *pObjAttrib = NULL; | |
965 | |
966 PP_S_MIME_OBJECT_ARRAY *pObjArray = NULL; | |
967 | |
968 M4_S_OBJECT_ITEM *pItem = NULL; | |
969 | |
970 M4_S_OBJECT_ATTRIB *pAttrib = NULL; | |
971 | |
972 UCS2 medianame[32]={'p','i','c','0',0}; | |
973 int len_medianame=10; | |
974 | |
975 | |
976 void M4_FreeAttrib(void * block) /*Pointer to function used to free this block of memory*/ | |
977 { | |
978 if(block) | |
979 FREE_MEMORY((void*)block,sizeof(M4_S_OBJECT_ATTRIB)); | |
980 } | |
981 void M4_FreeItem(void * block) /*Pointer to function used to free this block of memory*/ | |
982 { | |
983 if(block) | |
984 FREE_MEMORY((void*)block,sizeof(M4_S_OBJECT_ITEM)); | |
985 } | |
986 | |
987 /***************************************************************************** | |
988 * Func : SaveObjectDone | |
989 * Desc : It is the callback function indicating the result of saving object. | |
990 *****************************************************************************/ | |
991 ESTATUS M4_SaveObjectDone(EVENT_ID aeId, | |
992 EVENT_TYPE aeType, | |
993 MESSAGE_PARAM ampParam, | |
994 EVT_HANDLE evtHandle) | |
995 { | |
996 switch(aeId) | |
997 { | |
998 case(EMG4_FileOpDone): | |
999 { | |
1000 /* NOTES: | |
1001 * Object storing is done | |
1002 */ | |
1003 | |
1004 /* | |
1005 * Further notification to upper layer if necessary | |
1006 */ | |
1007 DAL_PostMessage(EMG4_FileOpDone, | |
1008 EVENT_REACTIVE, | |
1009 0, | |
1010 evtHandle->parentEvtHandle); | |
1011 // xreddymn Nov-26-2004 MMI-SPR-25278 | |
1012 winDelete(g_inSaveModeWin); | |
1013 //xrashmic 08 Feb, 2005 MMI-SPR-27853 | |
1014 //Added few more parameters for this function | |
1015 information_dialog(TxtSaved,TxtNull,NULL,NULL, TxtNull,TxtSoftBack,FOREVER,KEY_CLEAR|KEY_RIGHT|KEY_HUP,NULL); | |
1016 } | |
1017 break; | |
1018 | |
1019 case(EMG4_OpError): | |
1020 // xreddymn Nov-26-2004 MMI-SPR-25278 | |
1021 winDelete(g_inSaveModeWin); | |
1022 //xrashmic 08 Feb, 2005 MMI-SPR-27853 | |
1023 //Added few more parameters for this function | |
1024 information_dialog(TxtFailed,TxtFatalError,NULL,NULL,TxtNull,TxtSoftBack,FOREVER,KEY_CLEAR|KEY_RIGHT|KEY_HUP,NULL); | |
1025 default: | |
1026 break; | |
1027 } | |
1028 | |
1029 if(evtHandle) | |
1030 { | |
1031 FREE_MEMORY((void*)evtHandle,sizeof(*evtHandle)); | |
1032 } | |
1033 // xreddymn Aug-26-2004, MMI-SPR-24113 (TII_MMS53) and MMI-SPR-23972 (TII_MMS41) | |
1034 // Removed the following lines since this is done in MWM_DESTROY of MMSBox_Extract_exec_cb | |
1035 #if(0) | |
1036 /* NOTES: | |
1037 * The PP Session must be closed | |
1038 */ | |
1039 DAL_CloseMessageSession(msgHandle); | |
1040 | |
1041 /* Free the memory allocated before */ | |
1042 pObjArray->oms.freeFunc(pObjArray); | |
1043 pObjData->oms.freeFunc(pObjData); | |
1044 #endif | |
1045 return ENoError; | |
1046 } | |
1047 /***************************************************************************** | |
1048 * Func : SaveObject | |
1049 * Desc : User selects the object being saved | |
1050 *****************************************************************************/ | |
1051 ESTATUS M4_SaveObject(PP_OBJECT_ID objId, EVT_HANDLE parentHandle) | |
1052 { | |
1053 ESTATUS status = ENoError; | |
1054 EVT_HANDLE evtHandle = NULL; | |
1055 | |
1056 // xreddymn Nov-26-2004 MMI-SPR-25278 | |
1057 //xrashmic 08 Feb, 2005 MMI-SPR-27853 | |
1058 //Added few more parameters for this function | |
1059 g_inSaveModeWin=information_dialog(TxtPleaseWait,TxtNull,NULL,NULL,TxtNull,TxtNull,FOREVER,0,NULL); | |
1060 | |
1061 status = DAL_GetObjectByID(msgHandle, objId, &pObjData); | |
1062 TRACE_EVENT_P1("DAL_GetObjectByID :%d", status); | |
1063 | |
1064 if(ENoError != status) | |
1065 { | |
1066 return status; | |
1067 } | |
1068 | |
1069 status = DAL_GetObjectAttributes(msgHandle, objId, &pObjAttrib); | |
1070 TRACE_EVENT_P1("DAL_GetObjectAttributes :%d", status); | |
1071 | |
1072 if(ENoError != status) | |
1073 { | |
1074 pObjData->oms.freeFunc(pObjData); | |
1075 return status; | |
1076 } | |
1077 | |
1078 pItem = (M4_S_OBJECT_ITEM *)ALLOC_MEMORY(sizeof(M4_S_OBJECT_ITEM)); | |
1079 | |
1080 pAttrib = (M4_S_OBJECT_ATTRIB *)ALLOC_MEMORY(sizeof(M4_S_OBJECT_ATTRIB)); | |
1081 | |
1082 evtHandle = (EVT_HANDLE)ALLOC_MEMORY(sizeof(EVT_STRUCT)); | |
1083 | |
1084 if((NULL == evtHandle) || (NULL == pItem) || (NULL == pAttrib)) | |
1085 { | |
1086 if(pItem) | |
1087 { | |
1088 FREE_MEMORY((void*)pItem,sizeof(*pItem)); | |
1089 } | |
1090 | |
1091 if(pAttrib) | |
1092 { | |
1093 FREE_MEMORY((void*)pAttrib,sizeof(*pAttrib)); | |
1094 } | |
1095 | |
1096 if(evtHandle) | |
1097 { | |
1098 FREE_MEMORY((void*)evtHandle,sizeof(*evtHandle)); | |
1099 } | |
1100 return EOutOfMemory; | |
1101 } | |
1102 | |
1103 memset((void*)pItem, 0x00, sizeof(M4_S_OBJECT_ITEM)); | |
1104 memset((void*)pAttrib, 0x00, sizeof(M4_S_OBJECT_ATTRIB)); | |
1105 memset((void*)evtHandle, 0x00, sizeof(EVT_STRUCT)); | |
1106 | |
1107 /* NOTES: | |
1108 * Copy the information into appropriate structure | |
1109 */ | |
1110 pItem->memHdr.freeFunc = M4_FreeItem;/* Object free function */ | |
1111 pItem->objectSize = pObjData->lObjectDataSize; | |
1112 pItem->pData = pObjData->objData.pByteData; | |
1113 | |
1114 pAttrib->memHdr.freeFunc = M4_FreeAttrib;/* Object free function */ | |
1115 pAttrib->type = pObjAttrib->contentType/* Object Type: EMtMimeWbmp, etc*/; | |
1116 pAttrib->objectSize = pObjData->lObjectDataSize; | |
1117 pAttrib->drmInfo = EDrmNotSet; /* DRM info */ | |
1118 pAttrib->objectFile.fileNameLen = len_medianame; /* User Input FileName Size */ ; | |
1119 pAttrib->objectFile.pFileName = medianame; /* User Input File Name */; | |
1120 | |
1121 | |
1122 /* NOTES: | |
1123 * Setup the event handler | |
1124 */ | |
1125 | |
1126 evtHandle->handler = M4_SaveObjectDone; | |
1127 evtHandle->pData = pObjData; | |
1128 evtHandle->parentEvtHandle = parentHandle; | |
1129 | |
1130 status = DAL_StoreObjectAsync(evtHandle, pItem, pAttrib); | |
1131 TRACE_EVENT_P1("DAL_StoreObjectAsync :%d", status); | |
1132 | |
1133 return status; | |
1134 } | |
1135 | |
1136 /***************************************************************************** | |
1137 * Func: PPOpenMessageCallback | |
1138 * Desc: | |
1139 *****************************************************************************/ | |
1140 ESTATUS M4_PPOpenMessageCallback(EVENT_ID aeId, | |
1141 EVENT_TYPE aeType, | |
1142 MESSAGE_PARAM ampParam, | |
1143 EVT_HANDLE evtHandle) | |
1144 { | |
1145 ESTATUS status = ENoError; | |
1146 PP_OBJECT_ID objId; | |
1147 T_MFW_HND win = mfwParent(mfw_header()); | |
1148 //M4_DebugStringMessage("M4_PPOpenMessageCallback", sizeof("M4_PPOpenMessageCallback"), 0); | |
1149 | |
1150 switch(aeId) | |
1151 { | |
1152 case(EMG4_FileOpDone): | |
1153 { | |
1154 /* | |
1155 * The PP Session is ready for listing objects available | |
1156 */ | |
1157 msgHandle = (PP_MESSAGE_HANDLE)ampParam; | |
1158 | |
1159 status = DAL_ListMessageObjects(msgHandle, &pObjArray); | |
1160 | |
1161 /* User use the this information to display the associated objects | |
1162 * in this message | |
1163 */ | |
1164 //M4_DebugStringMessage("DAL_ListMessageObjects", sizeof("DAL_ListMessageObjects"), 0); | |
1165 M4_DebugMessage(status); | |
1166 //M4_DebugStringMessage("pObjArray->numOfObjects", sizeof("pObjArray->numOfObjects"), pObjArray->numOfObjects); | |
1167 M4_DebugMessage(pObjArray->numOfObjects); | |
1168 if(pObjArray==NULL || pObjArray->numOfObjects==0) | |
1169 { | |
1170 //SEND_EVENT(win, MWM_EXTRACT_MEDIA_NONE, 0, 0); | |
1171 MMSBox_Extract_exec_cb (win, MWM_EXTRACT_MEDIA_NONE, 0, 0); | |
1172 }else | |
1173 { | |
1174 // SEND_EVENT(win, MWM_EXTRACT_MEDIA_LIST, 0, 0); | |
1175 MMSBox_Extract_exec_cb (win, MWM_EXTRACT_MEDIA_LIST, 0, 0); | |
1176 } | |
1177 } | |
1178 break; | |
1179 | |
1180 case(EMG4_OpError): | |
1181 // xreddymn Aug-20-2004 MMI-SPR-23962 (TII_MMS31): Added error handling | |
1182 //SEND_EVENT(win, MMS_EXTRACT_MEDIA_ERROR, 0, 0); | |
1183 MMSBox_Extract_exec_cb (win, MMS_EXTRACT_MEDIA_ERROR, 0, 0); | |
1184 break; | |
1185 | |
1186 default: | |
1187 break; | |
1188 } | |
1189 | |
1190 if(evtHandle) | |
1191 { | |
1192 FREE_MEMORY ((void *)evtHandle, sizeof (EVT_STRUCT)); | |
1193 } | |
1194 | |
1195 return ENoError; | |
1196 } | |
1197 | |
1198 ESTATUS M4_ExtractMedia(MM_MESSAGE_ID selectedMsgId, EVT_HANDLE parentHandle) | |
1199 { | |
1200 EVT_HANDLE evtHandler = NULL; | |
1201 ESTATUS status = ENoError; | |
1202 | |
1203 evtHandler = (EVT_HANDLE)ALLOC_MEMORY(sizeof(EVT_STRUCT)); | |
1204 | |
1205 if(NULL == evtHandler) | |
1206 { | |
1207 /* Error */ | |
1208 return EOutOfMemory; | |
1209 } | |
1210 | |
1211 memset((void*)evtHandler, 0x00, sizeof(EVT_STRUCT)); | |
1212 | |
1213 evtHandler->handler = M4_PPOpenMessageCallback; | |
1214 evtHandler->parentEvtHandle = parentHandle; | |
1215 | |
1216 /* | |
1217 * Open the PP session & wait for EMG4_FileOpDone | |
1218 */ | |
1219 | |
1220 status = DAL_OpenMessageAsync(evtHandler, selectedMsgId); | |
1221 TRACE_EVENT_P1("DAL_OpenMessageAsync :%d", status); | |
1222 if(ENoError != status) | |
1223 { | |
1224 FREE_MEMORY ((void *)evtHandler, sizeof (EVT_STRUCT)); | |
1225 } | |
1226 return status; | |
1227 } | |
1228 | |
1229 ESTATUS DeleteMsgCallback(EVENT_ID aeId, | |
1230 EVENT_TYPE aeType, | |
1231 MESSAGE_PARAM ampParam, | |
1232 EVT_HANDLE evtHandle) | |
1233 { | |
1234 switch(aeId) | |
1235 { | |
1236 case(EMG4_FileOpDone): | |
1237 /* | |
1238 * Msg Delete Successful | |
1239 */ | |
1240 // xreddymn Dec-20-2004 MMI-SPR-27382: Remove the "Please wait" screen | |
1241 winDelete(g_MmsPleaseWaitWin); | |
1242 // xreddymn Nov-30-2004 MMI-SPR-23981: Reload the message list | |
1243 MMI_DestoryWindow(g_OptionsWin); | |
1244 SEND_EVENT (g_MmsBoxWin, MWM_REDRAW, 0,(void *)folder); | |
1245 break; | |
1246 | |
1247 case(EMG4_OpError): | |
1248 /* | |
1249 * Msg Delete Fail with error code in ampParam | |
1250 */ | |
1251 // xreddymn Dec-20-2004 MMI-SPR-27382: Remove the "Please wait" screen | |
1252 winDelete(g_MmsPleaseWaitWin); | |
1253 // xreddymn Nov-30-2004 MMI-SPR-23981: Display an error dialog | |
1254 MMI_DestoryWindow(g_OptionsWin); | |
1255 SEND_EVENT (g_MmsBoxWin, MWM_REDRAW, 0,(void *)folder); | |
1256 break; | |
1257 default: | |
1258 break; | |
1259 } | |
1260 | |
1261 if(evtHandle) | |
1262 { | |
1263 FREE_MEMORY ((void *)evtHandle, sizeof (EVT_STRUCT)); | |
1264 | |
1265 } | |
1266 } | |
1267 /***************************************************************************** | |
1268 * | |
1269 *****************************************************************************/ | |
1270 ESTATUS DeleteMsg(MM_MESSAGE_ID msgId) | |
1271 { | |
1272 EVT_HANDLE evtHandle = NULL; | |
1273 | |
1274 evtHandle = (EVT_HANDLE)ALLOC_MEMORY(sizeof(EVT_STRUCT)); | |
1275 | |
1276 if(NULL == evtHandle) | |
1277 { | |
1278 return EOutOfMemory; | |
1279 } | |
1280 | |
1281 memset((void*)evtHandle, 0x00, sizeof(EVT_STRUCT)); | |
1282 | |
1283 evtHandle->handler = DeleteMsgCallback; | |
1284 | |
1285 (void)DAL_DeleteMessageAsync(evtHandle, msgId); | |
1286 | |
1287 return ENoError; | |
1288 } | |
1289 | |
1290 | |
1291 #endif | |
1292 | |
1293 static T_MFW_HND l_extractwin=NULL; | |
1294 static char topic[16]; | |
1295 | |
1296 | |
1297 static void MMSBox_ExtractMedia_edit_cb( T_MFW_HND win, USHORT Identifier,UBYTE reason) | |
1298 { | |
1299 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
1300 T_DISPLAY_DATA display_info; | |
1301 ESTATUS status; | |
1302 | |
1303 TRACE_EVENT_P1("MMSBox_ExtractMedia_edit_cb() %d", Identifier); | |
1304 | |
1305 switch (reason) | |
1306 { | |
1307 case INFO_KCD_LEFT: // confirm (press LEFT soft key) | |
1308 { | |
1309 | |
1310 | |
1311 MMS_ConvertStringToUcs2((const MByte *)(topic), | |
1312 strlen(topic), | |
1313 medianame); | |
1314 | |
1315 len_medianame=2*(strlen(topic)+1); | |
1316 status=M4_SaveObject((PP_OBJECT_ID)Identifier, 0); | |
1317 if(status==ENoError) | |
1318 { | |
1319 }else if(status==EObjectAlreadyExists) | |
1320 { | |
1321 | |
1322 }else | |
1323 { | |
1324 } | |
1325 } | |
1326 break; | |
1327 | |
1328 case INFO_KCD_RIGHT: | |
1329 case INFO_KCD_HUP: | |
1330 //xreddymn Aug-20-2004 MMI-SPR-24114 (TII_MMS54) | |
1331 //MMI_DestoryWindow(win); | |
1332 break; | |
1333 default: | |
1334 TRACE_EVENT("Err: Default"); | |
1335 break; | |
1336 } | |
1337 g_MmsExtractEdtWin=NULL;//xrashmic 23 Nov, 2005 MMI-SPR-OMAPS00047637 | |
1338 } | |
1339 | |
1340 /******************************************************************************* | |
1341 | |
1342 $Function: MMSBoxList_ExtractMedia_cb | |
1343 | |
1344 $Description: Callback function for the melody list. | |
1345 | |
1346 $Returns: none | |
1347 | |
1348 $Arguments: Parent - parent window. | |
1349 ListData - Menu item list | |
1350 *******************************************************************************/ | |
1351 | |
1352 void MMSBoxList_ExtractMedia_cb(T_MFW_HND * Parent, ListMenuData * ListData) | |
1353 { | |
1354 TRACE_EVENT_P1("MMSBoxList_ExtractMedia_cb : %d", ListData->Reason); | |
1355 TRACE_EVENT_P2("ExtractMedia win parent: %x, l_extractwin: %x", Parent,l_extractwin); | |
1356 | |
1357 if ((ListData->Reason EQ LISTS_REASON_BACK) || (ListData->Reason EQ LISTS_REASON_CLEAR) | |
1358 || (ListData->Reason EQ LISTS_REASON_HANGUP)) // sbh - added hangup key | |
1359 { | |
1360 listsDestroy(ListData->win); | |
1361 MMI_DestoryWindow(l_extractwin); | |
1362 } | |
1363 else if(ListData->Reason EQ LISTS_REASON_SELECT) | |
1364 { | |
1365 T_AUI_EDITOR_DATA editor_data; | |
1366 | |
1367 AUI_edit_SetDefault(&editor_data); | |
1368 AUI_edit_SetDisplay(&editor_data, CENTRE_EDITOR, COLOUR_EDITOR_XX, EDITOR_FONT); | |
1369 | |
1370 //xreddymn Sep-24-2004 MMI-SPR-25148 : Modified this to get the object index from the array of indices | |
1371 // AUI_edit_SetEvents(&editor_data, (USHORT)( pObjArray->pMsgObject[ListData->CursorPosition].objId), | |
1372 // TRUE, FOREVER, (T_AUI_EDIT_CB)MMSBox_ExtractMedia_edit_cb); | |
1373 AUI_edit_SetEvents(&editor_data, (USHORT)( pObjArray->pMsgObject[extra_menu_list_indices[ListData->CursorPosition]].objId), | |
1374 TRUE, FOREVER, (T_AUI_EDIT_CB)MMSBox_ExtractMedia_edit_cb); | |
1375 AUI_edit_SetTextStr(&editor_data, TxtSoftOK, TxtDelete, TxtTopics, NULL); | |
1376 AUI_edit_SetAltTextStr(&editor_data, 0, TxtNames, TRUE, TxtSoftBack); | |
1377 //AUI_edit_SetMode(&editor_data,ED_MODE_ALL, ED_CURSOR_UNDERLINE); | |
1378 AUI_edit_SetMode(&editor_data,ED_MODE_ALPHA, ED_CURSOR_UNDERLINE); | |
1379 AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, (UBYTE*)topic, 16); | |
1380 g_MmsExtractEdtWin = AUI_edit_Start(ListData->win, &editor_data);//xrashmic 23 Nov, 2005 MMI-SPR-OMAPS00047637 | |
1381 } | |
1382 } | |
1383 | |
1384 /******************************************************************************* | |
1385 | |
1386 $Function: MMSBox_Extract_exec_cb | |
1387 | |
1388 $Description: Exec callback function for the Option window | |
1389 | |
1390 $Returns: none | |
1391 | |
1392 $Arguments: win - current window | |
1393 event - event id | |
1394 value - unique id | |
1395 parameter - optional data. | |
1396 | |
1397 *******************************************************************************/ | |
1398 | |
1399 /* xreddymn Aug-20-2004, MMI-SPR-23962 (TII_MMS31), Changes start: | |
1400 * Set to 1 for information display using dialog box | |
1401 * Set to 0 for information display using direct calls to display functions | |
1402 */ | |
1403 #define MMS_DIALOG_DISPLAY 1 | |
1404 | |
1405 /* In some cases, after object extraction, we may get an empty list. For such cases, | |
1406 * MMSBox_Extract_exec_list will be set to FALSE. | |
1407 */ | |
1408 BOOL MMSBox_Extract_exec_list=FALSE; | |
1409 | |
1410 /* Keeps track of the window used to display the list or empty dialog */ | |
1411 T_MFW_HND MMSBox_Extract_exec_win; | |
1412 | |
1413 /* Default key handler for MMIWindow. Control would be passed to this | |
1414 * in case a list menu is displayed, otherwise, a custom key handler will be called | |
1415 */ | |
1416 extern int MMIWindow_kbd_cb (MfwEvt e, MfwKbd *k); | |
1417 | |
1418 #if(MMS_DIALOG_DISPLAY) | |
1419 /* Call back function for the "Empty List" information dialog */ | |
1420 static void MMSBox_extract_info_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason) | |
1421 { | |
1422 switch (reason) | |
1423 { | |
1424 case INFO_KCD_HUP: | |
1425 case INFO_KCD_RIGHT: | |
1426 case INFO_KCD_CLEAR: | |
1427 MMI_DestoryWindow(MMSBox_Extract_exec_win); | |
1428 break; | |
1429 default: | |
1430 break; | |
1431 } | |
1432 } | |
1433 #endif // MMS_DIALOG_DISPLAY | |
1434 | |
1435 /* Key handler: In case of list menu, control is passed to the default key handler */ | |
1436 int MMSBox_Extract_exec_kbd_cb (MfwEvt e, MfwKbd *k) | |
1437 { | |
1438 if(MMSBox_Extract_exec_list == TRUE) | |
1439 { | |
1440 return MMIWindow_kbd_cb(e, k); | |
1441 } | |
1442 else | |
1443 { | |
1444 switch (k->code) | |
1445 { | |
1446 case KCD_HUP: | |
1447 case KCD_RIGHT: | |
1448 case KCD_CLEAR: | |
1449 MMI_DestoryWindow(MMSBox_Extract_exec_win); | |
1450 return MFW_EVENT_CONSUMED; | |
1451 break; | |
1452 default: | |
1453 return MFW_EVENT_CONSUMED; | |
1454 } | |
1455 } | |
1456 } | |
1457 | |
1458 /* xreddymn Aug-20-2004, MMI-SPR-23962 (TII_MMS31): Changes end */ | |
1459 | |
1460 void MMSBox_Extract_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter) | |
1461 /* callback handler for events sent to to trigger execution */ | |
1462 { | |
1463 int i, count; | |
1464 TRACE_FUNCTION ("MMSBox_Extract_exec_cb()"); | |
1465 //M4_DebugStringMessage("MMSBox_Extract_exec_cb", sizeof("MMSBox_Extract_exec_cb"),0); | |
1466 | |
1467 switch (event) | |
1468 { | |
1469 case MWM_CREATE: | |
1470 TRACE_EVENT(" Event: MWM_CREATE"); | |
1471 /* initialization of data */ | |
1472 msgHandle = PP_MESSAGE_HANDLE_INVALID; | |
1473 pObjData = NULL; | |
1474 pObjAttrib = NULL; | |
1475 pObjArray = NULL; | |
1476 pItem = NULL; | |
1477 pAttrib = NULL; | |
1478 M4_ExtractMedia(g_pMessageHeaderList->ppList[g_currentMessage].id, 0); | |
1479 break; | |
1480 case MWM_EXTRACT_MEDIA_NONE: | |
1481 { | |
1482 T_DISPLAY_DATA display_info; | |
1483 T_MFW_HND *win_handle; | |
1484 //M4_DebugStringMessage("pObjArray->numOfObjects==0",sizeof("pObjArray->numOfObjects==0"),0); | |
1485 //xreddymn Aug-17-2004, MMI-SPR-23962 (TII_MMS31): Moved back functionality to RSK | |
1486 dspl_Enable(0); | |
1487 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtSoftBack, TxtEmptyList, TxtNull, COLOUR_STATUS); | |
1488 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)MMSBox_info_cb, FOREVER, KEY_RIGHT|KEY_CLEAR|KEY_HUP); | |
1489 display_info.Identifier=0; | |
1490 win_handle=info_dialog (win, &display_info); | |
1491 win_show(win_handle); | |
1492 dspl_Enable(1); | |
1493 } | |
1494 break; | |
1495 // xreddymn Aug-20-2004 MMI-SPR-23962 (TII_MMS31): Added error handling | |
1496 case MMS_EXTRACT_MEDIA_ERROR: | |
1497 { | |
1498 T_DISPLAY_DATA display_info; | |
1499 T_MFW_HND *win_handle; | |
1500 dspl_Enable(0); | |
1501 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtSoftBack, TxtFailed, TxtNull, COLOUR_STATUS); | |
1502 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)MMSBox_extract_info_cb, FOREVER, KEY_RIGHT|KEY_CLEAR|KEY_HUP); | |
1503 display_info.Identifier=0; | |
1504 win_handle=info_dialog (win, &display_info); | |
1505 win_show(win_handle); | |
1506 dspl_Enable(1); | |
1507 } | |
1508 break; | |
1509 case MWM_EXTRACT_MEDIA_LIST: | |
1510 //M4_DebugStringMessage("MWM_EXTRACT_MEDIA_LIST", sizeof("MWM_EXTRACT_MEDIA_LIST"), pObjArray->numOfObjects); | |
1511 M4_DebugMessage(pObjArray->numOfObjects); | |
1512 extra_menu_list_data =(ListMenuData *) ALLOC_MEMORY(sizeof(ListMenuData)); | |
1513 // xreddymn Aug-09-2004: MMI-SPR-23920 (TII_MMS7), If the object list is empty, then break out | |
1514 if(extra_menu_list_data==NULL) | |
1515 { | |
1516 //M4_DebugStringMessage("extra_menu_list_data Alloc memory fail", sizeof("extra_menu_list_data Alloc memory fail"), 0); | |
1517 break; | |
1518 } | |
1519 extra_menu_list_data->List = (T_MFW_MNU_ITEM *)ALLOC_MEMORY( pObjArray->numOfObjects* sizeof(T_MFW_MNU_ITEM) ); | |
1520 if(extra_menu_list_data->List==NULL) | |
1521 { | |
1522 break; | |
1523 } | |
1524 // xreddymn Sep-24-2004, MMI-SPR-25148 : Allocate memory for the list of indices | |
1525 extra_menu_list_indices = (S16*) ALLOC_MEMORY(pObjArray->numOfObjects * sizeof(S16)); | |
1526 if(extra_menu_list_indices==NULL) | |
1527 { | |
1528 break; | |
1529 } | |
1530 /* xreddymn Aug-18-2004, MMI-SPR-23962 (TII_MMS31): i is now used to index into | |
1531 * extra_menu_list_data->List[] and count is used to index into pObjArray->pMsgObject[] | |
1532 * On exit of the loop, count will contain the total objects listed | |
1533 */ | |
1534 for (count = 0, i=0; i < pObjArray->numOfObjects; count++, i++) | |
1535 { | |
1536 mnuInitDataItem(&extra_menu_list_data->List[count]); | |
1537 | |
1538 extra_menu_list_data->List[count].flagFunc = item_flag_none; | |
1539 M4_DebugMessage(pObjArray->pMsgObject[i].contentType); | |
1540 //xreddymn Sep-24-2004 MMI-SPR-25148 : Insert object index into the list of indices | |
1541 extra_menu_list_indices[count]=i; | |
1542 switch(pObjArray->pMsgObject[i].contentType) | |
1543 { | |
1544 case EMtMimeJpeg: | |
1545 extra_menu_list_data->List[count].str = "Jpeg picture"; | |
1546 break; | |
1547 case EMtMimeGif: | |
1548 extra_menu_list_data->List[count].str = "Gif picture"; | |
1549 break; | |
1550 case EMtMimeBmp: | |
1551 extra_menu_list_data->List[count].str = "Bmp picture"; | |
1552 break; | |
1553 case EMtMimeWbmp: | |
1554 extra_menu_list_data->List[count].str = "WBmp picture"; | |
1555 break; | |
1556 case EMtMimePng: | |
1557 extra_menu_list_data->List[count].str = "Png picture"; | |
1558 break; | |
1559 case EMtTextPlain: | |
1560 //xreddymn Aug-17-2004 MMI-SPR-23962 (TII_MMS31): Disabled text extraction | |
1561 //extra_menu_list_data->List[i].str = "Plain text"; | |
1562 --count; | |
1563 break; | |
1564 case EMtTextPhoneNumber: | |
1565 extra_menu_list_data->List[count].str = "Phone Number"; | |
1566 break; | |
1567 case EMtTextEmail: | |
1568 extra_menu_list_data->List[count].str = "Email"; | |
1569 break; | |
1570 //xreddymn Aug-23-2004 MMI-SPR-23962 (TII_MMS31): Audio AMR included for listing | |
1571 case EMtMimeAmr: | |
1572 extra_menu_list_data->List[count].str = "Audio AMR"; | |
1573 break; | |
1574 //xreddymn Jan-31-2004 MMI-SPR-28483: Audio MIDI included for listing | |
1575 case EMtMimeMidi: | |
1576 extra_menu_list_data->List[count].str = "Audio MIDI"; | |
1577 break; | |
1578 default: | |
1579 //xreddymn Aug-17-2004 MMI-SPR-23962 (TII_MMS31): Disabled Unknown object extraction | |
1580 //extra_menu_list_data->List[i].str = "Unknown"; | |
1581 --count; | |
1582 } | |
1583 } | |
1584 // xreddymn Aug-09-2004: MMI-SPR-23962 (TII_MMS31), Display a dialog if there are no objects to extract | |
1585 if(count<=0) | |
1586 { | |
1587 MMSBox_Extract_exec_list=FALSE; | |
1588 #if(MMS_DIALOG_DISPLAY) | |
1589 { | |
1590 /* Display information using a dialog box */ | |
1591 T_DISPLAY_DATA display_info; | |
1592 T_MFW_HND *win_handle; | |
1593 dspl_Enable(0); | |
1594 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtSoftBack, TxtEmptyList, TxtNull, COLOUR_STATUS); | |
1595 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)MMSBox_extract_info_cb, FOREVER, KEY_RIGHT|KEY_CLEAR|KEY_HUP); | |
1596 display_info.Identifier=0; | |
1597 win_handle=info_dialog (win, &display_info); | |
1598 win_show(win_handle); | |
1599 dspl_Enable(1); | |
1600 } | |
1601 #else // MMS_DIALOG_DISPLAY | |
1602 { | |
1603 /* Display information directly */ | |
1604 char *str=MmiRsrcGetText(TxtEmptyList); | |
1605 dspl_Enable(0); | |
1606 dspl_SetBgdColour(COL_White); | |
1607 dspl_ClearAll(); | |
1608 dspl_SetFgdColour(COL_Black); | |
1609 dspl_TextOut(0,32,0,str); | |
1610 displaySoftKeys(TxtNull,TxtSoftBack); | |
1611 dspl_Enable(1); | |
1612 } | |
1613 #endif // MMS_DIALOG_DISPLAY | |
1614 break; | |
1615 } | |
1616 extra_menu_list_data->ListLength = count; | |
1617 extra_menu_list_data->ListPosition = 1; | |
1618 extra_menu_list_data->CursorPosition = 1; | |
1619 extra_menu_list_data->SnapshotSize = count; | |
1620 extra_menu_list_data->Font = 0; | |
1621 extra_menu_list_data->LeftSoftKey = TxtSoftSelect; | |
1622 extra_menu_list_data->RightSoftKey = TxtSoftBack; | |
1623 extra_menu_list_data->KeyEvents = KEY_ALL; | |
1624 extra_menu_list_data->Reason = 0; | |
1625 extra_menu_list_data->Strings = TRUE; | |
1626 extra_menu_list_data->Attr = &MmsBox_ExtractMedia_menuAttrib; | |
1627 extra_menu_list_data->autoDestroy = FALSE; | |
1628 listDisplayListMenu(win,extra_menu_list_data,(ListCbFunc)MMSBoxList_ExtractMedia_cb,0); | |
1629 dspl_Enable(1); | |
1630 break; | |
1631 case MWM_DESTORY: | |
1632 TRACE_EVENT(" Event: MWM_DESTORY"); | |
1633 if(extra_menu_list_data) | |
1634 { | |
1635 if(extra_menu_list_data->List && pObjArray) | |
1636 { | |
1637 FREE_MEMORY((void*)(extra_menu_list_data->List), pObjArray->numOfObjects* sizeof(T_MFW_MNU_ITEM )); | |
1638 } | |
1639 FREE_MEMORY((void*)(extra_menu_list_data),sizeof(ListMenuData)); | |
1640 } | |
1641 //xreddymn Sep-24-2004 MMI-SPR-25148 : Free memory for list of indices | |
1642 if(extra_menu_list_indices) | |
1643 { | |
1644 FREE_MEMORY((void*)extra_menu_list_indices, pObjArray->numOfObjects * sizeof(S16)); | |
1645 } | |
1646 if(pObjArray) pObjArray->oms.freeFunc(pObjArray); | |
1647 //xreddymn Aug-24-2004 MMI-SPR-23972 (TII_MMS41) and MMI-SPR-24113 (TII_MMS53): Close the message session if it hasn't been already done | |
1648 if(pObjData) pObjData->oms.freeFunc(pObjData); | |
1649 if(msgHandle!=PP_MESSAGE_HANDLE_INVALID) | |
1650 { | |
1651 DAL_CloseMessageSession(msgHandle); | |
1652 msgHandle=PP_MESSAGE_HANDLE_INVALID; | |
1653 } | |
1654 MMSBox_Extract_exec_win=NULL;//xrashmic 23 Nov, 2005 MMI-SPR-OMAPS00047637 | |
1655 break; | |
1656 case MWM_ONDRAW: | |
1657 TRACE_EVENT(" Event: MWM_ONDRAW"); | |
1658 // xreddymn Aug-20-2004, MMI-SPR-23962 (TII_MMS31): Removed direct display for now | |
1659 #if(MMS_DIALOG_DISPLAY) | |
1660 // Dialog display to be added | |
1661 #else // MMS_DIALOG_DISPLAY | |
1662 dspl_ClearAll(); | |
1663 dspl_TextOut(0,32,0,"Please Wait"); | |
1664 displaySoftKeys(TxtSoftOK,TxtSoftBack); | |
1665 #endif // MMS_DIALOG_DISPLAY | |
1666 break; | |
1667 default: | |
1668 return; | |
1669 } | |
1670 } | |
1671 | |
1672 /******************************************************************************* | |
1673 | |
1674 $Function: MMSBox_Extract_start | |
1675 | |
1676 $Description: Start the creation of the main window for Create MMS | |
1677 | |
1678 $Returns: mfw window handler | |
1679 | |
1680 $Arguments: parent_window - Parent window handler | |
1681 menuAttr - Menu attributes. | |
1682 | |
1683 *******************************************************************************/ | |
1684 T_MFW_HND MMSBox_Extract_start(T_MFW_HND parent_window, MfwMnuAttr *menuAttr) | |
1685 { | |
1686 TRACE_FUNCTION ("MMSBox_Extract_start()"); | |
1687 // xreddymn Aug-20-2004, MMI-SPR-23962 (TII_MMS31): Initialization | |
1688 MMSBox_Extract_exec_list=TRUE; | |
1689 MMSBox_Extract_exec_win=MMI_CreateWindow(parent_window, (T_DIALOG_FUNC)MMSBox_Extract_exec_cb,(void*)menuAttr,(T_MFW_CB)MMSBox_Extract_exec_kbd_cb,0,0); | |
1690 return MMSBox_Extract_exec_win; | |
1691 } | |
1692 | |
1693 | |
1694 #define MMS_BOX_OPTION_BEGIN | |
1695 | |
1696 | |
1697 /******************************************************************************* | |
1698 | |
1699 $Function: MMSBox_OPT_exec_cb | |
1700 | |
1701 $Description: Exec callback function for the Option window | |
1702 | |
1703 $Returns: none | |
1704 | |
1705 $Arguments: win - current window | |
1706 event - event id | |
1707 value - unique id | |
1708 parameter - optional data. | |
1709 | |
1710 *******************************************************************************/ | |
1711 void MMSBox_OPT_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter) | |
1712 /* callback handler for events sent to to trigger execution */ | |
1713 { | |
1714 TRACE_FUNCTION ("MMSBox_OPT_exec_cb()"); | |
1715 | |
1716 switch (event) | |
1717 { | |
1718 case MWM_CREATE: | |
1719 TRACE_EVENT(" Event: MWM_CREATE"); | |
1720 /* initialization of administrative data */ | |
1721 winShow(win); | |
1722 break; | |
1723 case MWM_DESTORY: | |
1724 TRACE_EVENT(" Event: MWM_DESTORY"); | |
1725 // xreddymn Nov-30-2004 MMI-SPR-23981: Moved this from MMSBox_Read_exec_cb | |
1726 //xrashmic 29 Nov, 2005 MMI-SPR-OMAPS00050170 | |
1727 //Only for Inbbox this check for new ems messages are necessary not for other folders | |
1728 if(folder==MM_LIST_INBOX) | |
1729 { | |
1730 if( MMS_Is_Unread_Msgs_Inbox()) | |
1731 { | |
1732 idle_data.ems = TRUE; | |
1733 } | |
1734 else | |
1735 { | |
1736 idle_data.ems = FALSE; | |
1737 } | |
1738 } | |
1739 //xrashmic 20 Dec, 2004 MMI-SPR-23921 | |
1740 // On deleting the window, set the handler to NULL | |
1741 g_OptionsWin=NULL; | |
1742 break; | |
1743 case MWM_ONDRAW: | |
1744 TRACE_EVENT(" Event: MWM_ONDRAW"); | |
1745 dspl_ClearAll(); | |
1746 displaySoftKeys(TxtSoftOK,TxtSoftBack); | |
1747 break; | |
1748 default: | |
1749 return; | |
1750 } | |
1751 } | |
1752 | |
1753 | |
1754 extern void EMS_RetriveSendMsg(UINT32 MsgId); | |
1755 // xrashmic 13 Aug, 2004 Bug: 19 | |
1756 extern T_MFW_HND EMSCreate_start(T_MFW_HND parent_window, MfwMnuAttr *menuAttr); | |
1757 | |
1758 //CRR 23963: xpradipg 26 Aug 2004 | |
1759 /******************************************************************************* | |
1760 | |
1761 $Function: MMSBox_OPT_kbd_cb | |
1762 | |
1763 $Description: Keyboard handler for the options menu | |
1764 | |
1765 $Returns: if event consumed or not | |
1766 | |
1767 $Arguments: | |
1768 | |
1769 *******************************************************************************/ | |
1770 | |
1771 static int MMSBox_OPT_kbd_cb(MfwEvt e, MfwKbd *k) | |
1772 { | |
1773 T_MFW_HND win = mfwParent(mfw_header()); | |
1774 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
1775 T_MMIWINDOW * data = (T_MMIWINDOW *)win_data->user; | |
1776 | |
1777 TRACE_FUNCTION ("MMIWindow_kbd_cb()"); | |
1778 | |
1779 if (e & KEY_LONG) | |
1780 { | |
1781 switch (k->code) | |
1782 { | |
1783 case KCD_HUP: /* back to previous menu */ | |
1784 mnuEscape(data->menu); | |
1785 break; | |
1786 case KCD_RIGHT: /* Power Down */ | |
1787 return MFW_EVENT_REJECTED; /* handled by idle */ | |
1788 default: /* no response to all other keys */ | |
1789 return MFW_EVENT_CONSUMED; | |
1790 } | |
1791 } | |
1792 else | |
1793 { | |
1794 switch (k->code) | |
1795 { | |
1796 case KCD_MNUUP: /* highlight previous entry */ | |
1797 mnuUp(data->menu); | |
1798 break; | |
1799 case KCD_MNUDOWN: /* highlight next entry */ | |
1800 mnuDown(data->menu); | |
1801 break; | |
1802 case KCD_MNUSELECT: | |
1803 case KCD_LEFT: /* activate this entry */ | |
1804 mnuSelect(data->menu); | |
1805 break; | |
1806 case KCD_HUP: /* back to previous menu */ | |
1807 case KCD_RIGHT: /* back to previous menu */ | |
1808 { | |
1809 T_MFW_HND pWin = data->parent ; | |
1810 T_MFW_WIN * pwin_data = ((T_MFW_HDR *)pWin)->data; | |
1811 T_MMIWINDOW * pdata = (T_MMIWINDOW *)pwin_data->user; | |
1812 | |
1813 mnuEscape(data->menu); | |
1814 if (pdata NEQ NULL) | |
1815 { | |
1816 SEND_EVENT (pdata->parent, MWM_REDRAW, 0,(void *)folder); | |
1817 } | |
1818 } | |
1819 break; | |
1820 default: /* no response to all other keys */ | |
1821 return MFW_EVENT_CONSUMED; | |
1822 } | |
1823 } | |
1824 return MFW_EVENT_CONSUMED; | |
1825 } | |
1826 | |
1827 | |
1828 /******************************************************************************* | |
1829 | |
1830 $Function: MMSBox_OPT_start | |
1831 | |
1832 $Description: Start the creation of the main window for Create MMS | |
1833 | |
1834 $Returns: mfw window handler | |
1835 | |
1836 $Arguments: parent_window - Parent window handler | |
1837 menuAttr - Menu attributes. | |
1838 | |
1839 *******************************************************************************/ | |
1840 T_MFW_HND MMSBox_OPT_start(T_MFW_HND parent_window, MfwMnuAttr *menuAttr) | |
1841 { | |
1842 TRACE_FUNCTION ("MMSBox_OPT_start()"); | |
1843 //CRR 23963: xpradipg 26 Aug 2004 | |
1844 //keyboard handler added for the options menu | |
1845 // xreddymn Nov-30-2004 MMI-SPR-23981: Retain handle to Message Options sub-menu window | |
1846 if(g_pMessageHeaderList->ppList[g_currentMessage].type==EMtSms) | |
1847 { | |
1848 //xrashmic 7 Dec, 2004 MMI-SPR-23965 | |
1849 // Separate Option list for EMS. | |
1850 g_OptionsWin=MMI_CreateWindow(parent_window, (T_DIALOG_FUNC)MMSBox_OPT_exec_cb,(void*)menuAttr,(T_MFW_CB)MMSBox_OPT_kbd_cb,&EMSBox_OPTAttrib,0); | |
1851 } | |
1852 else | |
1853 { | |
1854 g_OptionsWin=MMI_CreateWindow(parent_window, (T_DIALOG_FUNC)MMSBox_OPT_exec_cb,(void*)menuAttr,(T_MFW_CB)MMSBox_OPT_kbd_cb,&MMSBox_OPTAttrib,0); | |
1855 } | |
1856 return g_OptionsWin; | |
1857 } | |
1858 //menu call back | |
1859 static int MMSBox_OPTexeRead(MfwMnu* m, MfwMnuItem* i) | |
1860 { | |
1861 T_MFW_HND win = mfwParent(mfw_header()); | |
1862 MMSBox_Read_start(win, NULL); | |
1863 } | |
1864 // May 11 2005 REF: MMI-SPR-29887 x0012849 | |
1865 // New Function which is called when tried to retrieve the incomplete MMS. | |
1866 /******************************************************************************* | |
1867 $Function: MMSBox_OPTexeDeferDownload | |
1868 $Description: Starts the retrieval of MMS from the server | |
1869 $Returns: | |
1870 $Arguments: | |
1871 *******************************************************************************/ | |
1872 extern T_idle idle_data; | |
1873 static int MMSBox_OPTexeDeferDownload(MfwMnu* m, MfwMnuItem* i) | |
1874 { | |
1875 T_MFW_HND dlg_win = NULL; | |
1876 TRACE_EVENT("MMSBox_OPTexeDeferDownload"); | |
1877 MMSactive = TRUE ; | |
1878 if (idle_data.search) | |
1879 { | |
1880 dlg_win= information_dialog(TxtNotConnected,TxtNull,NULL,NULL, TxtNull,TxtNull,TWO_SECS,0,NULL); | |
1881 return 1; | |
1882 } | |
1883 DeferDownloadMsg(g_pMessageHeaderList->ppList[g_currentMessage].id); | |
1884 return 0; | |
1885 } | |
1886 // May 12 2005 REF: MMI-SPR-29887 x0012849 | |
1887 // New Function which is called when tried to retrieve the incomplete MMS. | |
1888 /******************************************************************************* | |
1889 $Function: DeferDownloadMsg | |
1890 $Description: Starts the retrieval of MMS from the server | |
1891 $Returns: return the status of the operation. | |
1892 $Arguments: msgID - For which the MMS body need to be retrieved | |
1893 *******************************************************************************/ | |
1894 | |
1895 void DeferDownloadMsg(MM_MESSAGE_ID msgId) | |
1896 { | |
1897 | |
1898 MM_S_MESSAGE_HEADER *appMessageHeader; | |
1899 TRACE_FUNCTION ("DeferDownloadMsg()"); | |
1900 // Jun 23 2005 REF: MMI-SPR-29887 x0012849 | |
1901 is_downloadcancelled=FALSE; | |
1902 is_deferdownload = TRUE; | |
1903 AUI_mms_status_notify(MMS_RECEIVE_PROGRESS); | |
1904 MMSDownLoadNow(msgId); | |
1905 // May 11 2005 REF: MMI-SPR-29887 xrashmi | |
1906 AUI_retrievemms_gprs_set_callback(); | |
1907 } | |
1908 | |
1909 // May 12 2005 REF: MMI-SPR-29887 x0012849 | |
1910 // New Function which is called when tried to retrieve the incomplete MMS. | |
1911 /******************************************************************************* | |
1912 $Function: MMSDownLoadNow | |
1913 $Description: Starts the download of MMS from the server | |
1914 $Returns: return the status of the operation. | |
1915 $Arguments: msgID - For which the MMS body need to be retrieved | |
1916 *******************************************************************************/ | |
1917 | |
1918 void MMSDownLoadNow(MM_MESSAGE_ID msgId) | |
1919 { | |
1920 EVT_HANDLE evtHandle = NULL; | |
1921 ESTATUS status; | |
1922 TRACE_FUNCTION ("MMSDownLoadNow()"); | |
1923 evtHandle = (EVT_HANDLE)ALLOC_MEMORY(sizeof(EVT_STRUCT)); | |
1924 if(NULL == evtHandle) | |
1925 return; | |
1926 is_deferdownload = TRUE; | |
1927 is_notifyResponse= TRUE; | |
1928 // Jun 23 2005 REF: MMI-SPR-29887 x0012849 | |
1929 rtvprogressValue=0; | |
1930 memset((void*)evtHandle, 0x00, sizeof(EVT_STRUCT)); | |
1931 evtHandle->handler = DeferDownloadMsgCallback; | |
1932 status = DAL_GetMessageAsync(evtHandle, msgId); | |
1933 } | |
1934 | |
1935 // May 12 2005 REF: MMI-SPR-29887 x0012849 | |
1936 // New Function which is called when tried to retrieve the incomplete MMS. | |
1937 /******************************************************************************* | |
1938 $Function: DeferDownloadMsgCallback | |
1939 $Description: Starts the retrieval of MMS from the server | |
1940 $Returns: status of the operation | |
1941 $Arguments: | |
1942 *******************************************************************************/ | |
1943 | |
1944 static ESTATUS DeferDownloadMsgCallback(EVENT_ID aeId, | |
1945 EVENT_TYPE aeType, | |
1946 MESSAGE_PARAM ampParam, | |
1947 EVT_HANDLE evtHandle) | |
1948 { | |
1949 | |
1950 | |
1951 BOOL deferdownload_finish = FALSE; | |
1952 TRACE_FUNCTION ("DeferDownloadMsgCallback()"); | |
1953 switch(aeId) | |
1954 { | |
1955 case(EMG4_NetworkOpDone): | |
1956 deferdownload_finish = TRUE; | |
1957 break; | |
1958 case(EMG4_OpProgress): | |
1959 deferdownload_finish = FALSE; | |
1960 // Jun 23 2005 REF: MMI-SPR-29887 x0012849 | |
1961 // Whenever there is a progress while retrieving MMS, update the display with the value.. | |
1962 if(FALSE== is_downloadcancelled && (ampParam > ( rtvprogressValue +5 )) ) | |
1963 { | |
1964 | |
1965 if(ampParam < 0) | |
1966 rtvprogressValue=0; | |
1967 else if(ampParam > 95 ) | |
1968 rtvprogressValue=100; | |
1969 else | |
1970 rtvprogressValue=ampParam; | |
1971 AUI_mms_status_notify(MMS_RECEIVE_PROGRESS ); | |
1972 } | |
1973 break; | |
1974 case(EMG4_OpError): | |
1975 deferdownload_finish = TRUE; | |
1976 break; | |
1977 default: | |
1978 break; | |
1979 } | |
1980 if(deferdownload_finish == TRUE) | |
1981 { | |
1982 if(evtHandle) | |
1983 { | |
1984 FREE_MEMORY ((void *)evtHandle, sizeof (EVT_STRUCT)); | |
1985 } | |
1986 | |
1987 } | |
1988 } | |
1989 static int MMSBox_OPTexeExtract(MfwMnu* m, MfwMnuItem* i) | |
1990 { | |
1991 T_MFW_HND win = mfwParent(mfw_header()); | |
1992 l_extractwin=MMSBox_Extract_start(win, NULL); | |
1993 } | |
1994 | |
1995 // xreddymn Oct-14-2004 MMI-SPR-25273 | |
1996 extern char EmsNumber[]; | |
1997 extern BOOL gEmsForward; | |
1998 extern UINT32 gEmsMsgId; | |
1999 | |
2000 static int MMSBox_OPTexeForward(MfwMnu* m, MfwMnuItem* i) | |
2001 { | |
2002 // xreddymn Oct-14-2004 MMI-SPR-25273: Re-implemented this function | |
2003 // xreddymn Oct-14-2004 MMI-SPR-25273: Added forward feature for EMS messages | |
2004 if(g_pMessageHeaderList->ppList[g_currentMessage].type==EMtSms) | |
2005 { | |
2006 #ifdef FF_MMI_EMS | |
2007 T_MFW_HND win = mfwParent(mfw_header()); | |
2008 gEmsForward=TRUE; | |
2009 gEmsMsgId = g_pMessageHeaderList->ppList[g_currentMessage].id; | |
2010 /* 1 -> Insert existing phone number into the editor | |
2011 * 0 -> Start with blank phone number editor | |
2012 */ | |
2013 #if(0) | |
2014 { | |
2015 U16 *data; | |
2016 S32 length; | |
2017 data=(U16*)(g_pMessageHeaderList->ppList[g_currentMessage].messageTypeHeader.smsHeader.pszAddress); | |
2018 length=GetStringBytes((const UCS2 *)data); | |
2019 if(length>0) | |
2020 { | |
2021 ConvertUcs2To8BitString((const UCS2 * const)g_pMessageHeaderList->ppList[g_currentMessage].messageTypeHeader.smsHeader.pszAddress, | |
2022 length,(MByte*)EmsNumber); | |
2023 } | |
2024 else /* If the number is not valid, then start with blank number and ask the user to input */ | |
2025 { | |
2026 strcpy((char*)EmsNumber,""); | |
2027 } | |
2028 } | |
2029 #else // if(0) | |
2030 // Clear the number - Start with a blank number on the phone number input screen | |
2031 strcpy((char*)EmsNumber,""); | |
2032 #endif // if(0) | |
2033 EMSCreate_start(win, 0); | |
2034 #endif // FF_MMI_EMS | |
2035 } | |
2036 //xrashmic 14 Dec, 2004 MMI-SPR-23921 | |
2037 // Added forward feature for MMS messages | |
2038 else | |
2039 { | |
2040 MMSactive=TRUE; | |
2041 MMSFwd_start(); | |
2042 } | |
2043 | |
2044 } | |
2045 | |
2046 // Nov 05, 2005 REF: OMAPS00049502 Sumanth Kumar. C | |
2047 // Fix: An external variable to store the Mms Number extracted from the message header. | |
2048 extern char MmsNumber[]; | |
2049 | |
2050 static int MMSBox_OPTexeReply(MfwMnu* m, MfwMnuItem* i) | |
2051 { | |
2052 T_MFW_HND win = mfwParent(mfw_header()); | |
2053 //Nov 05, 2005 REF: OMAPS00049502 Sumanth Kumar. C | |
2054 //Fix: A local variable to store the length of the senders address. | |
2055 S32 length; | |
2056 | |
2057 // xrashmic 13 Aug, 2004 Bug: 19 | |
2058 // When reply is selected for a message from the inbox, we need to display corresponding | |
2059 // compose screen i.e either EMS compose or MMS compose screen | |
2060 // TRACE_EVENT("Message Type = %d",g_pMessageHeaderList->ppList[g_currentMessage].type); | |
2061 if(g_pMessageHeaderList->ppList[g_currentMessage].type==EMtSms) | |
2062 { | |
2063 #ifdef FF_MMI_EMS | |
2064 EMSCreate_start(win, 0); | |
2065 #endif | |
2066 } | |
2067 else | |
2068 { | |
2069 #ifdef FF_MMI_MMS | |
2070 //Nov 05, 2005 REF: OMAPS00049502 Sumanth Kumar. C | |
2071 //Fix: Extraction of Senders number from the message header in the form of Unicode and converting it to 8bit string. | |
2072 length=GetStringBytes((const UCS2 *)g_pMessageHeaderList->ppList[g_currentMessage].messageTypeHeader.mmsHeader.pFrom); | |
2073 if(length>0) | |
2074 { | |
2075 ConvertUcs2To8BitString((const UCS2 * const)g_pMessageHeaderList->ppList[g_currentMessage].messageTypeHeader.mmsHeader.pFrom, | |
2076 length,(MByte*)MmsNumber); | |
2077 } | |
2078 else /* If the number is not valid, then start with blank number and ask the user to input */ | |
2079 { | |
2080 strcpy((char*)MmsNumber,""); | |
2081 } | |
2082 | |
2083 // Apr 07 2005 REF: MMI-SPR-27826 x0012849 | |
2084 // To avoid crash when a user replies to the MMS which is there in Inbox | |
2085 // If it is not set to TRUE , ATB_wap_content() will display the windows saying downloading data. | |
2086 MMSactive=TRUE; | |
2087 MMSCreate_start(win, 0); | |
2088 #endif | |
2089 } | |
2090 } | |
2091 | |
2092 static void MMSBox_Delete_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason) | |
2093 { | |
2094 | |
2095 TRACE_FUNCTION("MMSBox_Delete_cb"); | |
2096 | |
2097 switch (reason) | |
2098 { | |
2099 case INFO_KCD_LEFT: | |
2100 //yanbin: Call magic4 function to delete text | |
2101 DeleteMsg(g_pMessageHeaderList->ppList[g_currentMessage].id); | |
2102 // xreddymn Dec-20-2004 MMI-SPR-27382: Display a "Please Wait" screen while deleting a message | |
2103 { | |
2104 T_DISPLAY_DATA display_info; | |
2105 T_MFW_HND win = mfwParent(mfw_header()); | |
2106 | |
2107 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TxtPleaseWait, TxtNull, COLOUR_STATUS); | |
2108 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)MMSBox_Delete_cb, FOREVER, 0); | |
2109 g_MmsPleaseWaitWin=info_dialog (win, &display_info); | |
2110 } | |
2111 break; | |
2112 case INFO_KCD_HUP: | |
2113 case INFO_KCD_RIGHT: | |
2114 case INFO_KCD_CLEAR: | |
2115 //return back | |
2116 break; | |
2117 default: | |
2118 break; | |
2119 } | |
2120 } | |
2121 static int MMSBox_OPTexeDelete(MfwMnu* m, MfwMnuItem* i) | |
2122 { | |
2123 T_DISPLAY_DATA display_info; | |
2124 T_MFW_HND win = mfwParent(mfw_header()); | |
2125 dlg_initDisplayData_TextId( &display_info, TxtSoftOK, TxtSoftBack, TxtPressOk, TxtDelete, COLOUR_STATUS); | |
2126 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)MMSBox_Delete_cb, FOREVER, KEY_LEFT |KEY_RIGHT|KEY_CLEAR|KEY_HUP); | |
2127 info_dialog (win, &display_info); | |
2128 } | |
2129 | |
2130 | |
2131 | |
2132 #define PLAY_CURRENT_MMS_BEGIN | |
2133 /* | |
2134 void M4_DebugMessage_Pn ( char *format, ... ) | |
2135 { | |
2136 char trace_buf[128]; | |
2137 va_list varpars; | |
2138 | |
2139 va_start (varpars, format); | |
2140 vsprintf(trace_buf,format,varpars); | |
2141 va_end (varpars); | |
2142 //M4_DebugStringMessage(trace_buf,strlen(trace_buf), 0); | |
2143 } | |
2144 */ | |
2145 ESTATUS M4_PlayMessageEventHandlerFunc(EVENT_ID aeId, EVENT_TYPE aeType, MESSAGE_PARAM ampParam, EVT_HANDLE evtHandle) | |
2146 { | |
2147 // M4_DebugMessage_Pn("M4_PlayMessageEventHandlerFunc() aeId: %d,aeType: %d,ampParam:%d",aeId,aeType,ampParam); | |
2148 switch(aeId) | |
2149 { | |
2150 case EMG4_FileOpDone: | |
2151 // M4_DebugMessage_Pn("EMG4_FileOpDone"); | |
2152 DAL_PostMessage(EMG4_Resume,EMG4_Type_NotUsed,0,NULL); | |
2153 | |
2154 DAL_PostMessage(EMG4_PlayMode,EMG4_Type_NotUsed,EPlayModeRun,NULL); | |
2155 | |
2156 break; | |
2157 | |
2158 case EMG4_End: | |
2159 { | |
2160 // M4_DebugMessage_Pn("EMG4_End"); | |
2161 /* Message has finished */ | |
2162 FREE_MEMORY((U8*)evtHandle, sizeof(EVT_STRUCT)); | |
2163 } | |
2164 break; | |
2165 case EMG4_PlayComplete: | |
2166 // M4_DebugMessage_Pn("EMG4_PlayComplete"); | |
2167 | |
2168 /* TODO */ | |
2169 break; | |
2170 case EMG4_OpProgress: | |
2171 // M4_DebugMessage_Pn("EMG4_OpProgress"); | |
2172 dspl_TextOut(16, 16, 0,"Please wait!"); | |
2173 break; | |
2174 case EMG4_OpError: | |
2175 { | |
2176 int type; | |
2177 int module; | |
2178 int status; | |
2179 // M4_DebugMessage_Pn("EMG4_OpError"); | |
2180 | |
2181 status = (ampParam & 0x3FFF); | |
2182 module = (ampParam >> 22) & 0x1F; | |
2183 type = (ampParam >> 28) & 0x1F; | |
2184 //M4_ActionError(status); | |
2185 dspl_TextOut(16, 16, 0,"Play MMS Error!"); | |
2186 //xrashmic 23 Nov, 2005 MMI-SPR-OMAPS00047637 | |
2187 //To display the specific errors encountered | |
2188 switch(status) | |
2189 { | |
2190 case EFileNotFound: | |
2191 dspl_TextOut(16, 40, 0,"File not found"); | |
2192 break; | |
2193 case EInvalidMediaType: | |
2194 dspl_TextOut(16, 40, 0,"Media Not Supported"); | |
2195 break; | |
2196 case EMsgInComplete: | |
2197 dspl_TextOut(16, 40, 0,"Incomplete Message"); | |
2198 break; | |
2199 case EInvalidMsgId: | |
2200 dspl_TextOut(16, 40, 0,"InvalidMsgID"); | |
2201 break; | |
2202 | |
2203 } | |
2204 | |
2205 MmsReadStatus = status; | |
2206 dspl_Enable(1); | |
2207 | |
2208 FREE_MEMORY((U8*)evtHandle, sizeof(EVT_STRUCT)); | |
2209 | |
2210 } | |
2211 break; | |
2212 } | |
2213 | |
2214 return ENoError; | |
2215 } | |
2216 | |
2217 void M4_PlayMessage(MM_MESSAGE_ID aMessageID) | |
2218 { | |
2219 EVT_HANDLE evtHandler; | |
2220 TRACE_EVENT("M4_PlayMessage"); | |
2221 | |
2222 /* Create the event handler */ | |
2223 evtHandler = (EVT_HANDLE)ALLOC_MEMORY(sizeof(EVT_STRUCT)); | |
2224 | |
2225 if (evtHandler == NULL) | |
2226 { | |
2227 //M4_DebugStringMessage("M4_PlayMessage: can not alloc message!", sizeof("M4_PlayMessage: can not alloc message!"), 0); | |
2228 return; | |
2229 } | |
2230 | |
2231 memset(evtHandler, 0x00, sizeof(EVT_STRUCT)); /* Reset the structure */ | |
2232 evtHandler->handler = M4_PlayMessageEventHandlerFunc; /* Set the event handler function */ | |
2233 | |
2234 DAL_PlayMessage(evtHandler, aMessageID); | |
2235 } | |
2236 | |
2237 | |
2238 /******************************************************************************* | |
2239 | |
2240 $Function: MMSBox_read_exec_cb | |
2241 | |
2242 $Description: Exec callback function of the MMS Create window | |
2243 | |
2244 $Returns: none | |
2245 | |
2246 $Arguments: win - window handler | |
2247 event - mfw event | |
2248 parameter - optional data. | |
2249 | |
2250 *******************************************************************************/ | |
2251 void MMSBox_Read_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter) | |
2252 /* callback handler for events sent to to trigger execution */ | |
2253 { | |
2254 TRACE_FUNCTION ("MMSBox_read_exec_cb()"); | |
2255 | |
2256 switch (event) | |
2257 { | |
2258 case MWM_CREATE: | |
2259 TRACE_EVENT(" Event: MWM_CREATE"); | |
2260 //xreddymn Aug-26-2004 MMI-SPR-23926 (TII_MMS12) and MMI-SPR-24115 (TII_MMS55): M4 client will now use the display | |
2261 g_M4_display_active=TRUE; | |
2262 break; | |
2263 case MWM_ONDRAW: | |
2264 TRACE_EVENT(" Event: MWM_ONDRAW"); | |
2265 dspl_Enable(0); | |
2266 dspl_SetBgdColour(COL_White); | |
2267 dspl_ClearAll(); | |
2268 //yanbin: here call Magic4 functions to play MMS slides | |
2269 M4_PlayMessage(g_pMessageHeaderList->ppList[g_currentMessage].id); | |
2270 //CRR 25270 & CRR 25268: 13 Oct 2004 - xpradipg | |
2271 //the status of the message is not updated if it is already in the read state | |
2272 //else the header of the message is edited and the flag is set to true | |
2273 if(g_pMessageHeaderList->ppList[g_currentMessage].read!=TRUE) | |
2274 { | |
2275 MM_BeginUpdateHeader(g_pMessageHeaderList->ppList[g_currentMessage].id); | |
2276 MM_UtilSetRead(g_pMessageHeaderList->ppList[g_currentMessage].id, TRUE); | |
2277 MM_CommitUpdateHeaderAsync(NULL, g_pMessageHeaderList->ppList[g_currentMessage].id); | |
2278 // xreddymn Nov-30-2004 MMI-SPR-23981: Update g_pMessageHeaderList | |
2279 g_pMessageHeaderList->ppList[g_currentMessage].read=TRUE; | |
2280 } | |
2281 //xmzhou_trace_string_value("MMSBox_Read_win_cb: M4_PlayMessage with id = ", g_pMessageHeaderList->ppList[g_currentMessage].id); | |
2282 // xrashmic 7 Dec, 2004 MMI-SPR-23965 | |
2283 if(g_pMessageHeaderList->ppList[g_currentMessage].type==EMtSms) | |
2284 displaySoftKeys(TxtExtract,TxtSoftBack); | |
2285 else | |
2286 displaySoftKeys(NULL,TxtSoftBack); | |
2287 dspl_Enable(1); | |
2288 break; | |
2289 case MWM_DESTORY: | |
2290 TRACE_EVENT(" Event: MWM_DESTORY"); | |
2291 //xreddymn Sep-16-2004: Changes related to MMI-SPR-24735 | |
2292 dspl_Enable(1); | |
2293 //CRR 24456: 19 Oct 2004 - xpradipg | |
2294 //check if the error has occurred while playing the message if | |
2295 //post the EPlayModeStop event else reset the error | |
2296 if(MmsReadStatus == ENoError) | |
2297 { | |
2298 DAL_PostMessage(EMG4_PlayMode,EMG4_Type_NotUsed, EPlayModeStop,NULL); | |
2299 //xrashmic 23 Nov, 2005 MMI-SPR-OMAPS00047637 | |
2300 //EMG4_Exit should be done for only MMS that are sucessfully played. | |
2301 //For MMS which throw EMG4_OpError when DAL_PlayMessage is called, | |
2302 //EMG4_Exit should not be done | |
2303 DAL_PostMessage(EMG4_Exit, EMG4_Type_NotUsed, 0, NULL); | |
2304 } | |
2305 else | |
2306 { | |
2307 MmsReadStatus = ENoError; | |
2308 } | |
2309 | |
2310 // xreddymn Nov-30-2004 MMI-SPR-23981: Moved this to MMSBox_OPT_exec_cb | |
2311 #if(0) | |
2312 if(MMS_Is_Unread_Msgs_Inbox()) | |
2313 idle_data.ems = TRUE; | |
2314 else | |
2315 idle_data.ems = FALSE; | |
2316 #endif | |
2317 //xreddymn Aug-26-2004 MMI-SPR-23926 (TII_MMS12) and MMI-SPR-24115 (TII_MMS55): BMI will now use the display | |
2318 g_M4_display_active=FALSE; | |
2319 g_MmsReadWin=NULL;//xrashmic 23 Nov, 2005 MMI-SPR-OMAPS00047637 | |
2320 break; | |
2321 case MWM_SUSPEND: | |
2322 TRACE_EVENT("MWM_SUSPEND"); | |
2323 //xreddymn Sep-16-2004: Changes related to MMI-SPR-24735 | |
2324 dspl_Enable(1); | |
2325 //xreddymn Aug-27-2004 MMI-SPR-23926 (TII_MMS12) and MMI-SPR-24115 (TII_MMS55): BMI will now use the display | |
2326 g_M4_display_active=FALSE; | |
2327 DAL_PostMessage(EMG4_Suspend,EMG4_Type_NotUsed,0,NULL); | |
2328 DAL_PostMessage(EMG4_PlayMode,EMG4_Type_NotUsed, EPlayModeStop,NULL); | |
2329 break; | |
2330 case MWM_RESUME: | |
2331 TRACE_EVENT("MWM_RESUME"); | |
2332 //xreddymn Aug-27-2004 MMI-SPR-23926 (TII_MMS12) and MMI-SPR-24115 (TII_MMS55): M4 client will now use the display | |
2333 g_M4_display_active=TRUE; | |
2334 DAL_PostMessage(EMG4_Resume,EMG4_Type_NotUsed,0,NULL); | |
2335 DAL_PostMessage(EMG4_Refresh, EMG4_Type_NotUsed, 0, 0); | |
2336 break; | |
2337 default: | |
2338 break; | |
2339 } | |
2340 } | |
2341 | |
2342 /******************************************************************************* | |
2343 | |
2344 $Function: extractEMSObjects | |
2345 | |
2346 $Description: To extract user defined objects in EMS | |
2347 xrashmic 7 Dec, 2004 MMI-SPR-23965 | |
2348 | |
2349 $Returns: none | |
2350 | |
2351 $Arguments: none | |
2352 *******************************************************************************/ | |
2353 void extractEMSObjects(void) | |
2354 { | |
2355 ESTATUS status; | |
2356 attachmentInEMS=0; | |
2357 EV_GetExtractableList(EAllMessage, &apExtractableInMessage); | |
2358 if(apExtractableInMessage.NumOfAttachments) | |
2359 { | |
2360 EV_ReadExtractableItem(&apExtractableInMessage.pAttachmentsInMessage[attachmentInEMS],&appObj); | |
2361 status = M4_StoreExtractedObject((char *)appObj->objData.pByteData, appObj->lObjectDataSize, appObj->contentType); | |
2362 } | |
2363 else | |
2364 { | |
2365 apExtractableInMessage.omh.freeFunc(&apExtractableInMessage); | |
2366 //xrashmic 08 Feb, 2005 MMI-SPR-27853 | |
2367 //Added few more parameters for this function | |
2368 information_dialog(TxtNoObjects, TxtExtractable, NULL,NULL, TxtNull, TxtSoftBack, 0, KEY_RIGHT, NULL); | |
2369 } | |
2370 } | |
2371 /******************************************************************************* | |
2372 | |
2373 $Function: MMSBox_Read_kbd_cb | |
2374 | |
2375 $Description: Exec callback function for the Option window | |
2376 | |
2377 $Returns: execution status | |
2378 | |
2379 $Arguments: e - event id | |
2380 k - keyboard info | |
2381 *******************************************************************************/ | |
2382 | |
2383 int MMSBox_Read_kbd_cb (MfwEvt e, MfwKbd *k) | |
2384 /* SmsRead_R_OPT keyboard event handler */ | |
2385 { | |
2386 T_MFW_HND win = mfwParent(mfw_header()); | |
2387 TRACE_FUNCTION ("MMSBox_Read_kbd_cb()"); | |
2388 | |
2389 if (e & KEY_LONG) | |
2390 { | |
2391 switch (k->code) | |
2392 { | |
2393 case KCD_HUP: /* back to previous menu */ | |
2394 MMI_DestoryWindow(win); | |
2395 break; | |
2396 case KCD_MNUUP: | |
2397 DAL_PostMessage(EVT_StartOfMessage, EMG4_Type_NotUsed, 0, NULL); | |
2398 break; | |
2399 case KCD_MNUDOWN: | |
2400 DAL_PostMessage(EVT_EndOfMessage, EMG4_Type_NotUsed, 0, NULL); | |
2401 break; | |
2402 case KCD_MNULEFT: | |
2403 DAL_PostMessage(EVT_StartOfLine, EMG4_Type_NotUsed, 0, NULL); | |
2404 break; | |
2405 case KCD_MNURIGHT: | |
2406 DAL_PostMessage(EVT_EndOfLine, EMG4_Type_NotUsed, 0, NULL); | |
2407 break; | |
2408 case KCD_RIGHT: /* Power Down */ | |
2409 return MFW_EVENT_REJECTED; /* handled by idle */ | |
2410 default: /* no response to all other keys */ | |
2411 return MFW_EVENT_CONSUMED; | |
2412 } | |
2413 } | |
2414 else | |
2415 { | |
2416 switch (k->code) | |
2417 { | |
2418 case KCD_MNUUP: /* highlight previous entry */ | |
2419 //x0012849 Feb-03-2005 MMI-SPR-28224 | |
2420 //send scrollUp Event instead of cursorup | |
2421 DAL_PostMessage(EMG4_ScrollUp,EMG4_Type_NotUsed,0,NULL); | |
2422 break; | |
2423 case KCD_MNUDOWN: | |
2424 //x0012849 Feb-03-2005 MMI-SPR-28224 | |
2425 //send scroDown Event instead of cursordown | |
2426 DAL_PostMessage(EMG4_ScrollDown,EMG4_Type_NotUsed,0,NULL); | |
2427 break; | |
2428 case KCD_MNULEFT: | |
2429 DAL_PostMessage(EMG4_CursorLeft, EMG4_Type_NotUsed, 0, NULL); | |
2430 break; | |
2431 case KCD_MNURIGHT: | |
2432 DAL_PostMessage(EMG4_CursorRight, EMG4_Type_NotUsed, 0, NULL); | |
2433 break; | |
2434 case KCD_MNUSELECT: | |
2435 break; | |
2436 case KCD_LEFT: /* activate this entry */ | |
2437 // xrashmic 7 Dec, 2004 MMI-SPR-23965 | |
2438 // Allows the user to extract objects in the EMS message. For extracting the objects, | |
2439 // the editor has to be initialized. | |
2440 if(g_pMessageHeaderList->ppList[g_currentMessage].type==EMtSms) | |
2441 extractEMSObjects(); | |
2442 break; | |
2443 case KCD_HUP: /* back to previous menu */ | |
2444 case KCD_RIGHT: /* back to previous menu */ | |
2445 MMI_DestoryWindow(win); | |
2446 break; | |
2447 default: /* no response to all other keys */ | |
2448 return MFW_EVENT_CONSUMED; | |
2449 } | |
2450 } | |
2451 return MFW_EVENT_CONSUMED; | |
2452 } | |
2453 | |
2454 /**/ | |
2455 | |
2456 /******************************************************************************* | |
2457 | |
2458 $Function: MMSBox_Read_start | |
2459 | |
2460 $Description: Start the creation of the main window for Create MMS | |
2461 | |
2462 $Returns: mfw window handler | |
2463 | |
2464 $Arguments: parent_window - Parent window handler | |
2465 menuAttr - Menu attributes. | |
2466 | |
2467 *******************************************************************************/ | |
2468 T_MFW_HND MMSBox_Read_start(T_MFW_HND parent_window, MfwMnuAttr *menuAttr) | |
2469 { | |
2470 TRACE_FUNCTION ("MMSBox_Read_start()"); | |
2471 //xrashmic 23 Nov, 2005 MMI-SPR-OMAPS00047637 | |
2472 g_MmsReadWin= MMI_CreateWindow(parent_window, (T_DIALOG_FUNC)MMSBox_Read_exec_cb,(void*)menuAttr,(T_MFW_CB)MMSBox_Read_kbd_cb,0,0); | |
2473 | |
2474 return g_MmsReadWin; | |
2475 } | |
2476 | |
2477 | |
2478 | |
2479 /******************************************************************************* | |
2480 | |
2481 $Function: MMS_ConvertStringToUcs2 | |
2482 | |
2483 $Description: converting string to ucs2 | |
2484 | |
2485 $Returns: | |
2486 | |
2487 $Arguments: | |
2488 | |
2489 | |
2490 *******************************************************************************/ | |
2491 UCS2 * MMS_ConvertStringToUcs2 (const MByte * const p8BitString, | |
2492 const MUint uLength, | |
2493 UCS2 * pUcs2String) | |
2494 { | |
2495 if ((UCS2 *) NULL == pUcs2String) | |
2496 { | |
2497 pUcs2String = (UCS2 *)MM_MALLOC(sizeof(UCS2) * (1 + uLength)); | |
2498 } | |
2499 | |
2500 if ((UCS2 *)NULL != pUcs2String) | |
2501 { | |
2502 register MUint uIndex; | |
2503 for (uIndex = 0; uIndex < uLength; ++uIndex) | |
2504 { | |
2505 pUcs2String[uIndex] = (UCS2)p8BitString[uIndex]; | |
2506 } | |
2507 pUcs2String[uIndex] = NULLCHAR; | |
2508 } | |
2509 | |
2510 return pUcs2String; | |
2511 } | |
2512 | |
2513 //xrashmic 22 Sep, 2004 MMI-SPR-25032 | |
2514 // To play the buzzer when there are sound objects in EMS message | |
2515 //Apr 05, 2005 REF: ENH 29994 xdeepadh | |
2516 //To Play the default midi file when there are sound objects in EMS message. | |
2517 void playBuzzerForEMS(void) | |
2518 { | |
2519 | |
2520 #ifdef FF_MIDI_RINGER | |
2521 T_AS_PLAYER_TYPE player_type; | |
2522 #ifdef FF_MIDI_LOAD_FROM_MEM | |
2523 T_MELODY melody_data; | |
2524 #else | |
2525 char* midi_file; | |
2526 | |
2527 #endif | |
2528 //Nov 02, 2005 REF:ER OMAPS00039044 xdeepadh | |
2529 #ifdef FF_MIDI_LOAD_FROM_MEM | |
2530 melody_data=sounds_midi_return_memory_location(0); | |
2531 player_type=mfw_ringer_deduce_player_type(melody_data.melody_name); | |
2532 mfw_player_start_memory(player_type,(UINT32*)melody_data.melody,melody_data.melody_size,AS_VOLUME_MEDIUM,FALSE,sounds_midi_player_start_cb); | |
2533 #else | |
2534 midi_file=sounds_midi_return_file_name(0); | |
2535 player_type=mfw_ringer_deduce_player_type(midi_file); | |
2536 mfw_player_start_file(player_type,midi_file,AS_VOLUME_MEDIUM,FALSE,sounds_midi_player_start_cb); | |
2537 #endif | |
2538 #else | |
2539 UBYTE currentVoiceTone; | |
2540 currentVoiceTone = getcurrentVoiceTone(); | |
2541 audio_PlaySoundID( AUDIO_BUZZER, currentVoiceTone, 200, AUDIO_PLAY_ONCE ); | |
2542 #endif | |
2543 } | |
2544 | |
2545 //CRR 25270 & CRR 25268: 13 Oct 2004 - xpradipg | |
2546 /******************************************************************************* | |
2547 | |
2548 $Function: MMS_Is_Unread_Msgs_Inbox | |
2549 | |
2550 $Description: Lists out all the messages in the inbox and returns true if the status of one of the | |
2551 message is not set to read = true | |
2552 $Returns: | |
2553 | |
2554 $Arguments: | |
2555 | |
2556 *******************************************************************************/ | |
2557 | |
2558 int MMS_Is_Unread_Msgs_Inbox(void) | |
2559 { | |
2560 //xrashmic 29 Nov, 2005 MMI-SPR-OMAPS00050170 | |
2561 //Inbox listing params were changed in MMI-SPR-29887 | |
2562 MM_LIST_PARAM listParams = MM_LIST_INBOX|MM_LIST_NOT_RETRIEVED; | |
2563 ESTATUS eStatus=0; | |
2564 int i; | |
2565 //xrashmic 29 Nov, 2005 MMI-SPR-OMAPS00050170 | |
2566 //g_pMessageHeaderList will be populated again, hence need to release the memory already allocated to it | |
2567 if(g_pMessageHeaderList != NULL) | |
2568 M4_FreeListFolderMemory(); | |
2569 eStatus = DAL_ListMessagesByParam(&g_pMessageHeaderList, listParams); | |
2570 for(i=0;i<g_pMessageHeaderList->size;i++) | |
2571 { if(g_pMessageHeaderList->ppList[i].read == FALSE) | |
2572 return TRUE; | |
2573 } | |
2574 return FALSE; | |
2575 } | |
2576 #undef MMI_MMSBOX_C | |
2577 |