FreeCalypso > hg > leo2moko-debug
comparison g23m/condat/ms/src/bmi/mmismssend.c @ 0:509db1a7b7b8
initial import: leo2moko-r1
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 03:24:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:509db1a7b7b8 |
---|---|
1 /******************************************************************************* | |
2 | |
3 CONDAT (UK) | |
4 | |
5 ******************************************************************************** | |
6 | |
7 This software product is the property of Condat (UK) Ltd and may not be | |
8 disclosed to any third party without the express permission of the owner. | |
9 | |
10 ******************************************************************************** | |
11 | |
12 $Project name: Basic MMI | |
13 $Project code: BMI | |
14 $Module: SMS | |
15 $File: MmiSmsSend.c | |
16 $Revision: 1.0 | |
17 | |
18 $Author: Condat(UK) | |
19 $Date: 25/10/00 | |
20 | |
21 ******************************************************************************** | |
22 | |
23 Description: | |
24 | |
25 Implementation template for MMI yyy dynamic menu handling | |
26 | |
27 ******************************************************************************** | |
28 | |
29 | |
30 $History: MmiSmsSend.c | |
31 | |
32 Jan 18, 2006 REF: OMAPS00049169 x0pleela | |
33 Description: MS sends SMS with RP wrong destination address. Anite TC 34.2.8 was failing. | |
34 Solution: Removed the code where global variable reply_path_bit was reset to 0 in function | |
35 SmsSend_SEND_mfw_cb(), switch case E_SMS_MO_AVAIL | |
36 | |
37 March 2, 2005 REF: CRR 11536 x0018858 | |
38 Description: Reply path not supported while sending a reply. | |
39 Solution: Added menu option for the reply path. | |
40 | |
41 Feb 02, 2005 REF: CRR 28479 xnkulkar | |
42 Bug: While saving a SMS, if the user presses LSK while the 'Saved' dialog is displayed, the 'Saved' | |
43 dialog doesn't get dismissed. | |
44 Solution: Only RSK and Hangup keys dismiss the 'Saved' info screen and all other key presses | |
45 are ignored. | |
46 | |
47 Aug 16, 2004 REF: CRR 24323 Deepa M.D | |
48 Bug:Clenup of sprintf used for tracing | |
49 Fix:Replace the char buf[]; sprintf (buf, "...", ...); TRACE_EVENT (buf); statements by TRACE_EVENT_PX | |
50 | |
51 Aug 16, 2004 REF: CRR 24281 Deepa M.D | |
52 Bug:Go-lite Optimization Remove the unsed variable temp_conv_buffer | |
53 Fix:Removed the unused variable static UBYTE temp_conv_buffer[MAX_MSG_LEN_ARRAY]. | |
54 | |
55 | |
56 Sep 01, 2004 REF: CRR 21380 Deepa M.D | |
57 Bug:Not getting proper display, When Messages Memory is Full. | |
58 Fix:A new Dialog displaying "Full Not Saved" will be displayed, | |
59 when memory is full and saving a message fails. | |
60 | |
61 | |
62 | |
63 | |
64 Jul 13, 2004 REF: CRR 21615 Deepa M.D | |
65 Bug:Message once entered into message editor not storing in memory. | |
66 Fix:When a SMS is typed in the Editor, it is stored in a temporary buffer. | |
67 When the user accesses the editor,the temporary buffer is copied into the | |
68 Editor back. | |
69 | |
70 25/10/00 Original Condat(UK) BMI version. | |
71 | |
72 $End | |
73 | |
74 *******************************************************************************/ | |
75 | |
76 #define MMI_SMSSEND_C | |
77 | |
78 #define ENTITY_MFW | |
79 | |
80 /* includes */ | |
81 #include <string.h> | |
82 #include <stdio.h> | |
83 #include <stdlib.h> | |
84 | |
85 #if defined (NEW_FRAME) | |
86 | |
87 #include "typedefs.h" | |
88 #include "vsi.h" | |
89 #include "pei.h" | |
90 #include "custom.h" | |
91 #include "gsm.h" | |
92 | |
93 #else | |
94 | |
95 #include "STDDEFS.H" | |
96 #include "custom.h" | |
97 #include "gsm.h" | |
98 #include "vsi.h" | |
99 | |
100 #endif | |
101 #include "prim.h" | |
102 | |
103 | |
104 #include "mfw_mfw.h" | |
105 #include "mfw_win.h" | |
106 #include "mfw_kbd.h" | |
107 /* SPR#1428 - SH - New Editor changes */ | |
108 #ifndef NEW_EDITOR | |
109 #include "mfw_edt.h" | |
110 #endif | |
111 #include "mfw_tim.h" | |
112 #include "mfw_phb.h" | |
113 #include "ksd.h" | |
114 #include "psa.h" | |
115 #include "mfw_sms.h" | |
116 #include "mfw_icn.h" | |
117 #include "mfw_mnu.h" | |
118 #include "mfw_lng.h" | |
119 #include "mfw_sat.h" | |
120 #include "mfw_kbd.h" | |
121 #include "mfw_nm.h" | |
122 #include "mfw_str.h" | |
123 | |
124 #include "dspl.h" | |
125 | |
126 #include "MmiMain.h" | |
127 #include "MmiDummy.h" | |
128 #include "MmiMmi.h" | |
129 #include "MmiDialogs.h" | |
130 #include "MmiLists.h" | |
131 #include "MmiMenu.h" | |
132 #include "MmiSoftKeys.h" | |
133 #include "phb.h" /* FDN */ | |
134 #include "MmiBookUtils.h" | |
135 #include "MmiBookShared.h" | |
136 #include "mmiSmsMenu.h" | |
137 #include "mmismssend.h" | |
138 #include "mmiSmsIdle.h" | |
139 #include "mmiSat_i.h" | |
140 #include "mfw_ffs.h" | |
141 #ifdef EASY_TEXT_ENABLED | |
142 #include "MmiChineseInput.h" | |
143 #endif | |
144 /* SPR#1428 - SH - New Editor changes */ | |
145 #ifdef NEW_EDITOR | |
146 #include "ATBCommon.h" | |
147 #include "ATBDisplay.h" | |
148 #include "ATBEditor.h" | |
149 #include "AUIEditor.h" | |
150 #else /* NEW_EDITOR */ | |
151 #ifdef EASY_TEXT_ENABLED | |
152 #include "MmiLatinPredText.h" | |
153 #endif /* EASY_TEXT_ENABLED */ | |
154 #include "MmiEditor.h" | |
155 #endif /* NEW_EDITOR */ | |
156 | |
157 #include "cus_aci.h" | |
158 | |
159 #include "prim.h" | |
160 #ifndef PCM_2_FFS | |
161 #include "pcm.h" | |
162 #endif | |
163 | |
164 | |
165 #include "mmiColours.h" | |
166 | |
167 /********************************************************************* | |
168 ********************************************************************** | |
169 | |
170 DYNAMIC MENU WINDOW. DECLARATION | |
171 | |
172 ********************************************************************* | |
173 **********************************************************************/ | |
174 /* MZ 10202, 10758 */ | |
175 static UBYTE* msgBuffer = NULL; | |
176 | |
177 /* General functions */ | |
178 static void SmsSend_NBEDIT_edit_cb (T_MFW_HND win, USHORT Identifier, SHORT reason); | |
179 static int SmsSend_standard_dialog_cb(T_MFW_HND win, USHORT Identifier, USHORT Reason); | |
180 /* SPR#1428 - SH - New Editor: no longer required */ | |
181 #ifndef NEW_EDITOR | |
182 void SmsSend_loadEditDefault(T_EDITOR_DATA * edit_info); | |
183 static void SmsSend_loadUCS2EditDefault(T_EDITOR_DATA *editor_data); | |
184 #endif | |
185 | |
186 /* prototyps */ | |
187 static T_MFW_HND SmsSend_SEND_create (T_MFW_HND parent); | |
188 static void SmsSend_SEND_destroy (T_MFW_HND window); | |
189 | |
190 // Main callback function of the frame window | |
191 static void SmsSend_main_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter); | |
192 // Sub-callback functions of the frame window associated to the different emitters | |
193 static void SmsSend_SEND_exec_cb (T_MFW_HND win, USHORT event, void * parameter); | |
194 static void SmsSend_PHBK_exec_cb (T_MFW_HND win, USHORT event, void * parameter); | |
195 static void SmsSend_TEXTEDIT_exec_cb (T_MFW_HND win, USHORT event, void * parameter); | |
196 static void SmsSend_NBEDIT_exec_cb (T_MFW_HND win, USHORT event, void * parameter); | |
197 static void SmsSend_CENTREEDIT_exec_cb (T_MFW_HND win, USHORT event, void * parameter); | |
198 | |
199 // Callback functions of the various editors | |
200 static void SmsSend_TEXTEDIT_edit_cb (T_MFW_HND win, USHORT Identifier, SHORT reason); | |
201 static void SmsSend_NBEDIT_edit_cb (T_MFW_HND win, USHORT Identifier, SHORT reason); | |
202 static void SmsSend_CENTREEDIT_edit_cb (T_MFW_HND win, USHORT Identifier, SHORT reason); | |
203 | |
204 // Callback function for the MFW events | |
205 static int SmsSend_SEND_mfw_cb (MfwEvt event, void *data); | |
206 | |
207 // This function initiate the sending of the SMS | |
208 static int SmsSend_send_to_mfw (T_MFW_HND win); | |
209 static T_MFW_HND parentWindow4SMS; | |
210 | |
211 UBYTE SmsSend_set_SrvCntr_number (T_MFW_SMS_INFO *config_data); | |
212 UBYTE SmsSend_set_dcs_number (T_MFW_SMS_INFO *config_data); | |
213 //Jul 13, 2004 REF: CRR 21615 Deepa M.D | |
214 extern UBYTE TempTextBuffer[MAX_MSG_LEN_ARRAY]; | |
215 | |
216 extern UBYTE reply_path_bit ; | |
217 | |
218 /*************************************************** | |
219 **** **** | |
220 **** MANAGEMENT OF SMS OPTIONS **** | |
221 **** **** | |
222 ***************************************************/ | |
223 | |
224 | |
225 typedef struct | |
226 { | |
227 /* administrative data */ | |
228 | |
229 T_MMI_CONTROL mmi_control; | |
230 T_MFW_HND win; | |
231 SHORT id; | |
232 T_MFW_HND parent; | |
233 | |
234 /* associated handlers */ | |
235 | |
236 /* !!! **************************************** modify here **************************************** !!!*/ | |
237 T_MFW_HND kbd; | |
238 T_MFW_HND kbd_long; | |
239 T_MFW_HND menu; | |
240 /* !!! **************************************** end modify here **************************************** !!! */ | |
241 | |
242 /* internal data */ | |
243 | |
244 /* !!! **************************************** modify here **************************************** !!!*/ | |
245 BOOL answer; /* TRUE == YES, FALSE == NO */ | |
246 T_MFW_HND sms; | |
247 T_MFW_HND dialog_win; | |
248 T_SEND *parent_data; | |
249 /* !!! **************************************** end modify here **************************************** !!! */ | |
250 } T_SMSSEND_R_OPT; | |
251 | |
252 typedef struct | |
253 { | |
254 /* administrative data */ | |
255 | |
256 T_MMI_CONTROL mmi_control; | |
257 T_MFW_HND win; | |
258 T_MFW_HND parent; | |
259 T_MFW_HND child_dialog;/* to keep the window of dialog */ | |
260 T_MFW_HND sms_handler; | |
261 SHORT id; | |
262 /*SPR1991, removed edt_data: not needed*/ | |
263 /* will call from idle or phonebook */ | |
264 } T_SAVE; | |
265 | |
266 static T_MFW_HND SmsSend_SAVE_create (T_MFW_HND parent); | |
267 static void SmsSend_SAVE_destroy (T_MFW_HND window); | |
268 static void SmsSend_SAVE_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter); | |
269 static int SmsSend_SAVE_mfw_cb (MfwEvt event, void *info); | |
270 | |
271 static T_MFW_HND SmsSend_R_OPT_create (T_MFW_HND parent); | |
272 static void SmsSend_R_OPT_destroy (T_MFW_HND window); | |
273 static void SmsSend_R_OPT_StandardDialog(T_MFW_HND win, char *text, ULONG duration); | |
274 static void SmsSend_R_OPT_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter); | |
275 static int SmsSend_R_OPT_win_cb (MfwEvt e, MfwWin *w); | |
276 static int SmsSend_R_OPT_mfw_cb (MfwEvt event, void *parameter); | |
277 T_MFW_HND SmsSend_OPT_start(T_MFW_HND parent_window, MfwMnuAttr *menuAttr); | |
278 static int SmsSend_R_OPT_dialog_cb(T_MFW_HND win, USHORT Identifier, USHORT Reason); | |
279 static void SmsSend_SCNBEDIT_edit_cb (T_MFW_HND win, USHORT Identifier, SHORT reason); | |
280 /* !!! **************************************** modify here **************************************** !!!*/ | |
281 static int SmsSend_R_OPT_kbd_cb (MfwEvt e, MfwKbd *k); | |
282 static int SmsSend_R_OPT_mnu_cb (MfwEvt e, MfwMnu *m); | |
283 //Sep 01, 2004 REF: CRR 21380 Deepa M.D | |
284 static UBYTE memfull=FALSE; //Variable used check whether E_SMS_MEM_FULL event has been received. | |
285 /* !!! **************************************** end modify here **************************************** !!! */ | |
286 | |
287 | |
288 | |
289 /********************************************************************* | |
290 ********************************************************************** | |
291 | |
292 DYNAMIC MENU WINDOW. CONTENTS DECLARATION | |
293 | |
294 ********************************************************************* | |
295 **********************************************************************/ | |
296 | |
297 /* !!! **************************************** modify here **************************************** !!!*/ | |
298 | |
299 static int SmsSend_R_OPTExeSave(MfwMnu* m, MfwMnuItem* i); | |
300 static int SmsSend_R_OPTExeSend(MfwMnu* m, MfwMnuItem* i); | |
301 static int SmsSend_R_OPTExeDiscard(MfwMnu* m, MfwMnuItem* i); | |
302 | |
303 static const MfwMnuItem SmsSend_R_OPTItems [] = | |
304 { | |
305 {0,0,0,(char *)TxtSave,0,(MenuFunc)SmsSend_R_OPTExeSave,item_flag_none}, | |
306 {0,0,0,(char *)TxtSend,0,(MenuFunc)SmsSend_R_OPTExeSend,item_flag_none}, | |
307 {0,0,0,(char *)TxtDiscard,0,(MenuFunc)SmsSend_R_OPTExeDiscard,item_flag_none} | |
308 }; | |
309 | |
310 static const MfwMnuAttr SmsSend_R_OPTAttrib = | |
311 { | |
312 &SmsSend_R_OPTArea, | |
313 MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */ | |
314 -1, /* use default font */ | |
315 (MfwMnuItem*)SmsSend_R_OPTItems, /* with these items */ | |
316 sizeof(SmsSend_R_OPTItems)/sizeof(MfwMnuItem), /* number of items */ | |
317 COLOUR_LIST_SMS, TxtNull, NULL, MNUATTRSPARE | |
318 | |
319 }; | |
320 | |
321 | |
322 /*JVJ SPR1298 added a new output parameter to avoid stack overload */ | |
323 void convertToUnicodeForOutput( UBYTE * ipText,UBYTE* outText, USHORT* outLen) | |
324 { | |
325 | |
326 int i; | |
327 UBYTE* temp_conv_buffer = outText; | |
328 | |
329 if (ipText[0] == 0x80) | |
330 { //skip first 2 chars | |
331 *outLen = 0; | |
332 for (i=0;i<MAX_MSG_LEN/2;i++) | |
333 { /*SPR 2175, bytes should not be swapped*/ | |
334 temp_conv_buffer[i*2+1] = ipText[i*2+2+1]; | |
335 temp_conv_buffer[i*2] =ipText[i*2+2]; | |
336 | |
337 | |
338 | |
339 | |
340 if ((*outLen ==0) && | |
341 (temp_conv_buffer[i*2] == 0x00) && | |
342 (temp_conv_buffer[i*2+1] == 0x00)) | |
343 *outLen = i*2+2; | |
344 } | |
345 if (*outLen == 0) | |
346 {//Reached end of message without finding 0x0000 - set last word to 0x0000 | |
347 *outLen = MAX_MSG_LEN; | |
348 temp_conv_buffer[MAX_MSG_LEN-2] = 0x00; | |
349 temp_conv_buffer[MAX_MSG_LEN-1] = 0x00; | |
350 | |
351 | |
352 } | |
353 return; | |
354 | |
355 } | |
356 else | |
357 { | |
358 *outLen = strlen((char*)ipText); | |
359 /*MC SPR1319, use string's actual length to convert to GSM alphabet*/ | |
360 /*SPR2175, use new function for conversion*/ | |
361 ATB_convert_String((char*)ipText, MFW_ASCII, *outLen, (char*)temp_conv_buffer, MFW_DCS_8bits,MAX_MSG_LEN , FALSE); | |
362 return; | |
363 } | |
364 } | |
365 | |
366 /******************************************************************************* | |
367 | |
368 $Function: SmsSend_R_OPTExeSend | |
369 | |
370 $Description: Start the creation of the main window for SMS Send. | |
371 | |
372 $Returns: none | |
373 | |
374 $Arguments: m - Menu handle | |
375 i - Menu item selected. | |
376 | |
377 *******************************************************************************/ | |
378 | |
379 static int SmsSend_R_OPTExeSend(MfwMnu* m, MfwMnuItem* i) | |
380 { | |
381 T_MFW_HND win = mfwParent(mfw_header()); | |
382 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
383 T_SMSSEND_R_OPT * data = (T_SMSSEND_R_OPT *)win_data->user; | |
384 /* access to data from parent */ | |
385 T_SEND * parent_data = (T_SEND *)data->parent_data; | |
386 | |
387 #ifdef NEW_EDITOR | |
388 T_AUI_EDITOR_DATA editor_data; /* SPR#1428 - SH - New Editor data */ | |
389 #else | |
390 T_EDITOR_DATA editor_data; | |
391 #endif | |
392 | |
393 TRACE_EVENT("SmsSend_R_OPTExeSend"); | |
394 /* SPR#1428 - SH - New Editor changes */ | |
395 #ifdef NEW_EDITOR | |
396 AUI_edit_SetDefault(&editor_data); | |
397 AUI_edit_SetDisplay(&editor_data, PHNO_EDITOR, COLOUR_EDITOR_XX, EDITOR_FONT); | |
398 AUI_edit_SetEvents(&editor_data, SMSSEND_ID_NBEDIT, FALSE, FOREVER, (T_AUI_EDIT_CB)SmsSend_NBEDIT_edit_cb); | |
399 AUI_edit_SetTextStr(&editor_data, TxtSend, TxtDelete, TxtSmsEnterNumber, NULL); | |
400 AUI_edit_SetAltTextStr(&editor_data, 1, TxtNames, TRUE, TxtSoftBack); | |
401 AUI_edit_SetMode(&editor_data, 0, ED_CURSOR_UNDERLINE); | |
402 AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, parent_data->edt_data.NumberBuffer, PHB_MAX_LEN); | |
403 parent_data->number_editor = AUI_edit_Start(parent_data->win, &editor_data); | |
404 #else /* NEW_EDITOR */ | |
405 | |
406 SmsSend_loadEditDefault(&editor_data); | |
407 | |
408 bookSetEditAttributes( PHNO_EDITOR, COLOUR_EDITOR_XX, 0, edtCurBar1, 0, | |
409 (char *) parent_data->edt_data.NumberBuffer, /*MAX_SEARCH_CHAR*/NUMBER_LENGTH, &editor_data.editor_attr); | |
410 editor_data.editor_attr.text = (char *)parent_data->edt_data.NumberBuffer; | |
411 | |
412 editor_data.editor_attr.size = PHB_MAX_LEN; | |
413 | |
414 editor_data.TextId = TxtSmsEnterNumber; | |
415 editor_data.LeftSoftKey = TxtSend; | |
416 editor_data.AlternateLeftSoftKey = TxtNames; | |
417 editor_data.RightSoftKey = TxtDelete; | |
418 editor_data.Identifier = SMSSEND_ID_NBEDIT ; | |
419 editor_data.mode = E_EDIT_DIGITS_MODE; | |
420 editor_data.Callback = (T_EDIT_CB)SmsSend_NBEDIT_edit_cb; | |
421 editor_data.destroyEditor = FALSE; | |
422 parent_data->number_editor = editor_start(parent_data->win, &editor_data); /* start the editor */ | |
423 #endif /* NEW_EDITOR */ | |
424 return 1; // ADDED BY RAVI - 28-11-2005 | |
425 | |
426 } | |
427 | |
428 /******************************************************************************* | |
429 | |
430 $Function: SmsSend_R_OPTExeDiscard | |
431 | |
432 $Description: | |
433 | |
434 $Returns: execution status | |
435 | |
436 $Arguments: m - Menu handle | |
437 i - Menu item selected. | |
438 | |
439 *******************************************************************************/ | |
440 | |
441 static int SmsSend_R_OPTExeDiscard(MfwMnu* m, MfwMnuItem* i) | |
442 { | |
443 T_MFW_HND win = mfwParent(mfw_header()); | |
444 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
445 T_SMSSEND_R_OPT * data = (T_SMSSEND_R_OPT *)win_data->user; | |
446 /* access to data from parent */ | |
447 T_SEND * parent_data = (T_SEND *)data->parent_data; | |
448 | |
449 TRACE_EVENT("SmsSend_R_OPTExeDiscard"); | |
450 | |
451 SmsSend_R_OPT_destroy(parent_data->options_win); | |
452 #if defined(CHINESE_MMI) && defined(EASY_TEXT_ENABLED) | |
453 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE) | |
454 chinese_input_destroy(parent_data->text_editor); | |
455 else | |
456 #endif | |
457 /* SPR#1428 - SH - New Editor changes */ | |
458 #ifdef NEW_EDITOR | |
459 AUI_edit_Destroy(parent_data->text_editor); | |
460 #else /* NEW_EDITOR */ | |
461 editor_destroy(parent_data->text_editor); | |
462 #endif /* NEW_EDITOR */ | |
463 /*SPR2453 check memory allocated before deallocating it */ | |
464 if (msgBuffer !=NULL) | |
465 { FREE_MEMORY((void*)msgBuffer,MAX_MSG_LEN_ARRAY); | |
466 msgBuffer = NULL; | |
467 } | |
468 parent_data->text_editor = 0; | |
469 SmsSend_SEND_destroy(parent_data->win); | |
470 | |
471 | |
472 return 1; | |
473 } | |
474 | |
475 | |
476 /******************************************************************************* | |
477 | |
478 $Function: SmsSend_R_OPTExeSave | |
479 | |
480 $Description: called when the user press Call sender in the Option menu | |
481 | |
482 $Returns: execution status | |
483 | |
484 $Arguments: m - Menu handle | |
485 i - Menu item selected. | |
486 | |
487 *******************************************************************************/ | |
488 | |
489 static int SmsSend_R_OPTExeSave(MfwMnu* m, MfwMnuItem* i) | |
490 { | |
491 T_MFW_HND win = mfwParent(mfw_header()); | |
492 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
493 T_SMSSEND_R_OPT * data = (T_SMSSEND_R_OPT *)win_data->user; | |
494 | |
495 TRACE_EVENT("SmsRead_R_OPTExeCallSender"); | |
496 | |
497 if (!smsidle_get_ready_state()) | |
498 { | |
499 // SMS init processing not ready to access SIM to store the SMS | |
500 mmi_dialog_information_screen(win, 0,"Not Ready", (T_VOID_FUNC)SmsSend_standard_dialog_cb, SMSSEND_ID_SAVE_NOT_READY); | |
501 // Recreate the editor on dialog callback | |
502 } | |
503 else | |
504 //END TB | |
505 // Start a save window and provide it a T_SmsUserData structure (in the future, will allow to save easily text but also number...) | |
506 { | |
507 SmsSend_SAVE_start(data->parent_data->win, &(data->parent_data->edt_data)); | |
508 SmsSend_R_OPT_destroy(win); | |
509 } | |
510 return 1; | |
511 } | |
512 | |
513 /******************************************************************************* | |
514 | |
515 $Function: SmsSend_OPT_start | |
516 | |
517 $Description: called when the user press Call sender in the Option menu | |
518 | |
519 $Returns: execution status | |
520 | |
521 $Arguments: parent_window -parent window handle | |
522 menuAttr - Menu attributes. | |
523 | |
524 *******************************************************************************/ | |
525 | |
526 T_MFW_HND SmsSend_OPT_start(T_MFW_HND parent_window, MfwMnuAttr *menuAttr) | |
527 { | |
528 T_MFW_HND win; | |
529 | |
530 TRACE_FUNCTION ("SmsSend_OPT_start()"); | |
531 | |
532 win = SmsSend_R_OPT_create (parent_window); | |
533 | |
534 if (win NEQ NULL) | |
535 { | |
536 SEND_EVENT (win, E_INIT, NULL, (void *)menuAttr); | |
537 } | |
538 return win; | |
539 } | |
540 | |
541 /******************************************************************************* | |
542 | |
543 $Function: SmsSend_R_OPT_create | |
544 | |
545 $Description: Create the Option window | |
546 | |
547 $Returns: mfw window handle | |
548 | |
549 $Arguments: parent_window -parent window handle | |
550 | |
551 *******************************************************************************/ | |
552 | |
553 static T_MFW_HND SmsSend_R_OPT_create(MfwHnd parent_window) | |
554 { | |
555 T_SMSSEND_R_OPT * data = (T_SMSSEND_R_OPT *)ALLOC_MEMORY (sizeof (T_SMSSEND_R_OPT)); | |
556 T_MFW_WIN * win; | |
557 | |
558 TRACE_FUNCTION ("SmsSend_R_OPT_create()"); | |
559 | |
560 /* | |
561 * Create window handler | |
562 */ | |
563 | |
564 data->win = | |
565 win_create (parent_window, 0, E_WIN_VISIBLE, (T_MFW_CB)SmsSend_R_OPT_win_cb); | |
566 if (data->win EQ NULL) | |
567 { | |
568 return NULL; | |
569 } | |
570 /* | |
571 * connect the dialog data to the MFW-window | |
572 */ | |
573 | |
574 data->mmi_control.dialog = (T_DIALOG_FUNC)SmsSend_R_OPT_exec_cb; | |
575 data->mmi_control.data = data; | |
576 win = ((T_MFW_HDR *)data->win)->data; | |
577 win->user = (void *)data; | |
578 data->parent = parent_window; | |
579 | |
580 /* | |
581 * return window handle | |
582 */ | |
583 | |
584 return data->win; | |
585 } | |
586 | |
587 /******************************************************************************* | |
588 | |
589 $Function: SmsSend_R_OPT_destroy | |
590 | |
591 $Description: Destroy the Option window | |
592 | |
593 $Returns: mfw window handle | |
594 | |
595 $Arguments: own_window - current window | |
596 | |
597 *******************************************************************************/ | |
598 | |
599 static void SmsSend_R_OPT_destroy(MfwHnd own_window) | |
600 { | |
601 T_MFW_WIN * win_data; | |
602 T_SMSSEND_R_OPT * data; | |
603 | |
604 TRACE_FUNCTION ("SmsSend_R_OPT_destroy()"); | |
605 | |
606 if (own_window) | |
607 { | |
608 win_data = ((T_MFW_HDR *)own_window)->data; | |
609 data = (T_SMSSEND_R_OPT *)win_data->user; | |
610 | |
611 if (data) | |
612 { | |
613 /* | |
614 * Delete WIN handler | |
615 */ | |
616 data->parent_data->options_win = 0; | |
617 win_delete (data->win); | |
618 | |
619 /* | |
620 * Free Memory | |
621 */ | |
622 FREE_MEMORY ((void *)data, sizeof (T_SMSSEND_R_OPT)); | |
623 } | |
624 else | |
625 { | |
626 TRACE_EVENT ("SmsSend_R_OPT_destroy() called twice"); | |
627 } | |
628 } | |
629 } | |
630 | |
631 /******************************************************************************* | |
632 | |
633 $Function: SmsSend_R_OPT_exec_cb | |
634 | |
635 $Description: Exec callback function for the Option window | |
636 | |
637 $Returns: none | |
638 | |
639 $Arguments: win - current window | |
640 event - event id | |
641 value - unique id | |
642 parameter - optional data. | |
643 | |
644 *******************************************************************************/ | |
645 | |
646 void SmsSend_R_OPT_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter) | |
647 /* callback handler for events sent to to trigger execution */ | |
648 { | |
649 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
650 T_SMSSEND_R_OPT * data = (T_SMSSEND_R_OPT *)win_data->user; | |
651 // T_MFW_HND * l_parent; // RAVI | |
652 // SHORT l_id; // RAVI | |
653 T_MFW_HDR * parent = data->parent; | |
654 T_MFW_WIN * win_data2 = ((T_MFW_HDR *)parent)->data; | |
655 T_SEND * parent_data = (T_SEND *)win_data2->user; | |
656 | |
657 // T_MFW_EVENT MfwEvents; // RAVI | |
658 | |
659 TRACE_FUNCTION ("SmsSend_R_OPT_exec_cb()"); | |
660 | |
661 | |
662 switch (event) | |
663 { | |
664 case E_INIT: | |
665 | |
666 TRACE_EVENT("SmsSend_R_OPT_exec_cb() Event:5.E_INIT"); | |
667 /* initialization of administrative data */ | |
668 data->parent_data = parent_data; | |
669 data->id = value; | |
670 data->kbd = kbdCreate(data->win,KEY_ALL, (MfwCb)SmsSend_R_OPT_kbd_cb); | |
671 data->kbd_long = kbdCreate(data->win,KEY_ALL|KEY_LONG,(MfwCb)SmsSend_R_OPT_kbd_cb); | |
672 data->menu = mnuCreate(data->win,(MfwMnuAttr*)&SmsSend_R_OPTAttrib, E_MNU_ESCAPE, (MfwCb)SmsSend_R_OPT_mnu_cb); | |
673 mnuLang(data->menu,mainMmiLng); | |
674 /* put the (new) dialog window on top of the window stack */ | |
675 mnuUnhide(data->menu); | |
676 winShow(win); | |
677 break; | |
678 default: | |
679 return; | |
680 } | |
681 } | |
682 | |
683 /******************************************************************************* | |
684 | |
685 $Function: SmsSend_R_OPT_mnu_cb | |
686 | |
687 $Description: Menu callback function for the Option window | |
688 | |
689 $Returns: none | |
690 | |
691 $Arguments: e - event id | |
692 m - menu handle | |
693 *******************************************************************************/ | |
694 | |
695 static int SmsSend_R_OPT_mnu_cb (MfwEvt e, MfwMnu *m) | |
696 | |
697 { | |
698 T_MFW_HND win = mfwParent(mfw_header()); | |
699 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
700 T_SMSSEND_R_OPT * data = (T_SMSSEND_R_OPT *)win_data->user; | |
701 // T_MFW_HND * l_parent; // RAVI | |
702 // SHORT l_id; // RAVI | |
703 | |
704 TRACE_FUNCTION ("SmsRead_R_OPT_mnu_cb()"); | |
705 | |
706 switch (e) | |
707 { | |
708 case E_MNU_ESCAPE: /* back to previous menu */ | |
709 SmsSend_R_OPT_destroy(data->win); | |
710 break; | |
711 default: /* in mnuCreate() only E_MNU_ESCAPE has been enabled! */ | |
712 return MFW_EVENT_REJECTED; | |
713 } | |
714 return MFW_EVENT_CONSUMED; | |
715 } | |
716 | |
717 /******************************************************************************* | |
718 | |
719 $Function: SmsSend_R_OPT_win_cb | |
720 | |
721 $Description: Window callback function for the Option window | |
722 | |
723 $Returns: execution status | |
724 | |
725 $Arguments: e - event id | |
726 w - window handle | |
727 *******************************************************************************/ | |
728 | |
729 static int SmsSend_R_OPT_win_cb (MfwEvt e, MfwWin *w) | |
730 { | |
731 TRACE_FUNCTION ("SmsSend_R_OPT_win_cb()"); | |
732 | |
733 switch (e) | |
734 { | |
735 case MfwWinVisible: /* window is visible */ | |
736 dspl_ClearAll(); | |
737 displaySoftKeys(TxtSoftSelect,TxtSoftBack); | |
738 break; | |
739 case MfwWinFocussed: /* input focus / selected */ | |
740 case MfwWinDelete: /* window will be deleted */ | |
741 default: | |
742 return MFW_EVENT_REJECTED; | |
743 } | |
744 return MFW_EVENT_CONSUMED; | |
745 } | |
746 | |
747 /******************************************************************************* | |
748 | |
749 $Function: SmsSend_R_OPT_kbd_cb | |
750 | |
751 $Description: Exec callback function for the Option window | |
752 | |
753 $Returns: execution status | |
754 | |
755 $Arguments: e - event id | |
756 k - keyboard info | |
757 *******************************************************************************/ | |
758 | |
759 static int SmsSend_R_OPT_kbd_cb (MfwEvt e, MfwKbd *k) | |
760 /* SmsRead_R_OPT keyboard event handler */ | |
761 { | |
762 T_MFW_HND win = mfwParent(mfw_header()); | |
763 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
764 T_SMSSEND_R_OPT * data = (T_SMSSEND_R_OPT *)win_data->user; | |
765 | |
766 TRACE_FUNCTION ("SmsSend_R_OPT_kbd_cb()"); | |
767 | |
768 if (e & KEY_LONG) | |
769 { | |
770 switch (k->code) | |
771 { | |
772 case KCD_HUP: /* back to previous menu */ | |
773 mnuEscape(data->menu); | |
774 break; | |
775 case KCD_RIGHT: /* Power Down */ | |
776 return MFW_EVENT_REJECTED; /* handled by idle */ | |
777 default: /* no response to all other keys */ | |
778 return MFW_EVENT_CONSUMED; | |
779 } | |
780 } | |
781 else | |
782 { | |
783 switch (k->code) | |
784 { | |
785 case KCD_MNUUP: /* highlight previous entry */ | |
786 mnuUp(data->menu); | |
787 break; | |
788 case KCD_MNUDOWN: /* highlight next entry */ | |
789 mnuDown(data->menu); | |
790 break; | |
791 case KCD_MNUSELECT: | |
792 case KCD_LEFT: /* activate this entry */ | |
793 mnuSelect(data->menu); | |
794 break; | |
795 case KCD_HUP: /* back to previous menu */ | |
796 case KCD_RIGHT: /* back to previous menu */ | |
797 mnuEscape(data->menu); | |
798 break; | |
799 default: /* no response to all other keys */ | |
800 return MFW_EVENT_CONSUMED; | |
801 } | |
802 } | |
803 return MFW_EVENT_CONSUMED; | |
804 } | |
805 | |
806 /******************************************************************************* | |
807 | |
808 $Function: SmsSend_SEND_start | |
809 | |
810 $Description: Create SMS send window | |
811 | |
812 $Returns: execution status | |
813 | |
814 $Arguments: parent_window - parent window. | |
815 UserData - SMS data | |
816 *******************************************************************************/ | |
817 | |
818 T_MFW_HND SmsSend_SEND_start(T_MFW_HND parent_window, T_SmsUserData *UserData) | |
819 { | |
820 T_MFW_HND win; | |
821 | |
822 TRACE_FUNCTION ("SmsSend_SEND_start()"); | |
823 parentWindow4SMS = parent_window; | |
824 win = SmsSend_SEND_create (parent_window); | |
825 | |
826 if (win NEQ NULL) | |
827 { | |
828 SEND_EVENT (win, E_INIT, SEND_ID, (void *)UserData); | |
829 } | |
830 return win; | |
831 } | |
832 | |
833 /******************************************************************************* | |
834 | |
835 $Function: SmsSend_SEND_create | |
836 | |
837 $Description: Create a window for entering the text | |
838 | |
839 $Returns: window handle | |
840 | |
841 $Arguments: parent_window - parent window. | |
842 | |
843 *******************************************************************************/ | |
844 | |
845 static T_MFW_HND SmsSend_SEND_create(MfwHnd parent_window) | |
846 { | |
847 T_SEND * data = (T_SEND *)ALLOC_MEMORY (sizeof (T_SEND)); | |
848 T_MFW_WIN * win; | |
849 | |
850 TRACE_FUNCTION ("SmsSend_SEND_create()"); | |
851 | |
852 // Create window handler | |
853 data->win = win_create (parent_window, 0, E_WIN_VISIBLE, NULL); | |
854 if (data->win EQ NULL) | |
855 { | |
856 return NULL; | |
857 } | |
858 | |
859 // connect the dialog data to the MFW-window | |
860 data->mmi_control.dialog = (T_DIALOG_FUNC)SmsSend_main_exec_cb; | |
861 data->mmi_control.data = data; | |
862 win = ((T_MFW_HDR *)data->win)->data; | |
863 win->user = (MfwUserDataPtr)data; | |
864 data->parent = parent_window; | |
865 data->id = SEND_ID; | |
866 | |
867 winShow(data->win); | |
868 return data->win; | |
869 } | |
870 | |
871 /******************************************************************************* | |
872 | |
873 $Function: SmsSend_SEND_destroy | |
874 | |
875 $Description: Destroy the windows for entering the text | |
876 | |
877 $Returns: none | |
878 | |
879 $Arguments: own_window - window. | |
880 | |
881 *******************************************************************************/ | |
882 | |
883 static void SmsSend_SEND_destroy(MfwHnd own_window) | |
884 { | |
885 T_MFW_WIN * win_data; | |
886 T_SEND * data = NULL; | |
887 | |
888 TRACE_FUNCTION ("SmsSend_SEND_destroy()"); | |
889 | |
890 if (own_window) | |
891 { | |
892 win_data = ((T_MFW_HDR *)own_window)->data; | |
893 if (win_data != NULL) | |
894 data = (T_SEND *)win_data->user; | |
895 | |
896 if (data) | |
897 { | |
898 | |
899 // Delete sms handle | |
900 if (data->sms_handler != NULL) | |
901 sms_delete(data->sms_handler); | |
902 | |
903 if (data->child_dialog != NULL) | |
904 { | |
905 TRACE_EVENT("child_dialog not deleted?"); | |
906 } | |
907 | |
908 if (data->text_editor != NULL) | |
909 { | |
910 TRACE_EVENT("current_editor not deleted?"); | |
911 | |
912 | |
913 } | |
914 | |
915 | |
916 // Delete WIN handler | |
917 win_delete (data->win); | |
918 | |
919 // Free Memory | |
920 FREE_MEMORY ((void *)data, sizeof (T_SEND)); | |
921 //win_data->user = NULL; | |
922 } | |
923 else | |
924 { | |
925 TRACE_EVENT ("SmsSend_SEND_destroy() called twice"); | |
926 } | |
927 } | |
928 } | |
929 | |
930 /******************************************************************************* | |
931 | |
932 $Function: SmsSend_main_exec_cb | |
933 | |
934 $Description: Main callback handler for events sent to to trigger execution | |
935 | |
936 $Returns: none | |
937 | |
938 $Arguments: win - current window | |
939 event - event id | |
940 identifier - unique id | |
941 parameter - optional data. | |
942 *******************************************************************************/ | |
943 | |
944 static void SmsSend_main_exec_cb (T_MFW_HND win, USHORT event, SHORT identifier, void * parameter) | |
945 { | |
946 TRACE_FUNCTION ("SmsSend_main_exec_cb()"); | |
947 | |
948 /* In this field we get the identifier of the window sending the event */ | |
949 switch (identifier) | |
950 { | |
951 case SEND_ID: | |
952 case SAVE_ID: // events from the SAVE window are also managed in the SEND callback | |
953 case SMSSEND_ID_SAVE_NOT_READY: | |
954 SmsSend_SEND_exec_cb(win, event, parameter); | |
955 break; | |
956 case PHBK_ID: | |
957 SmsSend_PHBK_exec_cb(win, event, parameter); | |
958 break; | |
959 case SMSSEND_ID_TEXTEDIT: | |
960 SmsSend_TEXTEDIT_exec_cb(win, event, parameter); | |
961 break; | |
962 case SMSSEND_ID_SC_NOT_READY: | |
963 /* MZ cq11074 delete the info dialog window. */ | |
964 SmsSend_SEND_destroy(win); | |
965 break; | |
966 case SMSSEND_ID_NBEDIT: | |
967 SmsSend_NBEDIT_exec_cb(win, event, parameter); | |
968 break; | |
969 case SMSSEND_ID_CENTREEDIT: | |
970 SmsSend_CENTREEDIT_exec_cb(win, event, parameter); | |
971 break; | |
972 default: | |
973 TRACE_EVENT("Err: Default"); | |
974 break; | |
975 } | |
976 } | |
977 | |
978 /******************************************************************************* | |
979 | |
980 $Function: SmsSend_SEND_exec_cb | |
981 | |
982 $Description: Callback handler for events sent by the window itself | |
983 | |
984 $Returns: none | |
985 | |
986 $Arguments: win - current window | |
987 event - event id | |
988 parameter - optional data. | |
989 *******************************************************************************/ | |
990 | |
991 static void SmsSend_SEND_exec_cb(T_MFW_HND win, USHORT event, void *parameter) | |
992 { | |
993 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
994 T_SEND * data = (T_SEND *)win_data->user; | |
995 T_MFW_SMS_INFO sms_parameter; | |
996 T_MFW_EVENT MfwEvents; | |
997 // T_DISPLAY_DATA display_info; // RAVI | |
998 | |
999 /* SPR#1428 - SH - New Editor changes */ | |
1000 #ifdef NEW_EDITOR | |
1001 T_AUI_EDITOR_DATA editor_data; | |
1002 USHORT size; | |
1003 #else /* NEW_EDITOR */ | |
1004 T_EDITOR_DATA editor_data; | |
1005 #endif /* NEW_EDITOR */ | |
1006 | |
1007 TRACE_FUNCTION ("SmsSend_SEND_exec_cb()"); | |
1008 | |
1009 switch (event) | |
1010 { | |
1011 case E_INIT: | |
1012 /* Create a sms handler to receive events */ | |
1013 MfwEvents = E_SMS_ERR | E_SMS_MO_AVAIL; | |
1014 data->sms_handler = sms_create(data->win,MfwEvents,(MfwCb)SmsSend_SEND_mfw_cb); | |
1015 data->child_dialog = NULL; | |
1016 | |
1017 /* store NUMBER and TEXT */ | |
1018 memcpy(&(data->edt_data), (T_SmsUserData *)parameter, sizeof(T_SmsUserData)); | |
1019 /* in case of reply the sms we have to | |
1020 use the service center number from the | |
1021 caller | |
1022 */ | |
1023 TRACE_EVENT_P1("data->edt_data.called_from_reply_item is %d",data->edt_data.called_from_reply_item); | |
1024 if (data->edt_data.called_from_reply_item EQ FALSE) | |
1025 { | |
1026 TRACE_EVENT("RP false"); | |
1027 // The SMS center is initialized to '\0' | |
1028 data->edt_data.CentreBuffer[0] = '\0'; | |
1029 } | |
1030 else | |
1031 { | |
1032 TRACE_EVENT("RP true"); | |
1033 } | |
1034 | |
1035 /* SPR#1428 - SH - New Editor changes */ | |
1036 #ifdef NEW_EDITOR | |
1037 #if defined(CHINESE_MMI) && defined(EASY_TEXT_ENABLED) | |
1038 /* If chinese is selected and we're opening up a new message | |
1039 * or a unicode message, use the chinese editor */ | |
1040 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE | |
1041 && (data->edt_data.TextBuffer[0]==0x00 || data->edt_data.TextBuffer[0] ==0x80)) | |
1042 { | |
1043 T_CHINESE_DATA chinese_data; | |
1044 | |
1045 chinese_data.TextString = (char*) data->edt_data.TextBuffer; | |
1046 | |
1047 chinese_data.TextString[0] = 0x80; | |
1048 chinese_data.TextString[1] = MAX_MSG_LEN; | |
1049 chinese_data.Callback = (T_AUI_EDIT_CB)SmsSend_TEXTEDIT_edit_cb; | |
1050 chinese_data.Identifier = SMSSEND_ID_TEXTEDIT ; | |
1051 chinese_data.LeftSoftKey = TxtSoftOptions; | |
1052 chinese_data.DestroyEditor = FALSE; | |
1053 if(FFS_flashData.ConcatenateStatus == TRUE) | |
1054 chinese_data.EditorSize = (USHORT)((MAX_MSG_LEN_CHI)/2 - 1); | |
1055 else | |
1056 chinese_data.EditorSize = (USHORT)((MAX_MSG_LEN_SGL_CHI)/2 - 1); | |
1057 data->text_editor = chinese_input(win, &chinese_data); | |
1058 } | |
1059 else | |
1060 #endif /* CHINESE_MMI && EASY_TEXT_ENABLED */ | |
1061 /* We're opening up an ascii or unicode latin editor */ | |
1062 { | |
1063 | |
1064 AUI_edit_SetDefault(&editor_data); | |
1065 | |
1066 /* Set the appropriate mode if easy text is enabled */ | |
1067 #ifdef EASY_TEXT_ENABLED | |
1068 AUI_edit_SetMode(&editor_data, ED_MODE_ALPHA | ED_MODE_PREDTEXT, ED_CURSOR_BAR); | |
1069 #else /* EASY_TEXT_ENABLED */ | |
1070 AUI_edit_SetMode(&editor_data, ED_MODE_ALPHA, ED_CURSOR_BAR); | |
1071 #endif /* EASY_TEXT_ENABLED */ | |
1072 | |
1073 /* Check if concatenated SMS is enabled */ | |
1074 | |
1075 if(FFS_flashData.ConcatenateStatus == TRUE) | |
1076 size = MAX_MSG_LEN; | |
1077 else | |
1078 size = MAX_MSG_LEN_SGL; | |
1079 | |
1080 /* Set the DCS type of the message */ | |
1081 | |
1082 if (data->edt_data.TextBuffer[0]==0x80) | |
1083 { | |
1084 TRACE_EVENT("Unicode SMS message starting 0x80"); | |
1085 AUI_edit_SetBuffer(&editor_data, ATB_DCS_UNICODE, &data->edt_data.TextBuffer[2], size/2); | |
1086 } | |
1087 else | |
1088 { | |
1089 TRACE_EVENT("Normal SMS message"); | |
1090 AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, data->edt_data.TextBuffer, size); | |
1091 } | |
1092 | |
1093 AUI_edit_SetDisplay(&editor_data, ZONE_FULL_SK_TITLE_SCROLL, COLOUR_EDITOR, EDITOR_FONT); | |
1094 AUI_edit_SetEvents(&editor_data, SMSSEND_ID_TEXTEDIT, FALSE, FOREVER, (T_AUI_EDIT_CB)SmsSend_TEXTEDIT_edit_cb); | |
1095 AUI_edit_SetTextStr(&editor_data, TxtSoftOptions, TxtDelete, NULL, NULL); | |
1096 AUI_edit_SetAltTextStr(&editor_data, 0, NULL, TRUE, TxtSoftBack); | |
1097 | |
1098 data->text_editor = AUI_edit_Start(win,&editor_data); /* start the editor */ | |
1099 } | |
1100 #else /* NEW_EDITOR */ | |
1101 | |
1102 /* END OF NEW EDITOR CODE */ | |
1103 | |
1104 /*SPR 1434*/ | |
1105 #if defined(CHINESE_MMI) && defined(EASY_TEXT_ENABLED) | |
1106 /*MC SPR1242, merged section in from b-sample build*/ | |
1107 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE) | |
1108 { T_CHINESE_DATA chinese_data; | |
1109 | |
1110 chinese_data.TextString = (char*) data->edt_data.TextBuffer; | |
1111 /*if empty or unicode string, add unicode tag*/ | |
1112 if(chinese_data.TextString[0] ==0x00 || chinese_data.TextString[0] ==0x80) | |
1113 { chinese_data.TextString[0] = 0x80; | |
1114 chinese_data.TextString[1] = MAX_MSG_LEN; | |
1115 | |
1116 chinese_data.Callback = (T_EDIT_CB)SmsSend_TEXTEDIT_edit_cb; | |
1117 chinese_data.Identifier = SMSSEND_ID_TEXTEDIT ; | |
1118 chinese_data.LeftSoftKey = TxtSoftOptions; | |
1119 chinese_data.DestroyEditor = FALSE; | |
1120 if(FFS_flashData.ConcatenateStatus == TRUE) | |
1121 chinese_data.EditorSize = (USHORT)((MAX_MSG_LEN_CHI)/2 - 1); | |
1122 else | |
1123 chinese_data.EditorSize = (USHORT)((MAX_MSG_LEN_SGL_CHI)/2 - 1); | |
1124 data->text_editor = chinese_input(win, &chinese_data); | |
1125 | |
1126 } | |
1127 else/*if ascii string use ASCII editor rather than converting to unicode, MC, SPR 1292*/ | |
1128 { SmsSend_loadEditDefault(&editor_data); | |
1129 editor_data.editor_attr.text = (char *)data->edt_data.TextBuffer; | |
1130 //1227 - API - 05/10/02 - Size of Editor dependent on whether Conc_Switch is TRUE or FALSE | |
1131 if(FFS_flashData.ConcatenateStatus == TRUE) | |
1132 editor_data.editor_attr.size = MAX_MSG_LEN; | |
1133 else | |
1134 editor_data.editor_attr.size = MAX_MSG_LEN_SGL; | |
1135 editor_data.min_enter = 0; | |
1136 editor_data.LeftSoftKey = TxtSoftOptions; | |
1137 editor_data.AlternateLeftSoftKey = TxtSoftOptions; | |
1138 editor_data.RightSoftKey = TxtDelete; | |
1139 editor_data.Identifier = SMSSEND_ID_TEXTEDIT ; | |
1140 editor_data.Callback = (T_EDIT_CB)SmsSend_TEXTEDIT_edit_cb; | |
1141 editor_data.destroyEditor = FALSE; | |
1142 data->text_editor = editor_start(win,&editor_data); /* start the editor */ | |
1143 } | |
1144 } | |
1145 else | |
1146 #endif /* CHINESE_MMI && EASY_TEXT_ENABLED */ | |
1147 | |
1148 { | |
1149 #ifdef EASY_TEXT_ENABLED | |
1150 editor_data.hide = FALSE; | |
1151 editor_data.TextId = '\0'; | |
1152 editor_data.Identifier = 0; | |
1153 editor_data.TextString = NULL; | |
1154 editor_data.timeout = FOREVER; // Avoid to return empty strings | |
1155 editor_data.mode = ALPHA_MODE; | |
1156 editor_attr_init_pred(&editor_data.editor_attr, ZONE_FULL_SK_TITLE, edtCurBar1, NULL, (char *)data->edt_data.TextBuffer, MAX_MSG_LEN, COLOUR_EDITOR); | |
1157 #else /* EASY_TEXT_ENABLED */ | |
1158 SmsSend_loadEditDefault(&editor_data); | |
1159 editor_attr_init(&editor_data.editor_attr, ZONE_FULL_SK_TITLE, edtCurBar1, NULL, (char *)data->edt_data.TextBuffer, MAX_MSG_LEN, COLOUR_EDITOR); | |
1160 #endif /* EASY_TEXT_ENABLED */ | |
1161 | |
1162 editor_data.editor_attr.text = (char *)data->edt_data.TextBuffer; | |
1163 //1227 - API - 05/10/02 - Size of Editor dependent on whether Conc_Switch is TRUE or FALSE | |
1164 if(FFS_flashData.ConcatenateStatus == TRUE) | |
1165 editor_data.editor_attr.size = MAX_MSG_LEN; | |
1166 else | |
1167 editor_data.editor_attr.size = MAX_MSG_LEN_SGL; | |
1168 editor_data.min_enter = 0; | |
1169 editor_data.LeftSoftKey = TxtSoftOptions; | |
1170 editor_data.AlternateLeftSoftKey = TxtSoftOptions; | |
1171 editor_data.RightSoftKey = TxtDelete; | |
1172 | |
1173 editor_data.Identifier = SMSSEND_ID_TEXTEDIT ; | |
1174 editor_data.Callback = (T_EDIT_CB)SmsSend_TEXTEDIT_edit_cb; | |
1175 editor_data.destroyEditor = FALSE; | |
1176 data->text_editor = editor_start(win,&editor_data); /* start the editor */ | |
1177 } | |
1178 #endif /* NEW_EDITOR */ | |
1179 | |
1180 /* Marcus: Issue 1170: 07/10/2002: Start */ | |
1181 /* | |
1182 * Set whether status requests are to be indicated according to the | |
1183 * value of the srr field of the T_MFW_SMS_INFO structure. | |
1184 */ | |
1185 SmsSend_get_config_data(&sms_parameter); | |
1186 | |
1187 switch (sms_parameter.srr) | |
1188 { | |
1189 case SMS_NOT_REQUESTED_SRR: | |
1190 sms_set_mt_ind(MT_IND_SRR_OFF); | |
1191 break; | |
1192 | |
1193 case SMS_REQUESTED_SRR: | |
1194 sms_set_mt_ind(MT_IND_SRR_ON); | |
1195 break; | |
1196 | |
1197 default: | |
1198 TRACE_EVENT_P1("default: sms_parameter.srr = %d", sms_parameter.srr); | |
1199 break; | |
1200 } | |
1201 /* Marcus: Issue 1170: 07/10/2002: Start */ | |
1202 | |
1203 break; | |
1204 case E_RETURN: | |
1205 break; | |
1206 case E_EXIT: | |
1207 if(data->sc_number_editor != NULL) | |
1208 { | |
1209 | |
1210 //GW Read config data - then set dcs parameter | |
1211 SmsSend_get_config_data(&sms_parameter); | |
1212 | |
1213 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE) | |
1214 { //We have a chinese text message - set dcs parameter to | |
1215 sms_parameter.dcs = MFW_DCS_UCS2; | |
1216 } | |
1217 else | |
1218 { | |
1219 sms_parameter.dcs = MFW_DCS_7bits; | |
1220 | |
1221 } | |
1222 | |
1223 // copy the SC number into the sms_parameter variable. | |
1224 strcpy((char*)sms_parameter.sc_addr,(char*)data->edt_data.CentreBuffer); | |
1225 // store the Service center number into the SIM. | |
1226 SmsSend_set_SrvCntr_number (&sms_parameter); | |
1227 SmsSend_set_dcs_number (&sms_parameter); | |
1228 | |
1229 /* SPR#1428 - SH - New Editor changes */ | |
1230 #ifdef NEW_EDITOR | |
1231 AUI_edit_Destroy(data->sc_number_editor); | |
1232 #else /* NEW_EDITOR */ | |
1233 editor_destroy(data->sc_number_editor); | |
1234 #endif /* NEW_EDITOR */ | |
1235 data->sc_number_editor = NULL; | |
1236 } | |
1237 | |
1238 break; | |
1239 default: | |
1240 TRACE_EVENT("Err: Default"); | |
1241 break; | |
1242 } | |
1243 } | |
1244 | |
1245 /******************************************************************************* | |
1246 | |
1247 $Function: SmsSend_PHBK_exec_cb | |
1248 | |
1249 $Description: Callback handler for events sent by the phonebook window | |
1250 | |
1251 $Returns: none | |
1252 | |
1253 $Arguments: win - current window | |
1254 event - event id | |
1255 parameter - optional data. | |
1256 *******************************************************************************/ | |
1257 | |
1258 static void SmsSend_PHBK_exec_cb(T_MFW_HND win, USHORT event, void *parameter) | |
1259 { | |
1260 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
1261 T_SEND * data = (T_SEND *)win_data->user; | |
1262 /* SPR#1428 - SH - New Editor changes */ | |
1263 #ifdef NEW_EDITOR | |
1264 T_ATB_TEXT text; /* Used to insert phone numbers into editors */ | |
1265 #endif | |
1266 | |
1267 TRACE_FUNCTION ("SmsSend_PHBK_exec_cb()"); | |
1268 | |
1269 switch (event) | |
1270 { | |
1271 /* SPR#1428 - SH - New Editor changes. Insert phone number into editor */ | |
1272 #ifdef NEW_EDITOR | |
1273 case SMS_PHBK_NUMBER: /* Normal phone number */ | |
1274 case SMSSC_PHBK_NUMBER: /* Service centre number */ | |
1275 text.dcs = ATB_DCS_ASCII; | |
1276 text.len = strlen((char *)parameter); | |
1277 text.data = (UBYTE *)parameter; | |
1278 SEND_EVENT(data->number_editor, E_ED_INSERT, 0, (void *)&text); | |
1279 break; | |
1280 #else /* NEW_EDITOR */ | |
1281 case SMS_PHBK_NUMBER: | |
1282 memcpy(data->edt_data.NumberBuffer, (char *)parameter, MINIMUM(sizeof(data->edt_data.NumberBuffer) - 1, strlen((char *)parameter)+1)); | |
1283 break; | |
1284 /* SPR#1428 - SH - Insert service centre number into editor */ | |
1285 case SMSSC_PHBK_NUMBER: | |
1286 memcpy(data->edt_data.CentreBuffer, (char *)parameter, MINIMUM(sizeof(data->edt_data.CentreBuffer) - 1, strlen((char *)parameter)+1)); | |
1287 break; | |
1288 #endif /* NEW_EDITOR */ | |
1289 default: | |
1290 TRACE_EVENT("Err: Default"); | |
1291 break; | |
1292 } | |
1293 } | |
1294 | |
1295 | |
1296 /******************************************************************************* | |
1297 | |
1298 $Function: SmsSend_TEXTEDIT_exec_cb | |
1299 | |
1300 $Description: Callback handler for events sent by the TEXTEDIT editor | |
1301 | |
1302 $Returns: none | |
1303 | |
1304 $Arguments: win - current window | |
1305 event - event id | |
1306 parameter - optional data. | |
1307 *******************************************************************************/ | |
1308 | |
1309 static void SmsSend_TEXTEDIT_exec_cb(T_MFW_HND win, USHORT event, void *parameter) | |
1310 { | |
1311 TRACE_FUNCTION ("SmsSend_TEXTEDIT_exec_cb()"); | |
1312 | |
1313 switch (event) | |
1314 { | |
1315 case E_RETURN: | |
1316 // Destroy itself | |
1317 SmsSend_SEND_destroy(win); | |
1318 break; | |
1319 default: | |
1320 TRACE_EVENT("Err: Default"); | |
1321 break; | |
1322 } | |
1323 } | |
1324 | |
1325 /******************************************************************************* | |
1326 | |
1327 $Function: SmsSend_NBEDIT_exec_cb | |
1328 | |
1329 $Description: Callback handler for events sent by the NBEDIT editor | |
1330 | |
1331 $Returns: none | |
1332 | |
1333 $Arguments: win - current window | |
1334 event - event id | |
1335 parameter - optional data. | |
1336 *******************************************************************************/ | |
1337 | |
1338 static void SmsSend_NBEDIT_exec_cb(T_MFW_HND win, USHORT event, void *parameter) | |
1339 { | |
1340 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
1341 T_SEND * data = (T_SEND *)win_data->user; | |
1342 T_MFW_SMS_INFO sms_parameter; | |
1343 #ifdef NEW_EDITOR | |
1344 T_AUI_EDITOR_DATA editor_data; /* SPR#1428 - SH - New Editor data */ | |
1345 #else | |
1346 T_EDITOR_DATA editor_data; | |
1347 #endif | |
1348 | |
1349 TRACE_FUNCTION ("SmsSend_NBEDIT_exec_cb()"); | |
1350 | |
1351 switch (event) | |
1352 { | |
1353 case E_INIT: | |
1354 if ((phb_get_mode() EQ PHB_RESTRICTED) | |
1355 && (phb_check_number(data->edt_data.NumberBuffer) EQ MFW_PHB_FAIL)) | |
1356 { | |
1357 mmi_dialog_information_screen(win,TxtNotImplemented, "NOT ALLOWED", (T_VOID_FUNC)SmsSend_standard_dialog_cb, SMSSEND_ID_NOT_ALLOWED); | |
1358 } | |
1359 else | |
1360 { | |
1361 | |
1362 if (!smsidle_get_ready_state()) | |
1363 { | |
1364 // SMS init processing not ready to access SIM to store the SMS | |
1365 /* MZ cq11074 do not invoke the editor until SMS Service Centre number has been read, | |
1366 display info dialog. */ | |
1367 mmi_dialog_information_screen(win,TxtPleaseWait, "NOT READY", (T_VOID_FUNC)SmsSend_standard_dialog_cb, SMSSEND_ID_SC_NOT_READY ); | |
1368 return; | |
1369 // Recreate the editor on dialog callback | |
1370 } | |
1371 else | |
1372 { | |
1373 //END TB | |
1374 // First check if the SMS center is specified | |
1375 SmsSend_get_config_data(&sms_parameter); | |
1376 | |
1377 if(sms_parameter.sc_addr[0] EQ '\0') | |
1378 { | |
1379 memset(data->edt_data.CentreBuffer,0,NUMBER_LENGTH); | |
1380 } | |
1381 else | |
1382 { | |
1383 strncpy((char *)data->edt_data.CentreBuffer, (char *)sms_parameter.sc_addr, NUMBER_LENGTH); | |
1384 } | |
1385 } | |
1386 } | |
1387 | |
1388 /* SPR#1428 - SH - New Editor changes */ | |
1389 | |
1390 #ifdef NEW_EDITOR | |
1391 AUI_edit_SetDefault(&editor_data); | |
1392 AUI_edit_SetDisplay(&editor_data, CENTRE_EDITOR, COLOUR_EDITOR_XX, EDITOR_FONT); | |
1393 AUI_edit_SetEvents(&editor_data, 0, FALSE, FOREVER, (T_AUI_EDIT_CB)SmsSend_SCNBEDIT_edit_cb); | |
1394 AUI_edit_SetTextStr(&editor_data, TxtSoftOK, TxtDelete, TxtServiceCentre, NULL); | |
1395 AUI_edit_SetAltTextStr(&editor_data, 1, TxtNames, TRUE, TxtSoftBack); | |
1396 AUI_edit_SetMode(&editor_data, 0, ED_CURSOR_UNDERLINE); | |
1397 AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, data->edt_data.CentreBuffer, NUMBER_LENGTH); | |
1398 data->number_editor = AUI_edit_Start(data->win, &editor_data); | |
1399 #else /* NEW_EDITOR */ | |
1400 | |
1401 SmsSend_loadEditDefault(&editor_data); | |
1402 | |
1403 bookSetEditAttributes( CENTRE_EDITOR, COLOUR_EDITOR_XX,0,edtCurBar1, 0, | |
1404 (char *) data->edt_data.CentreBuffer, NUMBER_LENGTH, &editor_data.editor_attr); | |
1405 | |
1406 editor_data.TextId = TxtServiceCentre; | |
1407 editor_data.editor_attr.text = (char *)data->edt_data.CentreBuffer; | |
1408 editor_data.editor_attr.size = NUMBER_LENGTH; | |
1409 editor_data.LeftSoftKey = TxtSoftOK; | |
1410 editor_data.AlternateLeftSoftKey = TxtNames; | |
1411 editor_data.RightSoftKey = TxtDelete; | |
1412 editor_data.Identifier = NULL; | |
1413 editor_data.Callback = (T_EDIT_CB)SmsSend_SCNBEDIT_edit_cb; | |
1414 editor_data.mode = E_EDIT_DIGITS_MODE; | |
1415 editor_data.destroyEditor = FALSE; | |
1416 data->number_editor = editor_start(data->win,&editor_data); | |
1417 #endif /* NEW_EDITOR */ | |
1418 | |
1419 /* start the editor */ | |
1420 | |
1421 break; | |
1422 default: | |
1423 TRACE_EVENT("Err: Default"); | |
1424 break; | |
1425 } | |
1426 } | |
1427 | |
1428 /******************************************************************************* | |
1429 | |
1430 $Function: SmsSend_CENTREEDIT_exec_cb | |
1431 | |
1432 $Description: Callback handler for events sent by the CENTREEDIT editor | |
1433 | |
1434 $Returns: none | |
1435 | |
1436 $Arguments: win - current window | |
1437 event - event id | |
1438 parameter - optional data. | |
1439 *******************************************************************************/ | |
1440 | |
1441 static void SmsSend_CENTREEDIT_exec_cb(T_MFW_HND win, USHORT event, void *parameter) | |
1442 { | |
1443 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
1444 T_SEND * data = (T_SEND *)win_data->user; | |
1445 | |
1446 #ifdef NEW_EDITOR | |
1447 T_AUI_EDITOR_DATA editor_data; /* SPR#1428 - SH - New Editor data */ | |
1448 #else | |
1449 T_EDITOR_DATA editor_data; | |
1450 #endif | |
1451 | |
1452 TRACE_FUNCTION ("SmsSend_CENTREEDIT_exec_cb()"); | |
1453 | |
1454 switch (event) | |
1455 { | |
1456 case E_INIT: | |
1457 /* SPR#1428 - SH - New Editor changes */ | |
1458 #ifdef NEW_EDITOR | |
1459 AUI_edit_SetDefault(&editor_data); | |
1460 AUI_edit_SetDisplay(&editor_data, CENTRE_EDITOR, COLOUR_EDITOR_XX, EDITOR_FONT); | |
1461 AUI_edit_SetEvents(&editor_data, *(USHORT*)parameter, TRUE, FOREVER, (T_AUI_EDIT_CB)SmsSend_CENTREEDIT_edit_cb); | |
1462 AUI_edit_SetTextStr(&editor_data, TxtSoftOK, TxtDelete, TxtServiceCentre, NULL); | |
1463 AUI_edit_SetAltTextStr(&editor_data, 1, TxtNull, TRUE, TxtSoftBack); | |
1464 AUI_edit_SetMode(&editor_data, 0, ED_CURSOR_UNDERLINE); | |
1465 AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, data->edt_data.CentreBuffer, PHB_MAX_LEN); | |
1466 data->sc_number_editor = AUI_edit_Start(data->win, &editor_data); | |
1467 #else /* NEW_EDITOR */ | |
1468 | |
1469 SmsSend_loadEditDefault(&editor_data); | |
1470 bookSetEditAttributes( CENTRE_EDITOR, COLOUR_EDITOR_XX, 0, edtCurBar1, 0, | |
1471 (char *) data->edt_data.CentreBuffer, NUMBER_LENGTH, &editor_data.editor_attr); | |
1472 | |
1473 editor_data.TextId = TxtServiceCentre; | |
1474 editor_data.editor_attr.text = (char *)data->edt_data.CentreBuffer; | |
1475 editor_data.editor_attr.size = PHB_MAX_LEN; | |
1476 editor_data.LeftSoftKey = TxtSoftOK; | |
1477 editor_data.RightSoftKey = TxtDelete; | |
1478 editor_data.Identifier = *(USHORT*)parameter; | |
1479 editor_data.Callback = (T_EDIT_CB)SmsSend_CENTREEDIT_edit_cb; | |
1480 editor_data.mode = E_EDIT_DIGITS_MODE; | |
1481 editor_data.destroyEditor = TRUE ; | |
1482 data->sc_number_editor = editor_start(data->win,&editor_data); | |
1483 /* start the Service Centre Number editor */ | |
1484 #endif /* NEW_EDITOR */ | |
1485 break; | |
1486 | |
1487 case E_RETURN: | |
1488 | |
1489 break; | |
1490 default: | |
1491 TRACE_EVENT("Err: Default"); | |
1492 return; | |
1493 } | |
1494 } | |
1495 | |
1496 /******************************************************************************* | |
1497 | |
1498 $Function: SmsSend_TEXTEDIT_edit_cb | |
1499 | |
1500 $Description: Callback function for the text editor | |
1501 | |
1502 $Returns: none | |
1503 | |
1504 $Arguments: win - current window | |
1505 Identifier - unique id | |
1506 reason - event cause | |
1507 *******************************************************************************/ | |
1508 | |
1509 static void SmsSend_TEXTEDIT_edit_cb (T_MFW_HND win, USHORT Identifier, SHORT reason) | |
1510 { | |
1511 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
1512 T_SEND * data = (T_SEND *)win_data->user; | |
1513 | |
1514 TRACE_FUNCTION ("SmsSend_TEXTEDIT_edit_cb()"); | |
1515 | |
1516 // Jul 13, 2004 REF: CRR 21615 Deepa M.D | |
1517 //Copy the sms content from the editor buffer into the temporary buffer. | |
1518 memcpy(TempTextBuffer,data->edt_data.TextBuffer,MAX_MSG_LEN); | |
1519 | |
1520 switch (reason) | |
1521 { | |
1522 case INFO_KCD_ALTERNATELEFT: | |
1523 case INFO_KCD_LEFT: | |
1524 data->options_win = SmsSend_OPT_start(win,(MfwMnuAttr*)&SmsSend_R_OPTAttrib); | |
1525 | |
1526 /* Create number editor: | |
1527 -the editor min length is 1 | |
1528 */ | |
1529 break; | |
1530 | |
1531 case INFO_KCD_RIGHT: | |
1532 case INFO_KCD_HUP: | |
1533 // Commit suicide so come back to previous menu | |
1534 #if defined(CHINESE_MMI) && defined(EASY_TEXT_ENABLED) | |
1535 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE) | |
1536 chinese_input_destroy(data->text_editor); | |
1537 else | |
1538 #endif | |
1539 | |
1540 /* SPR#1428 - SH - New Editor changes */ | |
1541 #ifdef NEW_EDITOR | |
1542 AUI_edit_Destroy(data->text_editor); | |
1543 #else /* NEW_EDITOR */ | |
1544 editor_destroy(data->text_editor); | |
1545 #endif /* NEW_EDITOR */ | |
1546 | |
1547 data->text_editor = 0; | |
1548 SmsSend_SEND_destroy(data->win); | |
1549 break; | |
1550 | |
1551 default: | |
1552 TRACE_EVENT("Err: Default"); | |
1553 break; | |
1554 } | |
1555 } | |
1556 | |
1557 | |
1558 /******************************************************************************* | |
1559 | |
1560 $Function: SmsSend_NBEDIT_edit_cb | |
1561 | |
1562 $Description: Callback function for the number editor | |
1563 | |
1564 $Returns: none | |
1565 | |
1566 $Arguments: win - current window | |
1567 Identifier - unique id | |
1568 reason - event cause | |
1569 *******************************************************************************/ | |
1570 | |
1571 static void SmsSend_NBEDIT_edit_cb (T_MFW_HND win, USHORT Identifier, SHORT reason) | |
1572 { | |
1573 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
1574 T_SEND * data = (T_SEND *)win_data->user; | |
1575 | |
1576 T_MFW_SMS_INFO sms_parameter; | |
1577 USHORT parameter; | |
1578 | |
1579 | |
1580 TRACE_FUNCTION ("SmsSend_NBEDIT_edit_cb()"); | |
1581 | |
1582 | |
1583 switch (reason) | |
1584 { | |
1585 case INFO_KCD_LEFT: | |
1586 // Check if we can go to the next stage | |
1587 if ((phb_get_mode() EQ PHB_RESTRICTED) | |
1588 && (phb_check_number(data->edt_data.NumberBuffer) EQ MFW_PHB_FAIL)) | |
1589 { | |
1590 | |
1591 mmi_dialog_information_screen(win,TxtNotImplemented, "NOT ALLOWED", (T_VOID_FUNC)SmsSend_standard_dialog_cb, SMSSEND_ID_NOT_ALLOWED); | |
1592 | |
1593 } | |
1594 else | |
1595 { | |
1596 | |
1597 if (!smsidle_get_ready_state()) | |
1598 { | |
1599 // SMS init processing not ready to access SIM to store the SMS | |
1600 mmi_dialog_information_screen(win,TxtPleaseWait, "NOT READY", (T_VOID_FUNC)SmsSend_standard_dialog_cb, SMSSEND_ID_SC_NOT_READY); | |
1601 // Recreate the editor on dialog callback | |
1602 } | |
1603 else | |
1604 { | |
1605 //END TB | |
1606 // First check if the SMS center is specified | |
1607 SmsSend_get_config_data(&sms_parameter); | |
1608 | |
1609 if(sms_parameter.sc_addr[0] EQ '\0') | |
1610 { | |
1611 //setup identifier value. | |
1612 parameter = SMSSEND_ID_CENTREEDIT; | |
1613 SmsSend_CENTREEDIT_exec_cb(win, E_INIT,(void*)¶meter); | |
1614 } | |
1615 else | |
1616 { | |
1617 /*NM FTA 34.2.8*/ | |
1618 if (data->edt_data.called_from_reply_item EQ FALSE) | |
1619 { | |
1620 TRACE_EVENT("take the own serviceCenternum"); | |
1621 strcpy((char *)data->edt_data.CentreBuffer, (char *)sms_parameter.sc_addr); | |
1622 | |
1623 { | |
1624 /***************************Go-lite Optimization changes Start***********************/ | |
1625 // Aug 16, 2004 REF: CRR 24323 Deepa M.D | |
1626 TRACE_EVENT_P1("serviceNr:%s",data->edt_data.CentreBuffer); | |
1627 /***************************Go-lite Optimization changes end***********************/ | |
1628 } | |
1629 | |
1630 } | |
1631 else | |
1632 { | |
1633 TRACE_EVENT("from the caller, reply"); | |
1634 | |
1635 /* in case of reply the sms, we took already the | |
1636 the service center number from the caller !!!*/ | |
1637 | |
1638 { | |
1639 /***************************Go-lite Optimization changes Start***********************/ | |
1640 // Aug 16, 2004 REF: CRR 24323 Deepa M.D | |
1641 TRACE_EVENT_P1("serviceNr:%s",data->edt_data.CentreBuffer); | |
1642 /***************************Go-lite Optimization changes end***********************/ | |
1643 } | |
1644 } | |
1645 /*NM FTA 34.2.8*/ | |
1646 SmsSend_send_to_mfw(win); | |
1647 } | |
1648 } | |
1649 } | |
1650 | |
1651 /* SPR#1428 - SH - New Editor changes */ | |
1652 #ifdef NEW_EDITOR | |
1653 AUI_edit_Destroy(data->number_editor); | |
1654 #else /* NEW_EDITOR */ | |
1655 editor_destroy(data->number_editor); | |
1656 #endif /* NEW_EDITOR */ | |
1657 | |
1658 data->number_editor = 0; | |
1659 SmsSend_R_OPT_destroy(data->options_win); | |
1660 | |
1661 break; | |
1662 | |
1663 case INFO_KCD_ALTERNATELEFT: | |
1664 bookPhonebookStart(win, PhbkFromSms); | |
1665 break; | |
1666 case INFO_KCD_RIGHT: | |
1667 case INFO_KCD_HUP: | |
1668 /* SPR#1428 - SH - New Editor changes */ | |
1669 #ifdef NEW_EDITOR | |
1670 AUI_edit_Destroy(data->number_editor); | |
1671 #else /* NEW_EDITOR */ | |
1672 editor_destroy(data->number_editor); | |
1673 #endif /* NEW_EDITOR */ | |
1674 data->number_editor = 0; | |
1675 break; | |
1676 | |
1677 default: | |
1678 TRACE_EVENT("Err: Default"); | |
1679 break; | |
1680 } | |
1681 } | |
1682 | |
1683 /******************************************************************************* | |
1684 | |
1685 $Function: SmsSend_CENTREEDIT_edit_cb | |
1686 | |
1687 $Description: Callback function for the center number editor | |
1688 | |
1689 $Returns: none | |
1690 | |
1691 $Arguments: win - current window | |
1692 Identifier - unique id | |
1693 reason - event cause | |
1694 *******************************************************************************/ | |
1695 | |
1696 static void SmsSend_CENTREEDIT_edit_cb (T_MFW_HND win, USHORT Identifier, SHORT reason) | |
1697 { | |
1698 // T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; // RAVI | |
1699 // T_SEND * data = (T_SEND *)win_data->user; // RAVI | |
1700 | |
1701 TRACE_FUNCTION ("SmsSend_CENTREEDIT_edit_cb()"); | |
1702 switch (reason) | |
1703 { | |
1704 case INFO_KCD_LEFT: | |
1705 TRACE_EVENT("SmsSend_CENTREEDIT_edit_cb,INFO_KCD_LEFT "); | |
1706 if (Identifier==SMSSEND_ID_CENTREEDIT) | |
1707 { | |
1708 TRACE_EVENT("SmsSend_CENTREEDIT_edit_cb,INFO_KCD_LEFT Send to mfw "); | |
1709 | |
1710 //Submit the SMS message to the service centre. | |
1711 SmsSend_send_to_mfw(win); | |
1712 } | |
1713 break; | |
1714 | |
1715 case INFO_KCD_RIGHT: | |
1716 case INFO_KCD_HUP: | |
1717 /* send an event that will lead to the display of the number edition window */ | |
1718 SEND_EVENT (win, E_RETURN, SMSSEND_ID_CENTREEDIT, NULL); | |
1719 break; | |
1720 default: | |
1721 | |
1722 break; | |
1723 } | |
1724 } | |
1725 | |
1726 /******************************************************************************* | |
1727 | |
1728 $Function: SmsSend_SEND_mfw_cb | |
1729 | |
1730 $Description: Callback functyion for handling SMS events from the MFW. | |
1731 | |
1732 $Returns: execution status | |
1733 | |
1734 $Arguments: event - window event id | |
1735 info - optional info | |
1736 reason - event cause | |
1737 *******************************************************************************/ | |
1738 | |
1739 static int SmsSend_SEND_mfw_cb (MfwEvt event, void *info) | |
1740 { | |
1741 /* get the top window*/ | |
1742 T_MFW_HND win = mfw_parent(mfw_header()); | |
1743 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
1744 T_SEND * data = (T_SEND *)win_data->user; | |
1745 | |
1746 | |
1747 TRACE_FUNCTION ("SmsSend_SEND_mfw_cb()"); | |
1748 | |
1749 switch (event) | |
1750 { | |
1751 case E_SMS_MO_AVAIL: | |
1752 TRACE_EVENT ("Sent was successful -> ok"); | |
1753 /* Sent was successful */ | |
1754 /* abort the current Dialog "Please wait" */ | |
1755 if (data->child_dialog != NULL) | |
1756 { | |
1757 SEND_EVENT (data->child_dialog, DIALOG_DESTROY, 0, NULL); | |
1758 data->child_dialog = NULL; | |
1759 } | |
1760 //GW Display sent not send | |
1761 /* FTA 34.2.2 - CQ 101443 - API & MZ pass NULL instead of win to the dialog window*/ | |
1762 //Sep 01, 2004 REF: CRR 21380 Deepa M.D | |
1763 //Second string is same as the TextId .Hence passed NULL. | |
1764 mmi_dialog_information_screen(NULL,TxtSent, NULL, (T_VOID_FUNC)SmsSend_standard_dialog_cb, SMSSEND_ID_SENT); | |
1765 data->id = SMSSEND_ID_SENT; | |
1766 | |
1767 break; | |
1768 | |
1769 case E_SMS_ERR: | |
1770 // Waiting dialog is destroyed | |
1771 if (data->child_dialog != NULL) | |
1772 { | |
1773 SEND_EVENT (data->child_dialog, DIALOG_DESTROY, 0, NULL); | |
1774 data->child_dialog = NULL; | |
1775 } | |
1776 // and the status dialog is displayed during 3 secs. | |
1777 /* FTA 34.2.2 - CQ 101443 - API & MZ pass NULL instead of win to the dialog window */ | |
1778 //Sep 01, 2004 REF: CRR 21380 Deepa M.D | |
1779 //Second string is same as the TextId .Hence passed NULL. | |
1780 mmi_dialog_information_screen(NULL,TxtNotSent, NULL, (T_VOID_FUNC)SmsSend_standard_dialog_cb, SMSSEND_ID_NOT_SENT); | |
1781 data->id = SMSSEND_ID_NOT_SENT; //TB3 | |
1782 break; | |
1783 | |
1784 default: | |
1785 TRACE_EVENT("Err: default"); | |
1786 return 0; | |
1787 } | |
1788 | |
1789 return 1; | |
1790 } | |
1791 | |
1792 /******************************************************************************* | |
1793 | |
1794 $Function: SmsSend_SAVE_start | |
1795 | |
1796 $Description: Create the Save SMS text window. | |
1797 | |
1798 $Returns: mfw window handle | |
1799 | |
1800 $Arguments: parent_window - parent window | |
1801 UserData - SMS info | |
1802 | |
1803 *******************************************************************************/ | |
1804 | |
1805 T_MFW_HND SmsSend_SAVE_start(T_MFW_HND parent_window, T_SmsUserData *UserData) | |
1806 { | |
1807 T_MFW_HND win; | |
1808 | |
1809 TRACE_FUNCTION ("SmsSend_SAVE_start()"); | |
1810 | |
1811 win = SmsSend_SAVE_create (parent_window); | |
1812 | |
1813 if (win NEQ NULL) | |
1814 { | |
1815 SEND_EVENT (win, E_INIT, 0, (void *)UserData); | |
1816 } | |
1817 return win; | |
1818 } | |
1819 | |
1820 /******************************************************************************* | |
1821 | |
1822 $Function: SmsSend_SAVE_create | |
1823 | |
1824 $Description: Create a window for info dialog | |
1825 | |
1826 $Returns: mfw window handle | |
1827 | |
1828 $Arguments: parent_window - parent window | |
1829 | |
1830 *******************************************************************************/ | |
1831 | |
1832 static T_MFW_HND SmsSend_SAVE_create(MfwHnd parent_window) | |
1833 { | |
1834 T_SAVE * data = (T_SAVE *)ALLOC_MEMORY (sizeof (T_SAVE)); | |
1835 T_MFW_WIN * win; | |
1836 | |
1837 TRACE_FUNCTION ("SmsSend_SAVE_create()"); | |
1838 | |
1839 /* | |
1840 * Create window handler | |
1841 */ | |
1842 data->win = win_create (parent_window, 0, E_WIN_VISIBLE, NULL); | |
1843 if (data->win EQ NULL) | |
1844 { | |
1845 return NULL; | |
1846 } | |
1847 | |
1848 /* | |
1849 * connect the dialog data to the MFW-window | |
1850 */ | |
1851 data->mmi_control.dialog = (T_DIALOG_FUNC)SmsSend_SAVE_exec_cb; | |
1852 data->mmi_control.data = data; | |
1853 win = ((T_MFW_HDR *)data->win)->data; | |
1854 win->user = (MfwUserDataPtr)data; | |
1855 data->parent = parent_window; | |
1856 data->id = SAVE_ID; | |
1857 | |
1858 winShow(data->win); | |
1859 return data->win; | |
1860 } | |
1861 | |
1862 /******************************************************************************* | |
1863 | |
1864 $Function: SmsSend_SAVE_destroy | |
1865 | |
1866 $Description: Destroy the windows for info dialog | |
1867 | |
1868 $Returns: none | |
1869 | |
1870 $Arguments: own_window - current window | |
1871 | |
1872 *******************************************************************************/ | |
1873 | |
1874 static void SmsSend_SAVE_destroy(MfwHnd own_window) | |
1875 { | |
1876 T_MFW_WIN * win_data; | |
1877 T_SAVE * data = NULL; | |
1878 | |
1879 TRACE_FUNCTION ("SmsSend_SAVE_destroy()"); | |
1880 | |
1881 if (own_window) | |
1882 { | |
1883 win_data = ((T_MFW_HDR *)own_window)->data; | |
1884 if (win_data) | |
1885 data = (T_SAVE *)win_data->user; | |
1886 | |
1887 if (data) | |
1888 { | |
1889 // Delete sms handle | |
1890 if (data->sms_handler != NULL) | |
1891 sms_delete(data->sms_handler); | |
1892 | |
1893 if (data->child_dialog != NULL) | |
1894 { | |
1895 TRACE_EVENT("child_dialog not deleted?"); | |
1896 } | |
1897 | |
1898 // Delete WIN handler | |
1899 win_delete (data->win); | |
1900 | |
1901 // Free Memory | |
1902 FREE_MEMORY ((void *)data, sizeof (T_SAVE)); | |
1903 | |
1904 } | |
1905 else | |
1906 { | |
1907 TRACE_EVENT ("SmsSend_SAVE_destroy() called twice"); | |
1908 } | |
1909 } | |
1910 } | |
1911 | |
1912 /******************************************************************************* | |
1913 | |
1914 $Function: SmsSend_SAVE_exec_cb | |
1915 | |
1916 $Description: Callback handler for events sent to to trigger execution | |
1917 | |
1918 $Returns: none | |
1919 | |
1920 $Arguments: own_window - current window | |
1921 | |
1922 *******************************************************************************/ | |
1923 | |
1924 void SmsSend_SAVE_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter) | |
1925 { | |
1926 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
1927 T_SAVE * data = (T_SAVE *)win_data->user; | |
1928 T_MFW_SMS_INFO sms_parameter; | |
1929 USHORT outLen; | |
1930 T_MFW store_status; | |
1931 T_SmsUserData* message_parameter;/*SPR1991, pointer to message text, dest number*/ | |
1932 /*JVJ SPR1298 made dynamic to avoid stack overload in the function convertToUnicodeForOutput*/ | |
1933 /* MZ 10202 Removed memory declaration and allocation*/ | |
1934 | |
1935 TRACE_FUNCTION ("SmsSend_SAVE_exec_cb()"); | |
1936 | |
1937 switch (event) | |
1938 { | |
1939 case E_INIT: | |
1940 | |
1941 /*MZ issue 10202 only alloc memory when you need it */ | |
1942 if (msgBuffer ==NULL) | |
1943 msgBuffer = (UBYTE*)ALLOC_MEMORY(MAX_MSG_LEN_ARRAY); | |
1944 | |
1945 data->child_dialog = NULL; | |
1946 | |
1947 /* Create a sms handler to receive events */ | |
1948 data->sms_handler = sms_create(data->win, | |
1949 E_SMS_SAVE_AVAIL | E_SMS_ERR | E_SMS_MEM_FULL | |
1950 ,(MfwCb)SmsSend_SAVE_mfw_cb); | |
1951 | |
1952 // | |
1953 /*SPR1991, set local pointer to passed parameter, rather than copying data and | |
1954 using up more dynamic memory*/ | |
1955 message_parameter = parameter; | |
1956 if (message_parameter->TextBuffer[0] == 0x80) | |
1957 { //String is unicode - | |
1958 sms_parameter.dcs = MFW_DCS_UCS2; | |
1959 } | |
1960 else | |
1961 { | |
1962 sms_parameter.dcs = MFW_DCS_7bits; | |
1963 } | |
1964 | |
1965 SmsSend_set_dcs_number (&sms_parameter); | |
1966 | |
1967 #ifdef NO_ASCIIZ | |
1968 { | |
1969 // have to add this , later | |
1970 convertToUnicodeForOutput(message_parameter->TextBuffer,msgBuffer, &outLen); | |
1971 TRACE_EVENT_P1("Save SMS, length: %d", outLen); | |
1972 | |
1973 store_status = sms_store(MFW_SMS_SUBMIT, (char*)message_parameter->NumberBuffer, msgBuffer, outLen, NULL); | |
1974 } | |
1975 #else | |
1976 { | |
1977 convertToUnicodeForOutput(data->edt_data.TextBuffer,msgBuffer, &outLen); | |
1978 store_status = sms_store(MFW_SMS_SUBMIT, (char*)message_parameter->NumberBuffer, msgBuffer, outLen, NULL); | |
1979 // sbh - added length to the above function call, since '@' characters stored as NULL & will stop | |
1980 // strlen from working properly. | |
1981 } | |
1982 #endif | |
1983 | |
1984 /* display "Please wait" for save sms */ | |
1985 if (store_status EQ MFW_SMS_OK) | |
1986 { | |
1987 TRACE_EVENT ("Save operation -> ok"); | |
1988 /* show now to user "Please wait" for save*/ | |
1989 // Do not start please wait if ever the MFW result event as already been received | |
1990 if (data->child_dialog == NULL) | |
1991 { | |
1992 // Feb 02, 2005 REF: CRR 28479 xnkulkar | |
1993 // Call function "mmi_dialog_information_screen_save_sms" which has only | |
1994 // KEY_RIGHT and KEY_HUP registered instead of KEY_ALL | |
1995 //data->child_dialog = mmi_dialog_information_screen(win,TxtPleaseWait, "SAVING", (T_VOID_FUNC)SmsSend_standard_dialog_cb, SMSSEND_ID_WAIT_SAVE); | |
1996 data->child_dialog = mmi_dialog_information_screen_save_sms(win,TxtPleaseWait, "SAVING", (T_VOID_FUNC)SmsSend_standard_dialog_cb, SMSSEND_ID_WAIT_SAVE); | |
1997 } | |
1998 | |
1999 } | |
2000 else | |
2001 { | |
2002 TRACE_EVENT ("Save operation -> failed"); | |
2003 //Sep 01, 2004 REF: CRR 21380 Deepa M.D | |
2004 //If E_SMS_MEM_FULL event has already been received, then destroy the Messagefull Dialog | |
2005 //and dispaly a new dialog "Full NOT SAVED". | |
2006 if(memfull==TRUE) | |
2007 { | |
2008 // Feb 02, 2005 REF: CRR 28479 xnkulkar | |
2009 // Call function "mmi_dialog_information_screen_save_sms" which has only | |
2010 // KEY_RIGHT and KEY_HUP registered instead of KEY_ALL | |
2011 //mmi_dialog_information_screen(win, TxtFull,"NOT SAVED", (T_VOID_FUNC)SmsSend_standard_dialog_cb, SMSSEND_ID_NOT_SAVED); | |
2012 mmi_dialog_information_screen_save_sms(win, TxtFull,"NOT SAVED", (T_VOID_FUNC)SmsSend_standard_dialog_cb, SMSSEND_ID_NOT_SAVED); | |
2013 memfull=FALSE;//Set the memful flag to False. | |
2014 | |
2015 } | |
2016 // If the saving message failed due to other reason than memory full, display this message | |
2017 else if (data->child_dialog == NULL) | |
2018 { | |
2019 // Feb 02, 2005 REF: CRR 28479 xnkulkar | |
2020 // Call function "mmi_dialog_information_screen_save_sms" which has only | |
2021 // KEY_RIGHT and KEY_HUP registered instead of KEY_ALL | |
2022 //mmi_dialog_information_screen(win, TxtFailed,"NOT SAVED", (T_VOID_FUNC)SmsSend_standard_dialog_cb, SMSSEND_ID_NOT_SAVED); | |
2023 mmi_dialog_information_screen_save_sms(win, TxtFailed,"NOT SAVED", (T_VOID_FUNC)SmsSend_standard_dialog_cb, SMSSEND_ID_NOT_SAVED); | |
2024 } | |
2025 | |
2026 } | |
2027 /*SPr 1991, check memory allocated before deallocatting it*/ | |
2028 /* MZ 10202 Remove the memory deallocation until later.*/ | |
2029 | |
2030 break; | |
2031 | |
2032 default: | |
2033 TRACE_EVENT("Err: default"); | |
2034 break; | |
2035 } | |
2036 | |
2037 return; | |
2038 } | |
2039 | |
2040 /******************************************************************************* | |
2041 | |
2042 $Function: SmsSend_SAVE_mfw_cb | |
2043 | |
2044 $Description: Handles SMS events from the MFW. | |
2045 | |
2046 $Returns: none | |
2047 | |
2048 $Arguments: event - event id | |
2049 info - optional info | |
2050 | |
2051 *******************************************************************************/ | |
2052 | |
2053 static int SmsSend_SAVE_mfw_cb (MfwEvt event, void *info) | |
2054 { | |
2055 /* get the top window*/ | |
2056 T_MFW_HND win = mfw_parent(mfw_header()); | |
2057 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
2058 T_SAVE * data = (T_SAVE *)win_data->user; | |
2059 | |
2060 // T_DISPLAY_DATA display_info; | |
2061 | |
2062 TRACE_FUNCTION ("SmsSend_SAVE_mfw_cb"); | |
2063 | |
2064 switch (event) | |
2065 { | |
2066 /* Save is successful */ | |
2067 case E_SMS_SAVE_AVAIL: | |
2068 // Waiting dialog is destroyed | |
2069 | |
2070 if (data->child_dialog != NULL) | |
2071 { | |
2072 SEND_EVENT (data->child_dialog, DIALOG_DESTROY, 0, NULL); | |
2073 data->child_dialog = NULL; | |
2074 } | |
2075 //Sep 01, 2004 REF: CRR 21380 Deepa M.D | |
2076 //Second string is same as the TextId .Hence passed NULL. | |
2077 | |
2078 // Feb 02, 2005 REF: CRR 28479 xnkulkar | |
2079 // Call function "mmi_dialog_information_screen_save_sms" which has only | |
2080 // KEY_RIGHT and KEY_HUP registered instead of KEY_ALL | |
2081 | |
2082 // mmi_dialog_information_screen(win, TxtSaved,NULL, (T_VOID_FUNC)SmsSend_standard_dialog_cb, SMSSEND_ID_SAVED); | |
2083 mmi_dialog_information_screen_save_sms(win, TxtSaved,NULL, (T_VOID_FUNC)SmsSend_standard_dialog_cb, SMSSEND_ID_SAVED); | |
2084 | |
2085 break; | |
2086 | |
2087 case E_SMS_MEM_FULL: | |
2088 //Sep 01, 2004 REF: CRR 21380 Deepa M.D | |
2089 //Flag to check E_SMS_MEM_FULL event has already been received. | |
2090 memfull=TRUE; | |
2091 TRACE_EVENT ("Memory for sms save is full"); | |
2092 | |
2093 if (data->child_dialog != NULL) | |
2094 { | |
2095 // Waiting dialog is destroyed | |
2096 SEND_EVENT (data->child_dialog, DIALOG_DESTROY, 0, NULL); | |
2097 data->child_dialog = NULL; | |
2098 } | |
2099 // and the status dialog is displayed during 3 secs. | |
2100 // set data->child_dialog as message received before sms_store is ended | |
2101 //Sep 01, 2004 REF: CRR 21380 Deepa M.D | |
2102 //Second string is same as the TextId .Hence passed NULL. | |
2103 mmi_dialog_information_screen(win,TxtFull, NULL, (T_VOID_FUNC)SmsSend_standard_dialog_cb, SMSSEND_ID_LIST_FULL); | |
2104 return MFW_EVENT_PASSED; /*SPR 2640, pass event along to idle screen*/ | |
2105 // break; // RAVI | |
2106 | |
2107 case E_SMS_ERR: | |
2108 TRACE_EVENT ("Save sms failed -> nok"); | |
2109 | |
2110 if (data->child_dialog != NULL) | |
2111 { | |
2112 // Waiting dialog is destroyed | |
2113 SEND_EVENT (data->child_dialog, DIALOG_DESTROY, 0, NULL); | |
2114 data->child_dialog = NULL; | |
2115 } | |
2116 // and the status dialog is displayed during 3 secs. | |
2117 // set data->child_dialog if message received before sms_store is ended | |
2118 mmi_dialog_information_screen(win,TxtFailed, "NOT SAVED", (T_VOID_FUNC)SmsSend_standard_dialog_cb, SMSSEND_ID_NOT_SAVED); | |
2119 break; | |
2120 | |
2121 default: | |
2122 TRACE_EVENT("Err: default"); | |
2123 return 0; | |
2124 } | |
2125 return 1; | |
2126 } | |
2127 | |
2128 /******************************************************************************* | |
2129 | |
2130 $Function: SmsSend_send_to_mfw | |
2131 | |
2132 $Description: This function sends a SMS message. | |
2133 | |
2134 $Returns: execution status | |
2135 | |
2136 $Arguments: event - current window | |
2137 | |
2138 $History | |
2139 GW 09/10/01 - Added code to convert unicode strings from 8 bits to 7 bits. | |
2140 | |
2141 *******************************************************************************/ | |
2142 | |
2143 static int SmsSend_send_to_mfw (T_MFW_HND win) | |
2144 { | |
2145 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
2146 T_SEND * data = (T_SEND *)win_data->user; | |
2147 T_MFW submit_status; /* Result of SMS send operation. */ | |
2148 T_MFW_SMS_INFO sms_parameter; | |
2149 | |
2150 USHORT outLen; | |
2151 | |
2152 /*SPR2453 only alloc memory when you need it */ | |
2153 if (msgBuffer ==NULL) | |
2154 msgBuffer = (UBYTE*)ALLOC_MEMORY(MAX_MSG_LEN_ARRAY); | |
2155 TRACE_FUNCTION ("SmsSend_send_to_mfw()"); | |
2156 if (data->edt_data.TextBuffer[0] == 0x80) | |
2157 { //String is unicode - | |
2158 sms_parameter.dcs = MFW_DCS_UCS2; | |
2159 } | |
2160 else | |
2161 { | |
2162 sms_parameter.dcs = MFW_DCS_7bits; | |
2163 } | |
2164 | |
2165 SmsSend_set_dcs_number (&sms_parameter); | |
2166 /* Send the SMS */ | |
2167 | |
2168 | |
2169 | |
2170 #ifdef NO_ASCIIZ | |
2171 { | |
2172 | |
2173 convertToUnicodeForOutput(data->edt_data.TextBuffer,msgBuffer, &outLen); | |
2174 | |
2175 TRACE_EVENT_P1("Send SMS, length: %d", outLen); | |
2176 submit_status = sms_submit( MFW_SMS_SUBMIT, /* type of the message*/ | |
2177 (char *)data->edt_data.NumberBuffer, /* dest. address */ | |
2178 msgBuffer, /* sms message */ | |
2179 outLen, /* lenght of message */ | |
2180 (char *)data->edt_data.CentreBuffer);/* sevice center num. */ | |
2181 } | |
2182 #else | |
2183 { | |
2184 convertToUnicodeForOutput(data->edt_data.TextBuffer,msgBuffer,&outLen); | |
2185 #if defined (FF_WAP) && defined (FF_GPF_TCPIP) | |
2186 | |
2187 submit_status = sms_submit( MFW_SMS_SUBMIT, /* type of the message*/ | |
2188 (char *)data->edt_data.NumberBuffer, /* dest. address */ | |
2189 NULL, /* don't specify toa for now */ | |
2190 msgBuffer, /* sms message */ | |
2191 outLen, /* SH - added this, see function definition */ | |
2192 (char *)data->edt_data.CentreBuffer, /* sevice center num. */ | |
2193 NULL); /* don't specify tosca for now */ | |
2194 #else | |
2195 submit_status = sms_submit( MFW_SMS_SUBMIT, /* type of the message*/ | |
2196 (char *)data->edt_data.NumberBuffer, /* dest. address */ | |
2197 msgBuffer, /* sms message */ | |
2198 outLen, // sbh - added this, see function definition | |
2199 (char *)data->edt_data.CentreBuffer);/* sevice center num. */ | |
2200 | |
2201 | |
2202 #endif | |
2203 | |
2204 } | |
2205 #endif | |
2206 | |
2207 | |
2208 | |
2209 /* display "Please wait" for sent sms */ | |
2210 if (submit_status EQ MFW_SMS_OK) | |
2211 { | |
2212 T_DISPLAY_DATA display_info; | |
2213 | |
2214 TRACE_EVENT ("to give SMS to MFW -> ok"); | |
2215 /* show the use "Please wait" for send sms */ | |
2216 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TxtSending, TxtMessage , COLOUR_STATUS); | |
2217 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)SmsSend_standard_dialog_cb, FOREVER, KEY_LEFT ); | |
2218 display_info.Identifier = SMSSEND_ID_WAIT_SEND; | |
2219 | |
2220 data->child_dialog = info_dialog(win, &display_info); | |
2221 data->id = SMSSEND_ID_SENT; | |
2222 } | |
2223 else | |
2224 { | |
2225 TRACE_EVENT ("to give SMS to MFW -> failed"); | |
2226 /* the result operation of sent was NOT OK*/ | |
2227 //Sep 01, 2004 REF: CRR 21380 Deepa M.D | |
2228 //Second string is same as the TextId .Hence passed NULL. | |
2229 mmi_dialog_information_screen(win,TxtNotSent, NULL, (T_VOID_FUNC)SmsSend_standard_dialog_cb, SMSSEND_ID_NOT_SENT); | |
2230 // No forever dialog to be destroyed | |
2231 data->child_dialog = NULL; | |
2232 data->id = SMSSEND_ID_NOT_SENT; | |
2233 } | |
2234 | |
2235 /*SPR 2453, don't deallocate memory till sending complete*/ | |
2236 return 1; | |
2237 } | |
2238 | |
2239 | |
2240 /******************************************************************************* | |
2241 | |
2242 $Function: SmsSend_get_config_data | |
2243 | |
2244 $Description: Called by external processes to read SMS PP config data. | |
2245 | |
2246 $Returns: execution status | |
2247 | |
2248 $Arguments: config_data - SMS info | |
2249 | |
2250 *******************************************************************************/ | |
2251 | |
2252 UBYTE SmsSend_get_config_data (T_MFW_SMS_INFO *config_data) | |
2253 { | |
2254 T_MFW Submit_Status; /* store theh result of SMS send operation. */ | |
2255 | |
2256 TRACE_FUNCTION ("SmsSend_get_config_data()"); | |
2257 // get the current config data from SIM | |
2258 Submit_Status = sms_parameter(config_data, TRUE); | |
2259 | |
2260 if (Submit_Status == MFW_SMS_FAIL) | |
2261 { | |
2262 TRACE_EVENT ("ret MFW_SMS_FAIL"); | |
2263 return FALSE; | |
2264 } | |
2265 else | |
2266 { | |
2267 TRACE_EVENT ("ret OK"); | |
2268 return TRUE; | |
2269 } | |
2270 } | |
2271 /******************************************************************************* | |
2272 | |
2273 $Function: SmsSend_set_SrvCntr_number | |
2274 | |
2275 $Description: Called by external processes to write/Set SMS PP config data. | |
2276 | |
2277 $Returns: execution status | |
2278 | |
2279 $Arguments: config_data - SMS info | |
2280 | |
2281 *******************************************************************************/ | |
2282 | |
2283 UBYTE SmsSend_set_SrvCntr_number (T_MFW_SMS_INFO *config_data) | |
2284 { | |
2285 T_MFW Submit_Status; /* store theh result of SMS send operation. */ | |
2286 | |
2287 TRACE_FUNCTION ("SmsSend_set_SrvCntr_number()"); | |
2288 // get the current config data from SIM | |
2289 Submit_Status = sms_set_SrvCntr_number(config_data); | |
2290 | |
2291 if (Submit_Status == MFW_SMS_FAIL) | |
2292 { | |
2293 TRACE_EVENT ("ret MFW_SMS_FAIL"); | |
2294 return FALSE; | |
2295 } | |
2296 else | |
2297 { | |
2298 TRACE_EVENT ("ret OK"); | |
2299 return TRUE; | |
2300 } | |
2301 } | |
2302 UBYTE SmsSend_set_dcs_number (T_MFW_SMS_INFO *config_data) | |
2303 { | |
2304 T_MFW Submit_Status; /* store theh result of SMS send operation. */ | |
2305 | |
2306 TRACE_EVENT ("SmsSend_set_dcs_number()"); | |
2307 // get the current config data from SIM | |
2308 Submit_Status = sms_set_dcs_number(config_data); | |
2309 | |
2310 if (Submit_Status == MFW_SMS_FAIL) | |
2311 { | |
2312 TRACE_EVENT ("ret MFW_SMS_FAIL"); | |
2313 return FALSE; | |
2314 } | |
2315 else | |
2316 { | |
2317 TRACE_EVENT ("ret OK"); | |
2318 return TRUE; | |
2319 } | |
2320 } | |
2321 | |
2322 /* SPR#1428 - SH - New Editor: no longer required */ | |
2323 #ifndef NEW_EDITOR | |
2324 /******************************************************************************* | |
2325 | |
2326 $Function: SmsSend_loadEditDefault | |
2327 | |
2328 $Description: Configure T_EDITOR_DATA structure with default editor settings. | |
2329 | |
2330 $Returns: none | |
2331 | |
2332 $Arguments: editor_data - editor data. | |
2333 | |
2334 *******************************************************************************/ | |
2335 | |
2336 void SmsSend_loadEditDefault(T_EDITOR_DATA *editor_data) | |
2337 { | |
2338 TRACE_FUNCTION ("SmsSend_loadEditDefault()"); | |
2339 | |
2340 editor_attr_init(&editor_data->editor_attr, NULL, edtCurBar1, 0, 0, 0, COLOUR_EDITOR); | |
2341 editor_data_init(editor_data, NULL, TxtSoftSelect, TxtSoftBack, 0, 1, ALPHA_MODE, FOREVER); | |
2342 editor_data->hide = FALSE; | |
2343 editor_data->AlternateLeftSoftKey = TxtNull; | |
2344 editor_data->Identifier = 0; | |
2345 editor_data->TextString = NULL; | |
2346 editor_data->destroyEditor = TRUE ; | |
2347 } | |
2348 | |
2349 | |
2350 /******************************************************************************* | |
2351 | |
2352 $Function: SmsSend_loadUCS2EditDefault | |
2353 | |
2354 $Description: Configure T_EDITOR2_DATA structure with default editor settings. | |
2355 | |
2356 $Returns: none | |
2357 | |
2358 $Arguments: editor_data - editor data. | |
2359 | |
2360 *******************************************************************************/ | |
2361 | |
2362 static void SmsSend_loadUCS2EditDefault(T_EDITOR_DATA *editor_data) | |
2363 { | |
2364 TRACE_FUNCTION ("SmsSend_loadUCS2EditDefault()"); | |
2365 | |
2366 memset(editor_data, 0, sizeof(T_EDITOR_DATA)); | |
2367 editor_data->hide = FALSE; | |
2368 editor_data->LeftSoftKey = TxtSend; | |
2369 editor_data->AlternateLeftSoftKey = TxtSend; | |
2370 editor_data->RightSoftKey = TxtSave; | |
2371 editor_data->Identifier = SMSSEND_ID_TEXTEDIT; | |
2372 editor_data->mode = ALPHA_MODE; | |
2373 editor_data->min_enter = 0; | |
2374 editor_data->timeout = FOREVER; | |
2375 editor_data->Callback = (T_EDIT_CB)SmsSend_TEXTEDIT_edit_cb; | |
2376 } | |
2377 #endif /* NEW_EDITOR */ | |
2378 | |
2379 | |
2380 /******************************************************************************* | |
2381 | |
2382 $Function: SmsSend_standard_dialog_cb | |
2383 | |
2384 $Description: Callback function for standard dialogs in smssend module | |
2385 | |
2386 $Returns: none | |
2387 | |
2388 $Arguments: win - current window | |
2389 Identifier - unique id | |
2390 Reason - event id | |
2391 | |
2392 *******************************************************************************/ | |
2393 | |
2394 static int SmsSend_standard_dialog_cb(T_MFW_HND win, USHORT Identifier, USHORT Reason) | |
2395 { | |
2396 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
2397 T_SAVE * save_data = NULL; | |
2398 T_SEND * send_data = NULL; | |
2399 T_MFW_HND * l_parent = NULL; | |
2400 | |
2401 TRACE_FUNCTION ("SmsSend_standard_dialog_cb()"); | |
2402 | |
2403 | |
2404 | |
2405 switch (Identifier) | |
2406 { | |
2407 | |
2408 case SMSSEND_ID_SAVE_NOT_READY: | |
2409 case SMSSEND_ID_SC_NOT_READY: | |
2410 // SEND an event to recreate the text editor | |
2411 // or to recreate the destination address number editor | |
2412 SEND_EVENT (win, E_RETURN, Identifier, NULL); | |
2413 break; | |
2414 | |
2415 case SMSSEND_ID_WAIT_SEND: | |
2416 if (win_data != NULL) | |
2417 { | |
2418 send_data = (T_SEND *)win_data->user; | |
2419 // Forever child dialog has been destroyed | |
2420 if (send_data != NULL) | |
2421 send_data->child_dialog = NULL; | |
2422 } | |
2423 break; | |
2424 | |
2425 case SMSSEND_ID_WAIT_SAVE: | |
2426 // There is no way to stop SMS send | |
2427 if (win_data != NULL) | |
2428 { | |
2429 save_data = (T_SAVE *)win_data->user; | |
2430 // Forever child dialog has been destroyed | |
2431 if (save_data != NULL) | |
2432 save_data->child_dialog = NULL; | |
2433 } | |
2434 break; | |
2435 | |
2436 // Destroy the window then send the EXIT event to the SEND window->display of the text editor | |
2437 case SMSSEND_ID_SENT: | |
2438 case SMSSEND_ID_NOT_SENT: | |
2439 if ((Reason EQ INFO_KCD_RIGHT) || (Reason EQ INFO_KCD_HUP) || (Reason EQ INFO_TIMEOUT)) | |
2440 SEND_EVENT(win, E_EXIT, SEND_ID, NULL); | |
2441 // Do not reset child dialog handle, as 3s sending dialogs handle are not saved | |
2442 break; | |
2443 | |
2444 // Destroy the SAVE window and send an E_EXIT event to the parent window (useful if some actions are needed on return like in SEND) | |
2445 case SMSSEND_ID_SAVED: | |
2446 case SMSSEND_ID_NOT_SAVED: | |
2447 case SMSSEND_ID_LIST_FULL: | |
2448 if ((Reason EQ INFO_KCD_RIGHT) || (Reason EQ INFO_KCD_HUP) || (Reason EQ INFO_TIMEOUT)) | |
2449 { | |
2450 | |
2451 if (win_data != NULL) | |
2452 { | |
2453 save_data = (T_SAVE *)win_data->user; | |
2454 if (save_data != NULL) | |
2455 { | |
2456 l_parent = save_data->parent; | |
2457 } | |
2458 } | |
2459 // Destroy the window | |
2460 SmsSend_SAVE_destroy(win); | |
2461 // This will make SEND frame to recreate the text editor | |
2462 if (l_parent != NULL) | |
2463 SEND_EVENT(l_parent, E_EXIT, SAVE_ID, NULL); | |
2464 | |
2465 } | |
2466 break; | |
2467 | |
2468 | |
2469 default: | |
2470 TRACE_EVENT("MFW_EVENT_REJECTED"); | |
2471 return MFW_EVENT_REJECTED; | |
2472 } | |
2473 return MFW_EVENT_CONSUMED; | |
2474 } | |
2475 | |
2476 /******************************************************************************* | |
2477 | |
2478 $Function: SmsSend_convert_to_inter | |
2479 | |
2480 $Description: Transform a phone number in T_MFW_SMS_ADDR format to a string | |
2481 with a '+' character if international number | |
2482 | |
2483 $Returns: none | |
2484 | |
2485 $Arguments: source_number - calling number | |
2486 dest_number - called number | |
2487 *******************************************************************************/ | |
2488 | |
2489 void SmsSend_convert_to_inter(T_MFW_SMS_ADDR *source_number, // The number to convert | |
2490 char *dest_number) // The dest number with a '+' if needed | |
2491 { | |
2492 USHORT nb_char; | |
2493 USHORT i = 0; | |
2494 char *pt_digit = dest_number; | |
2495 | |
2496 TRACE_FUNCTION ("SmsSend_convert_to_inter()"); | |
2497 | |
2498 nb_char = strlen(source_number->number); | |
2499 | |
2500 if (source_number->ton == TON_International) | |
2501 { | |
2502 *pt_digit = '+'; | |
2503 pt_digit++; | |
2504 } | |
2505 | |
2506 for (i = 0; i <= nb_char; i++) | |
2507 pt_digit[i] = source_number->number[i]; | |
2508 } | |
2509 | |
2510 /******************************************************************************* | |
2511 | |
2512 $Function: SmsSend_R_OPTExeCentreEdit | |
2513 | |
2514 $Description: Create editor for entering the Service center number. | |
2515 | |
2516 $Returns: none | |
2517 | |
2518 $Arguments: m - menu handler | |
2519 i - menu item selected. | |
2520 *******************************************************************************/ | |
2521 | |
2522 | |
2523 int SmsSend_R_OPTExeCentreEdit(MfwMnu* m, MfwMnuItem* i) | |
2524 { | |
2525 T_MFW_HND parent_win = mfw_parent(mfw_header()); | |
2526 T_MFW_HND win = SmsSend_SEND_create(parent_win); | |
2527 SEND_EVENT(win,E_INIT,SMSSEND_ID_NBEDIT,0); | |
2528 return 1; // ADDED BY RAVI-28-11-2005 | |
2529 } | |
2530 /******************************************************************************* | |
2531 | |
2532 $Function: SmsSend_SCNBEDIT_edit_cb | |
2533 | |
2534 $Description: Callback function for the SC number editor. | |
2535 | |
2536 $Returns: none | |
2537 | |
2538 $Arguments: win - current window | |
2539 Identifier - unique id | |
2540 reason - event cause | |
2541 *******************************************************************************/ | |
2542 | |
2543 static void SmsSend_SCNBEDIT_edit_cb (T_MFW_HND win, USHORT Identifier, SHORT reason) | |
2544 { | |
2545 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
2546 T_SEND * data = (T_SEND *)win_data->user; | |
2547 | |
2548 T_MFW_SMS_INFO sms_parameter; | |
2549 | |
2550 | |
2551 TRACE_FUNCTION ("SmsSend_SCNBEDIT_edit_cb()"); | |
2552 | |
2553 | |
2554 switch (reason) | |
2555 { | |
2556 case INFO_KCD_LEFT: | |
2557 TRACE_EVENT("INFO_KCD_LEFT"); | |
2558 //GW Read config data to get value of dcs | |
2559 SmsSend_get_config_data(&sms_parameter); | |
2560 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE) | |
2561 { //We have a chinese text message - set dcs parameter to | |
2562 sms_parameter.dcs = MFW_DCS_UCS2; | |
2563 } | |
2564 else | |
2565 { | |
2566 sms_parameter.dcs = MFW_DCS_7bits; | |
2567 } | |
2568 //copy the sevice center number into the | |
2569 | |
2570 strcpy((char*)sms_parameter.sc_addr,(char*)data->edt_data.CentreBuffer); | |
2571 // store the Service center number into the SIM. | |
2572 SmsSend_set_SrvCntr_number (&sms_parameter); | |
2573 SmsSend_set_dcs_number (&sms_parameter); | |
2574 | |
2575 /* SPR#1428 - SH - New Editor changes */ | |
2576 #ifdef NEW_EDITOR | |
2577 AUI_edit_Destroy(data->number_editor); | |
2578 #else /* NEW_EDITOR */ | |
2579 editor_destroy(data->number_editor); | |
2580 #endif /* NEW_EDITOR */ | |
2581 | |
2582 SmsSend_SEND_destroy(win); | |
2583 data->number_editor = 0; | |
2584 | |
2585 break; | |
2586 | |
2587 case INFO_KCD_ALTERNATELEFT: | |
2588 TRACE_EVENT("INFO_KCD_ALTERNATELEFT"); | |
2589 | |
2590 bookPhonebookStart(win, PhbkFromSmsSC); /* SH - changed from PhbFromSms */ | |
2591 break; | |
2592 case INFO_KCD_RIGHT: | |
2593 case INFO_KCD_HUP: | |
2594 TRACE_EVENT("INFO_KCD_RIGHT/HUP"); | |
2595 /* SPR#1428 - SH - New Editor changes */ | |
2596 #ifdef NEW_EDITOR | |
2597 AUI_edit_Destroy(data->number_editor); | |
2598 #else /* NEW_EDITOR */ | |
2599 editor_destroy(data->number_editor); | |
2600 #endif /* NEW_EDITOR */ | |
2601 | |
2602 SmsSend_SEND_destroy(win); | |
2603 data->number_editor = 0; | |
2604 | |
2605 break; | |
2606 | |
2607 default: | |
2608 TRACE_EVENT("Err: Default"); | |
2609 break; | |
2610 } | |
2611 } | |
2612 | |
2613 // Feb 02, 2005 REF: CRR 28479 xnkulkar | |
2614 // Bug: While saving a SMS, if the user presses LSK while the 'Saved' dialog is displayed, the 'Saved' | |
2615 // dialog doesn't get dismissed. | |
2616 // Solution: New function "mmi_dialog_information_screen_save_sms" which has only | |
2617 // KEY_RIGHT and KEY_HUP registered instead of KEY_ALL | |
2618 /******************************************************************************* | |
2619 | |
2620 $Function: mmi_dialog_information_screen_save_sms | |
2621 | |
2622 $Description: Function to display SMS "Saved" info screen | |
2623 | |
2624 $Returns: info_dialog | |
2625 | |
2626 $Arguments: | |
2627 | |
2628 *******************************************************************************/ | |
2629 T_MFW_HND mmi_dialog_information_screen_save_sms(T_MFW_HND parent_win, int TxtId, char* text, T_VOID_FUNC call_back, USHORT identifier) | |
2630 { | |
2631 T_DISPLAY_DATA display_info; | |
2632 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TxtId, TxtNull, COLOUR_STATUS); | |
2633 dlg_initDisplayData_events( &display_info, call_back, THREE_SECS, KEY_RIGHT | KEY_HUP ); | |
2634 display_info.TextString2 = text; | |
2635 display_info.Identifier = identifier; | |
2636 return info_dialog(parent_win,&display_info); //information screen | |
2637 | |
2638 } | |
2639 | |
2640 #undef MMI_SMSSEND_C |