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

src/aci2, src/condat2: import of g23m/condat source pieces from TCS211
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 26 Sep 2016 00:29:36 +0000
parents
children
comparison
equal deleted inserted replaced
2:c41a534f33c6 3:93999a60b835
1 /*******************************************************************************
2
3 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 (6349)
14 $Module: PhoneBook
15 $File: MmiBookPhoneBook.c
16 $Revision: 1.0
17
18 $Author: Condat(UK)
19 $Date: 25/10/00
20
21 ********************************************************************************
22
23 Description
24
25 This module provides the basic phone book functionality
26
27
28 ********************************************************************************
29 $History: MmiBookPhoneBook.c
30 CRR: 25302 - xpradipg 10 Nov 2004
31 Description: Should be able to select the number fro the phonebook while
32 sending MMS/EMS.
33 Solution: The new feature to select the number from phonebook while sending
34 sending MMS/EMS.
35 Solution: The new feature to select the number from phonebook while sending
36
37 Aug 16, 2004 REF: CRR 24323 Deepa M.D
38 Bug:Clenup of sprintf used for tracing
39 Fix:Replace the char buf[]; sprintf (buf, "...", ...); TRACE_EVENT (buf); statements by TRACE_EVENT_PX
40
41
42 Sep 29, 2004 REF: CRR 25041 xvilliva
43 Bug: add new entry in the FDN , phone gets rebooted.
44 Fix: The global variable "menuFDN" is reset while menu is destroyed.
45
46 Jul 21, 2004 REF: CRR 13348 xvilliva
47 Bug: After selecting HPLMN manually, the idle screen is not shown.
48 Fix: After phonebook menu is created, we store the window handle in a
49 global.
50
51
52 25/10/00 Original Condat(UK) BMI version.
53
54 $End
55
56 *******************************************************************************/
57
58
59 /******************************************************************************
60
61 Include Files
62
63 *******************************************************************************/
64 #define ENTITY_MFW
65
66 /* includes */
67 #include <string.h>
68 #include <stdio.h>
69 #include <stdlib.h>
70
71 #if defined (NEW_FRAME)
72
73 #include "typedefs.h"
74 #include "vsi.h"
75 #include "pei.h"
76 #include "custom.h"
77 #include "gsm.h"
78
79 #else
80
81 #include "STDDEFS.H"
82 #include "custom.h"
83 #include "gsm.h"
84 #include "vsi.h"
85
86 #endif
87
88 #include "mfw_sys.h"
89
90 #include "mfw_mfw.h"
91 #include "mfw_win.h"
92 #include "mfw_kbd.h"
93 #include "mfw_lng.h"
94 /* SPR#1428 - SH - New Editor changes */
95 #ifndef NEW_EDITOR
96 #include "mfw_edt.h"
97 #endif
98 #include "mfw_icn.h"
99 #include "mfw_mnu.h"
100 #include "mfw_tim.h"
101
102 #include "mfw_sim.h"
103 #include "mfw_cm.h"
104 #include "mfw_nm.h"
105 #include "mfw_phb.h"
106 #include "mfw_mme.h"
107 #include "mfw_sat.h"
108 #include "mfw_sms.h"
109
110 #include "dspl.h"
111
112 #include "ksd.h"
113 #include "psa.h"
114
115 #include "MmiMain.h"
116 #include "MmiBookController.h"
117 #include "MmiDummy.h"
118 #include "MmiDialogs.h"
119 #include "MmiLists.h"
120
121
122
123 #include "MmiMenu.h"
124 #include "mmiCall.h"
125 #include "Mmiicons.h"
126 #include "MmiIdle.h"
127
128 #include "MmiSoftKeys.h"
129 #include "MmiSounds.h"
130 #include "MmiIdle.h"
131 #include "MmiNetwork.h"
132 #include "mmiSat_i.h"
133 #include "MmiAoc.h"
134
135 #include "gdi.h"
136 #include "audio.h"
137
138 #include "cus_aci.h"
139 #include "mfw_ffs.h"
140 #include "MmiTimers.h"
141
142
143
144
145 #include "MmiBookShared.h"
146 #include "MmiBookController.h"
147
148 #include "mmiColours.h"
149
150 //Jul 21, 2004 REF: CRR 13348 xvilliva
151 //This is a global variable used to store the handle, when
152 //phonebook menu is created.
153 T_MFW_HND gPhbkMenu = NULL;
154 //Sep 29, 2004 REF: CRR 25041 xvilliva
155 extern int menuFDN;
156
157
158 /*******************************************************************************
159
160 Private Methods
161
162 *******************************************************************************/
163
164 /*******************************************************************************
165
166 $Function: bookPhonebookDialog
167
168 $Description: Dialog function for the phone book application
169
170 $Returns: none
171
172 $Arguments: win, window handle
173 event, event to be handled
174 value, not used
175 parameter, reason for call
176
177 *******************************************************************************/
178
179 static void bookPhonebookDialog( T_MFW_HND win, USHORT event, SHORT value, void *parameter )
180 {
181 T_MFW_WIN *win_data = ((T_MFW_HDR *) win)->data;
182 T_phbk *data = (T_phbk *) win_data->user;
183 SHORT *reason = (SHORT *) parameter;
184
185 TRACE_FUNCTION ("bookPhonebookDialog()");
186 switch (event)
187 {
188 case PHBK_INIT:
189 {
190 /* Initialise the phone book application.
191 Note that we need to deal with a number of different
192 initialisation types, depending on the reason given
193 */
194 memset( data->edt_buf_name, '\0', sizeof( data->edt_buf_name ) );
195 memset( data->edt_buf_number, '\0', sizeof( data->edt_buf_number ) );
196
197 /* SPR#1428 - SH - New Editor changes */
198 #ifndef NEW_EDITOR
199 /* No longer needed for NEW_EDITOR - attributes are initialised when editors created*/
200 bookSetEditAttributes( PHONEBOOK_DLG_EDITOR, COLOUR_EDITOR_XX, 0, edtCurBar1, 0,
201 (char *) data->edt_buf_name, MAX_ALPHA_LEN, &data->edt_attr_name );
202 bookSetEditAttributes( PHONEBOOK_DLG_EDITOR, COLOUR_EDITOR_XX, 0, edtCurBar1, 0,
203 (char *) data->edt_buf_number, MAX_ALPHA_LEN, &data->edt_attr_number );
204 #endif
205
206 /* deal with the different initialisation types
207 */
208 if ((bookPhoneBookLoading()==BOOK_FAILURE)&&(( *reason )!=PhbkMainMenu))
209 {
210 T_DISPLAY_DATA display_info;
211
212 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TxtPleaseWait, TxtNull , COLOUR_STATUS_WAIT);
213 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)NULL, THREE_SECS, KEY_CLEAR );
214
215 /* Call Info Screen
216 */
217 info_dialog( idle_get_window(), &display_info );
218
219 bookPhonebookDestroy(data->win);
220 return;
221 }
222 switch ( *reason )
223 {
224 case PhbkNormal:
225 {
226 /* Normal initialisation
227 */
228 data->current.status.book = bookActiveBook(READ);
229 data->current.index = 1;
230 data->menu_main_win = bookMenuStart( data->win, bookPhonebookMenuAttributes(), *reason);
231 data->root_win = data->menu_main_win;
232 }
233 break;
234
235 case PhbkMainMenu:
236 {
237 /* Normal initialisation
238 */
239 data->current.status.book = bookActiveBook(READ);
240 data->current.index = 1;
241 data->menu_main_win = bookMenuStart( data->win, bookMainMenuAttributes(), *reason);
242 data->root_win = data->menu_main_win;
243 }
244 break;
245
246 case PhbkReplyListNormal:
247 {
248 TRACE_EVENT ("PhbkReplyListNormal");
249
250 /* reply list
251 */
252 bookCallListStart(win,PHB_LRN);
253 }
254 break;
255 case PhbkMissedCallsListNormal:
256 {
257 /* reply list
258 */
259 bookCallListStart(win,PHB_LMN);
260 }
261 break;
262
263 case PhbkRedialListNormal:
264 {
265 /* Redial list
266 */
267 bookCallListStart(win,PHB_LDN);
268 }
269 break;
270
271 case PhbkNameEnterIdle:
272 {
273 /* Normal initialisation
274 */
275 data->current.status.book = bookActiveBook(READ);
276 data->current.index = 1;
277 data->menu_main_win = bookMenuStart( data->win, bookPhonebookMenuAttributes(), *reason);
278 data->root_win = data->menu_main_win;
279 data->phbk->UpdateAction = ADD_FROM_IDLE;
280 }
281 break;
282
283 case PhbkSearchNormal :
284 {
285 /* Search window
286 */
287 data->root_win = data->phbk->search_win;
288 }
289 break;
290
291 case PhbkFromSms :
292 {
293 /* Invoked from within SMS, need to remember this
294 */
295 data->phbk->fromSMS = TRUE;
296 data->root_win = data->phbk->search_win;
297 data->phbk->current.KindOfSearch = SEARCH_BY_NAME;
298 data->phbk->current.status.book = bookActiveBook(READ);
299 data->phbk->search_win = bookSearchStart( data->phbk->win );
300
301 }
302 break;
303 //CRR: 25302 - xpradipg 10 Nov 2004
304 //New case added to handle the retrival of number from MMS/EMS
305 case PhbkFromMms :
306 {
307 /* Invoked from within MMS/EMS, need to remember this
308 */
309 data->phbk->fromMmsEms = TRUE;
310 data->root_win = data->phbk->search_win;
311 data->phbk->current.KindOfSearch = SEARCH_BY_NAME;
312 data->phbk->current.status.book = bookActiveBook(READ);
313 data->phbk->search_win = bookSearchStart( data->phbk->win );
314
315 }
316 break;
317
318 /*SH*/
319 case PhbkFromSmsSC :
320 {
321 /* Invoked from within SMS Service centre, need to remember this
322 */
323 data->phbk->fromSMSSC = TRUE;
324 data->root_win = data->phbk->search_win;
325 data->phbk->current.KindOfSearch = SEARCH_BY_NAME;
326 data->phbk->current.status.book = bookActiveBook(READ);
327 data->phbk->search_win = bookSearchStart( data->phbk->win );
328
329 }
330 break;
331
332 case PhbkFromDivert:
333 {
334 /* Invoked from within Divert, need to remember this
335 */
336 data->phbk->fromDivert = TRUE;
337 data->root_win = data->phbk->search_win;
338 data->phbk->current.KindOfSearch = SEARCH_BY_NAME;
339 data->phbk->current.status.book = bookActiveBook(READ);
340 data->phbk->search_win = bookSearchStart( data->phbk->win );
341
342 }
343
344 break;
345 /*SPR 1392, initialisation from call deflection*/
346 case PhbkFromDeflect:
347 {
348 /* Invoked from within Divert, need to remember this
349 */
350 data->phbk->fromDeflect = TRUE;
351 data->root_win = data->phbk->search_win;
352 data->phbk->current.KindOfSearch = SEARCH_BY_NAME;
353 data->phbk->current.status.book = bookActiveBook(READ);
354 data->phbk->search_win = bookSearchStart( data->phbk->win );
355
356 }
357
358 break;
359
360 default:
361 {
362 /* No default action required
363 */
364 }
365 }
366 }
367 break;
368 case PHBK_SEND_NUMBER:
369 TRACE_EVENT ("PHBK_SEND_NUMBER");
370 /***************************Go-lite Optimization changes Start***********************/
371 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
372 TRACE_EVENT_P3 ("win %p parameter %s data->phbk %p",win,(char*)parameter,data->phbk);
373 /***************************Go-lite Optimization changes end***********************/
374 strncpy( data->phbk->edt_buf_number, (char*)parameter, PHB_MAX_LEN );
375 break;
376 default:
377 {
378 /* No default action required
379 */
380 }
381 }
382 }
383
384
385
386
387
388
389
390
391
392 /*******************************************************************************
393
394 $Function: bookPhonebookWindowCB
395
396 $Description: Window call back for the phone book application
397
398 $Returns: MFW_EVENT_CONSUMED if event is MfwWinVisible, otherwise
399 MFW_EVENT_PASSED
400
401 $Arguments: e, event, w, window handle
402
403 *******************************************************************************/
404
405 static int bookPhonebookWindowCB ( MfwEvt e, MfwWin *w )
406 {
407 TRACE_FUNCTION ("bookPhonebookWindowCB()");
408 return ( e == MfwWinVisible ) ? MFW_EVENT_CONSUMED : MFW_EVENT_PASSED;
409 }
410
411
412
413
414
415
416
417
418 /*******************************************************************************
419
420 $Function: bookPhonebookCreate
421
422 $Description: Create the phone book application
423
424 $Returns: Handle of the newly created window or NULL if error
425
426 $Arguments: parent, handle of parent window
427
428 *******************************************************************************/
429
430 static T_MFW_HND bookPhonebookCreate( MfwHnd parent )
431 {
432 T_MFW_WIN *win_data;
433 T_phbk *data;
434
435 TRACE_FUNCTION ("bookPhonebookCreate()");
436
437 if ( ( data = (T_phbk *) ALLOC_MEMORY( sizeof( T_phbk ) ) ) == NULL )
438 return NULL;
439
440 if ( ( data->win = win_create( parent, 0, E_WIN_VISIBLE, (T_MFW_CB) bookPhonebookWindowCB ) ) == NULL )
441 {
442 FREE_MEMORY( (void *) data, sizeof( T_phbk ) );
443 return NULL;
444 }
445
446 /* Create window handler
447 */
448 data->mmi_control.dialog = (T_DIALOG_FUNC) bookPhonebookDialog;
449 data->mmi_control.data = data;
450 win_data = ((T_MFW_HDR *)data->win)->data;
451 win_data->user = (void *)data;
452 winShow(data->win);
453
454 /* initialise the options structure
455 */
456 data->root_win = 0;
457 data->menu_main_win = 0;
458 data->calls_list_win = 0;
459 data->menu_options_win = 0;
460 data->menu_options_win_2 = 0;
461 data->menu_call_options_win = 0;
462 data->menu_call_options_win_2 = 0;
463 data->name_details_win = 0;
464 data->search_win = 0;
465 data->fromSMS = FALSE;
466 data->fromSMSSC = FALSE;
467 data->fromDivert = FALSE;
468 data->fromDeflect = FALSE;/*SPR 1392*/
469 data->parent_win = parent;
470 data->phbk = data;
471
472 /* return window handle
473 */
474 return data->win;
475 }
476
477
478
479
480
481 /*******************************************************************************
482
483 Public methods
484
485 *******************************************************************************/
486
487 /*******************************************************************************
488
489 $Function: bookPhonebookStart
490
491 $Description: Starts up the phone book application
492
493 $Returns: Handle of window or NULL if error
494
495 $Arguments: parent, window, reason, for invocation
496
497 *******************************************************************************/
498
499 T_MFW_HND bookPhonebookStart( MfwHnd parent, int reason )
500 {
501 T_MFW_HND win;
502
503 if ( ( win = bookPhonebookCreate( parent ) ) != NULL )
504 {
505 SEND_EVENT( win, PHBK_INIT, 0, (int *) &reason );
506 if(reason == PhbkMainMenu)
507 gPhbkMenu = win;//Jul 21, 2004 REF: CRR 13348 xvilliva
508 }
509 return win;
510 }
511
512
513
514
515
516
517 /*******************************************************************************
518
519 $Function: bookPhonebookDestroy
520
521 $Description: Destroys the phone book application
522
523 $Returns: none
524
525 $Arguments: window, to be destroyed
526
527 *******************************************************************************/
528
529 void bookPhonebookDestroy( MfwHnd window )
530 {
531 T_MFW_WIN *win = ((T_MFW_HDR *)window)->data;
532 T_phbk *data = (T_phbk *) win->user;
533
534 TRACE_FUNCTION ("bookPhonebookDestroy()");
535
536 if ( data )
537 {
538 /* need to clean up all of the subordinate windows which
539 may have been created during the phone book application
540 */
541 data->root_win = 0;
542 if (data->search_win)
543 bookSearchDestroy( data->search_win );
544
545 if (data->menu_main_win)
546 bookMenuDestroy(data->menu_main_win);
547
548 if (data->calls_list_win)
549 bookCallListDestroy(data->calls_list_win);
550
551 if (data->menu_options_win)
552 bookMenuDestroy(data->menu_options_win);
553
554 if (data->menu_options_win_2)
555 bookMenuDestroy(data->menu_options_win_2);
556
557 if (data->menu_call_options_win)
558 bookMenuDestroy(data->menu_call_options_win);
559
560 if (data->menu_call_options_win_2)
561 {
562 menuFDN = 0 ;// Sep 29, 2004 REF: CRR 25041 xvilliva
563 bookMenuDestroy(data->menu_call_options_win_2);
564 }
565
566 if (data->name_details_win)
567 bookDetailsDestroy(data->name_details_win);
568
569 if (data->input_name_win)
570 bookInputDestroy(data->input_name_win);
571
572 if (data->input_number_win)
573 bookInputDestroy(data->input_number_win);
574
575 /* delete the window and free any allocated memory
576 */
577 winDelete (data->win);
578 FREE_MEMORY( (void *) data, sizeof( T_phbk ) );
579 }
580 //Jul 21, 2004 REF: CRR 13348 xvilliva
581 //While we destroy the menu assign the handle to NULL.
582 gPhbkMenu = NULL;
583
584 }
585
586
587 /*******************************************************************************
588
589 End Of File
590
591 *******************************************************************************/