comparison src/ui3/bmi/mmiSmsSend.c @ 421:6a4d9f47793e

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