comparison src/ui3/bmi/mmiBookDetailsWindow.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/MmiBookDetailsWindow.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 (6349)
14 $Module: PhoneBook
15 $File: MmiBookDetailsWindow.h
16 $Revision: 1.0
17
18 $Author: Condat(UK)
19 $Date: 25/10/00
20
21 ********************************************************************************
22
23 Description:
24
25 Provides the details handlig for the phone book
26
27
28 ********************************************************************************
29 $History: MmiBookDetailsWindow.h
30
31 25/10/00 Original Condat(UK) BMI version.
32
33 $End
34
35 *******************************************************************************/
36
37
38
39
40 /*******************************************************************************
41
42 Include Files
43
44 *******************************************************************************/
45 #define ENTITY_MFW
46
47 /* includes */
48 #include <string.h>
49 #include <stdio.h>
50 #include <stdlib.h>
51
52 #if defined (NEW_FRAME)
53
54 #include "typedefs.h"
55 #include "vsi.h"
56 #include "pei.h"
57 #include "custom.h"
58 #include "gsm.h"
59
60 #else
61
62 #include "STDDEFS.H"
63 #include "custom.h"
64 #include "gsm.h"
65 #include "vsi.h"
66
67 #endif
68
69 #include "mfw_sys.h"
70
71 #include "mfw_mfw.h"
72 #include "mfw_win.h"
73 #include "mfw_kbd.h"
74 #include "mfw_lng.h"
75 /* SPR#1428 - SH - New Editor changes */
76 #ifndef NEW_EDITOR
77 #include "mfw_edt.h"
78 #endif
79 #include "mfw_icn.h"
80 #include "mfw_mnu.h"
81 #include "mfw_tim.h"
82
83 #include "mfw_sim.h"
84 #include "mfw_cm.h"
85 #include "mfw_nm.h"
86 #include "mfw_phb.h"
87 #include "mfw_mme.h"
88 #include "mfw_sat.h"
89 #include "mfw_sms.h"
90
91 #include "dspl.h"
92
93 #include "ksd.h"
94 #include "psa.h"
95
96 #include "MmiMain.h"
97 #include "MmiBookController.h"
98 #include "MmiDummy.h"
99 #include "MmiDialogs.h"
100 #include "MmiLists.h"
101
102
103
104 #include "MmiMenu.h"
105 #include "mmiCall.h"
106 #include "Mmiicons.h"
107 #include "MmiIdle.h"
108
109 #include "MmiSoftKeys.h"
110 #include "MmiSounds.h"
111 #include "MmiIdle.h"
112 #include "MmiNetwork.h"
113 #include "mmiSat_i.h"
114 #include "MmiAoc.h"
115
116 #include "gdi.h"
117 #include "audio.h"
118
119 #include "cus_aci.h"
120 #include "mfw_ffs.h"
121 #include "MmiTimers.h"
122
123 #include "MmiBookShared.h"
124
125 #include "mmiColours.h"
126
127
128
129 /*******************************************************************************
130
131 Private Methods
132
133 *******************************************************************************/
134
135
136 /*******************************************************************************
137
138 $Function: bookDetailsDialog
139
140 $Description: Dialog function for the details window, doesn't currently do
141 anything
142
143 $Returns: None
144
145 $Arguments: win, window handle
146 event, event to be handled
147 value, not used
148 parameter, not used
149
150 *******************************************************************************/
151
152 static void bookDetailsDialog ( T_MFW_HND win, USHORT event, SHORT value, void *parameter )
153 {
154 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data;
155 tBookStandard *data = (tBookStandard *)win_data->user;
156 T_MFW_PHB_ENTRY *entry;
157 /* SPR#1428 - SH - New Editor changes
158 * Insert the ascii or unicode name into the buffer */
159 #ifdef NEW_EDITOR
160 T_ATB_TEXT nameText;
161 T_ATB_TEXT numberText;
162
163 TRACE_FUNCTION("bookDetailsDialog");
164
165 entry = &data->phbk->current.entry[ data->phbk->current.selectedName ];
166 /*SPR 2175, no need to do any GSM->ASCII conversions, removed conversion code*/
167
168
169 numberText.dcs = ATB_DCS_ASCII;
170 numberText.data = entry->number;
171 ATB_string_Length(&numberText);
172
173 if ( entry->name.data[0] ==0x80)
174 {
175
176 /* UNICODE */
177 TRACE_EVENT("***UNICODE OUTPUT***");
178 nameText.dcs = ATB_DCS_UNICODE;
179 nameText.data = &entry->name.data[2];
180 }
181 else
182 {
183 nameText.dcs = ATB_DCS_ASCII;
184 nameText.data = entry->name.data;
185 }
186
187 ATB_string_Length(&nameText);
188
189 ATB_edit_ResetMode(data->editor, ED_MODE_READONLY); /* Switch off read only to add text */
190 ATB_edit_InsertString(data->editor, &nameText); /* Insert name string */
191 ATB_edit_Char(data->editor, ctrlEnter, FALSE); /* Insert carriage return */
192 ATB_edit_InsertString(data->editor, &numberText); /* Insert number string */
193 ATB_edit_SetMode(data->editor, ED_MODE_READONLY); /* Switch on read only again */
194
195 /* Text has changed, so refresh word wrap */
196 ATB_edit_Refresh(data->editor);
197
198 win_show(data->win);
199
200 #endif /* NEW_EDITOR */
201
202 }
203
204
205
206
207 /*******************************************************************************
208
209 $Function: bookDetailsWindowCB
210
211 $Description: Window event handler
212
213 $Returns: MFW_EVENT_CONSUMED for the window visible event,
214 MFW_EVENT_PASSED otherwise
215
216 $Arguments: e, event, w, window handle
217
218 *******************************************************************************/
219
220 static int bookDetailsWindowCB ( MfwEvt e, MfwWin *w )
221 {
222 tBookStandard *data = (tBookStandard *)w->user;
223
224 /* x0045876, 14-Aug-2006 (WR - "ptr" was declared but never referenced) */
225 #ifndef NEW_EDITOR
226 T_MFW_PHB_ENTRY *ptr; // dat;
227 #endif
228
229 // char debug[50]; // RAVI
230
231 TRACE_FUNCTION("bookDetailsWindowCB");
232 switch( e )
233 {
234 case MfwWinVisible:
235 {
236 /* handle the visible event, start by shoing the default information
237 */
238 MmiBookShowDefault();
239
240 /* SPR#1428 - SH - New Editor: display editor here rather than filling up the information. Do that in
241 * dialog function above. */
242
243 #ifdef NEW_EDITOR
244 ATB_edit_Show(data->editor);
245 resources_setTitleColour(COLOUR_EDITOR);
246
247 /* TITLE */
248
249 dspl_Clear(0,0, SCREEN_SIZE_X-1, data->editor->attr->win_size.py-1);
250 PROMPT(0,0,0,TxtDetails);
251 #else /* NEW_EDITOR */
252 /* Build and show the editor
253 */
254 ptr = &data->phbk->current.entry[ data->phbk->current.selectedName ];
255 #ifdef NO_ASCIIZ
256
257 #ifdef EASY_TEXT_ENABLED
258 /*MC SPR 1242, changed macros to function calls e.g FIRST_LINE_CHINESE->Mmi_layout_first_line()*/
259 if ( ptr->name.data[0] ==0x80)//if unicode
260 {
261 TRACE_EVENT("***UNICODE OUTPUT***");
262 dspl_TextOut(0,0,DSPL_TXTATTR_UNICODE,(char *)&ptr->name.data[2]);
263 if ((ptr->name.data[MAX_LINE+2] != 0) && ptr->name.data[MAX_LINE+3] != 0)
264 dspl_TextOut(0,Mmi_layout_line(1),DSPL_TXTATTR_UNICODE,(char *)&(ptr->name.data[MAX_LINE+2]));
265 dspl_TextOut(0,Mmi_layout_line(2),0,(char *)ptr->number);
266 if (strlen((char*)ptr->number) > MAX_LINE)
267 dspl_TextOut(0,Mmi_layout_line(1)+numberLineHeight(),0, (char*)&ptr->number[MAX_LINE]);
268 }
269 else
270 #endif /* EASY_TEXT_ENABLED */
271 {
272 // convert from GSM to Alpha characters
273 bookGsm2Alpha( (UBYTE *) ptr->name.data );
274
275 sprintf( data->edtBuf,"%s%s%s", (char *) ptr->name.data, "\n", (char *) ptr->number);
276 edtShow(data->edt);
277 }
278 #else /* NO_ASCIIZ */
279 {
280 sprintf( data->edtBuf,"%s%s%s", (char *) ptr->name, "\n", (char *) ptr->number);
281 edtShow(data->edt);
282 }
283 #endif /* NO_ASCIIZ */
284 #endif /* NEW_EDITOR */
285 /* pop up the soft keys
286 */
287 displaySoftKeys( TxtSoftCall, /* TxtSoftOptions */ TxtSoftBack );
288 }
289 break;
290
291 default:
292 {
293 /* default handler just indicate event not handled
294 */
295 return MFW_EVENT_PASSED;
296 }
297 }
298
299 return MFW_EVENT_CONSUMED;
300 }
301
302
303 /*******************************************************************************
304
305 $Function: bookDetailsKbdCB
306
307 $Description: Keyboard handler
308
309 $Returns: MFW_EVENT_CONSUMED always
310
311 $Arguments: e, event, k, key handle
312
313 *******************************************************************************/
314
315 static int bookDetailsKbdCB ( MfwEvt e, MfwKbd *k )
316 {
317 T_MFW_HND win = mfwParent( mfw_header() );
318 T_MFW_WIN *win_data = ((T_MFW_HDR *) win)->data;
319 tBookStandard *data = (tBookStandard *) win_data->user;
320 tMmiPhbData *Current = &data->phbk->current;
321
322 TRACE_FUNCTION("bookDetailsKbdCB()");
323
324 /* Handle the key events
325 */
326 switch (k->code)
327 {
328 case KCD_MNUUP:
329 break;
330
331 case KCD_MNUDOWN:
332 break;
333
334 case KCD_MNUSELECT:
335 case KCD_CALL:
336 case KCD_LEFT:
337 {
338 /* select to make the call
339 */
340 callNumber( Current->entry[ Current->selectedName ].number );
341 bookPhonebookDestroy( data->phbk->win );
342 }
343 break;
344
345 case KCD_RIGHT:
346 {
347 /* start up the options menu
348 */
349 //Cancel this screen
350 bookDetailsDestroy( data->win );
351 }
352 break;
353
354 case KCD_HUP:
355 {
356 /* Cancel this menu
357 */
358 bookDetailsDestroy( data->win );
359 }
360 break;
361
362 default:
363 {
364 /* default handling is to get us out of here
365 */
366 memset( data->edtBuf, '\0', sizeof( data->edtBuf ) );
367 sprintf( data->edtBuf, "%s%c", (char *) Current->entry[ Current->selectedName ].number, editControls[ k->code ] );
368 idleDialBuffer( data->edtBuf );
369 bookPhonebookDestroy( data->phbk->win );
370 }
371 break;
372 }
373
374 return MFW_EVENT_CONSUMED;
375 }
376
377
378 /*******************************************************************************
379
380 $Function: bookDetailsKbdLongCB
381
382 $Description: Keyboard Long Press event handler
383
384 $Returns: MFW_EVENT_CONSUMED always
385
386 $Arguments: e, event, k, keyboard handle
387
388 *******************************************************************************/
389
390 static int bookDetailsKbdLongCB( MfwEvt e, MfwKbd *k )
391 {
392 T_MFW_HND win = mfwParent( mfw_header() );
393 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data;
394 tBookStandard *data = (tBookStandard *) win_data->user;
395
396 /* hand a long clear event only
397 */
398 if ( ( e & KEY_CLEAR ) && ( e & KEY_LONG ) )
399 bookDetailsDestroy( data->win );
400
401 return MFW_EVENT_CONSUMED;
402 }
403
404
405
406
407 /*******************************************************************************
408
409 $Function: bookDetailsCreate
410
411 $Description: create an instance of the details window
412
413 $Returns: handle of newly created window, or NULL if we fail to create
414
415 $Arguments: parent, handle of parent window
416
417 *******************************************************************************/
418
419 static T_MFW_HND bookDetailsCreate(MfwHnd parent)
420 {
421 T_MFW_WIN *parent_win_data = ( (T_MFW_HDR *) parent )->data;
422 T_phbk *phbk = (T_phbk *)parent_win_data->user;
423 T_MFW_WIN *win_data;
424 tBookStandard *data;
425
426 TRACE_FUNCTION ("bookDetailsCreate()");
427
428 /* allocate memory for our control block
429 */
430 if ( ( data = (tBookStandard *) ALLOC_MEMORY( sizeof( tBookStandard ) ) ) == NULL )
431 return NULL;
432
433 /* Create the window if we can
434 */
435 if ( ( data->win = win_create( parent, 0, E_WIN_VISIBLE, (T_MFW_CB) bookDetailsWindowCB ) ) == NULL )
436 {
437 FREE_MEMORY( (void *)data, sizeof( tBookStandard ) );
438 return NULL;
439 }
440
441 /* Okay, we have created the control block and the window, so
442 we now need to configure the dialog and data pointers
443 */
444 data->mmi_control.dialog = (T_DIALOG_FUNC) bookDetailsDialog;
445 data->mmi_control.data = data;
446 win_data = ((T_MFW_HDR *)data->win)->data;
447 win_data->user = (void *) data;
448 data->phbk = phbk;
449 data->parent_win = parent;
450
451 /* create keyboards and menus for our window
452 */
453 data->kbd = kbdCreate( data->win, KEY_ALL, (MfwCb) bookDetailsKbdCB );
454 data->kbd_long = kbdCreate( data->win, KEY_ALL | KEY_LONG, (MfwCb) bookDetailsKbdLongCB );
455
456 /* 1945 MZ Initialise the edtBuf */
457 memset(data->edtBuf,'\0', STANDARD_EDITOR_SIZE );
458
459 /* SPR#1428 - SH - New Editor changes */
460 #ifdef NEW_EDITOR
461 AUI_edit_SetAttr( &data->editor_attr, BOOKDETAILS_EDITOR, COLOUR_EDITOR_XX, EDITOR_FONT, ED_MODE_READONLY, ED_CURSOR_NONE, ATB_DCS_UNICODE/*SPR1752*/, (UBYTE *)data->edtBuf, STANDARD_EDITOR_SIZE);
462 data->editor = ATB_edit_Create( &data->editor_attr, 0 );
463 SEND_EVENT(data->win, 0, 0, 0);
464 ATB_edit_Init(data->editor);
465 #else /*NEW_EDITOR*/
466 // API - 08-01-03 - 1540 - change edtCurBar1 to edtCurNone
467 bookSetEditAttributes( BOOKDETAILS_EDITOR, COLOUR_EDITOR_XX, 0, edtCurNone, 0, data->edtBuf, STANDARD_EDITOR_SIZE, &data->attr );
468 data->edt = edtCreate( data->win, &data->attr, 0, 0 );
469 edtUnhide( data->edt );
470 #endif /*NEW_EDITOR*/
471
472 /* allow the window and menu to be created
473 */
474 mnuUnhide(data->menu);
475 winShow(data->win);
476
477 /* And return the handle of the newly created window
478 */
479 return data->win;
480 }
481
482
483
484
485 /*******************************************************************************
486
487 Public Methods
488
489 *******************************************************************************/
490
491
492 /*******************************************************************************
493
494 $Function: bookDetailsStart
495
496 $Description: Start routine for the phonebook details window
497
498 $Returns: None, assigns the window handle to the name_details_win
499 hook in the current phone book
500
501 $Arguments: m, menu, i, menu item
502
503 *******************************************************************************/
504
505 void bookDetailsStart( MfwMnu* m, MfwMnuItem* i )
506 {
507 T_MFW_HND win = mfwParent(mfw_header());
508 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data;
509 tBookStandard *data = (tBookStandard *)win_data->user;
510
511 TRACE_FUNCTION ("bookDetailsStart()");
512
513 data->phbk->name_details_win = bookDetailsCreate( data->phbk->win );
514 }
515
516
517
518
519 /*******************************************************************************
520
521 $Function: bookDetailsDestroy
522
523 $Description: Destroy the phone book details window
524
525 $Returns: None
526
527 $Arguments: window, handle of window to close
528
529 *******************************************************************************/
530
531 void bookDetailsDestroy( MfwHnd window )
532 {
533 T_MFW_WIN *win = ((T_MFW_HDR *)window)->data;
534 tBookStandard *data = (tBookStandard *)win->user;
535
536 TRACE_FUNCTION ("bookDetailsdestroy()");
537
538 /* Only need to do this if the data is valid
539 */
540 if ( data )
541 {
542 /* SPR#1428 - SH - New Editor changes */
543 #ifdef NEW_EDITOR
544 /* New editor no longer destroyed with winDelete,
545 * so destroy it here */
546 if (data->editor)
547 {
548 ATB_edit_Destroy(data->editor);
549 }
550 #endif /* NEW_EDITOR */
551 data->phbk->name_details_win = 0;
552 winDelete( data->win );
553 FREE_MEMORY( (void *)data, sizeof( tBookStandard ) );
554 }
555 }
556
557
558
559
560 /*******************************************************************************
561
562 End of File
563
564 *******************************************************************************/