FreeCalypso > hg > tcs211-c139
comparison g23m/condat/ms/src/bmi/MmiBookCallDetailsWindow.c @ 0:509db1a7b7b8
initial import: leo2moko-r1
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 03:24:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:509db1a7b7b8 |
---|---|
1 /******************************************************************************* | |
2 | |
3 CONDAT (UK) | |
4 | |
5 ******************************************************************************** | |
6 | |
7 This software product is the property of Condat (UK) Ltd and may not be | |
8 disclosed to any third party without the express permission of the owner. | |
9 | |
10 ******************************************************************************** | |
11 | |
12 $Project name: Basic MMI | |
13 $Project code: BMI (6349) | |
14 $Module: PhoneBook | |
15 $File: MmiBookCallDetailsWindow.c | |
16 $Revision: 1.0 | |
17 | |
18 $Author: Condat(UK) | |
19 $Date: 25/10/00 | |
20 | |
21 ******************************************************************************** | |
22 | |
23 Description: | |
24 | |
25 This provides the implementation of the call details window for the | |
26 phone book module | |
27 | |
28 ******************************************************************************** | |
29 $History: MmiBookCallDetailsWindow.c | |
30 | |
31 Aug 24, 2004 REF: CRR 22638 xrashmic | |
32 Bug: E-Sample switches off when you attempt to look at details of a number | |
33 in call list. | |
34 Fix: Using the data stored in global variable to avoid corrupt data. | |
35 | |
36 25/10/00 Original Condat(UK) BMI version. | |
37 | |
38 $End | |
39 // Issue Number : SPR#12874 on 31/03/04 by Rashmi.C.N. | |
40 *******************************************************************************/ | |
41 | |
42 | |
43 | |
44 | |
45 /******************************************************************************* | |
46 | |
47 Include Files | |
48 | |
49 *******************************************************************************/ | |
50 #define ENTITY_MFW | |
51 | |
52 /* includes */ | |
53 #include <string.h> | |
54 #include <stdio.h> | |
55 #include <stdlib.h> | |
56 | |
57 #if defined (NEW_FRAME) | |
58 | |
59 #include "typedefs.h" | |
60 #include "vsi.h" | |
61 #include "pei.h" | |
62 #include "custom.h" | |
63 #include "gsm.h" | |
64 | |
65 #else | |
66 | |
67 #include "STDDEFS.H" | |
68 #include "custom.h" | |
69 #include "gsm.h" | |
70 #include "vsi.h" | |
71 | |
72 #endif | |
73 | |
74 #include "mfw_sys.h" | |
75 | |
76 #include "mfw_mfw.h" | |
77 #include "mfw_win.h" | |
78 #include "mfw_kbd.h" | |
79 #include "mfw_lng.h" | |
80 /* SPR#1428 - SH - New Editor changes */ | |
81 #ifndef NEW_EDITOR | |
82 #include "mfw_edt.h" | |
83 #endif | |
84 #include "mfw_icn.h" | |
85 #include "mfw_mnu.h" | |
86 #include "mfw_tim.h" | |
87 | |
88 #include "mfw_sim.h" | |
89 #include "mfw_cm.h" | |
90 #include "mfw_nm.h" | |
91 #include "mfw_phb.h" | |
92 #include "mfw_mme.h" | |
93 #include "mfw_sat.h" | |
94 #include "mfw_sms.h" | |
95 | |
96 #include "dspl.h" | |
97 | |
98 #include "ksd.h" | |
99 #include "psa.h" | |
100 /* SPR#1428 - SH - New Editor changes */ | |
101 #ifdef NEW_EDITOR | |
102 #include "ATBCommon.h" | |
103 #include "ATBDisplay.h" | |
104 #include "ATBEditor.h" | |
105 #include "AUIEditor.h" | |
106 #endif | |
107 | |
108 #include "MmiMain.h" | |
109 #include "MmiBookController.h" | |
110 #include "MmiDummy.h" | |
111 #include "MmiDialogs.h" | |
112 #include "MmiLists.h" | |
113 | |
114 #include "MmiMenu.h" | |
115 #include "mmiCall.h" | |
116 #include "Mmiicons.h" | |
117 #include "MmiIdle.h" | |
118 | |
119 #include "MmiSoftKeys.h" | |
120 #include "MmiSounds.h" | |
121 #include "MmiIdle.h" | |
122 #include "MmiNetwork.h" | |
123 #include "mmiSat_i.h" | |
124 #include "MmiAoc.h" | |
125 | |
126 #include "gdi.h" | |
127 #include "audio.h" | |
128 | |
129 #include "cus_aci.h" | |
130 #include "mfw_ffs.h" | |
131 #include "MmiTimers.h" | |
132 | |
133 #include "MmiBookShared.h" | |
134 #include "MmiCPHS.h" | |
135 #include "mmiColours.h" | |
136 | |
137 | |
138 #define CALLDETAILS_INFO_LEN 32 | |
139 | |
140 // Aug 24, 2004 REF: CRR 22638 xrashmic | |
141 extern tMmiPhbData g_temp_current ; | |
142 | |
143 /******************************************************************************* | |
144 | |
145 Private methods | |
146 | |
147 *******************************************************************************/ | |
148 | |
149 | |
150 | |
151 /******************************************************************************* | |
152 | |
153 $Function: bookCallDetails | |
154 | |
155 $Description: dialog function for the call details windows | |
156 | |
157 $Returns: None. | |
158 | |
159 $Arguments: win, window handle | |
160 event, event to be handled | |
161 value, not used | |
162 parameter, not used | |
163 | |
164 *******************************************************************************/ | |
165 | |
166 static void bookCallDetails( T_MFW_HND win, USHORT event, SHORT value, void * parameter ) | |
167 { | |
168 T_MFW_WIN *win_data = ((T_MFW_HDR *) win)->data; | |
169 tBookStandard *data = (tBookStandard *)win_data->user; | |
170 #ifdef NEW_EDITOR | |
171 T_MFW_PHB_ENTRY p_pEntry; | |
172 //Aug 24, 2004 REF: CRR 22638 xrashmic | |
173 //Using the data stored in global variable to avoid corrupt data. | |
174 tMmiPhbData current =g_temp_current; | |
175 //tMmiPhbData current = data->phbk->current; | |
176 T_MFW_PHB_ENTRY *my = ¤t.entry[ current.selectedName - current.missedCallsOffset ]; | |
177 T_ATB_TEXT nameText; | |
178 T_ATB_TEXT numberText; | |
179 T_ATB_TEXT otherText; | |
180 char *TempBuffer = (char *)ALLOC_MEMORY(CALLDETAILS_INFO_LEN); | |
181 char *time; | |
182 char *date; | |
183 TRACE_FUNCTION( "bookCallDetails()" ); | |
184 | |
185 /* SPR#1428 - SH - New Editor changes | |
186 * Moved all this stuff here from the WinCb - it shouldn't be there! */ | |
187 | |
188 /* try to get the name from the phone book, null the structure out | |
189 if we can't find it at all | |
190 */ | |
191 | |
192 if ( bookFindNameInPhonebook( (const char *) my->number, &p_pEntry ) ) | |
193 { | |
194 bookCopyPhbName(my, &p_pEntry,PHB_MAX_LEN); | |
195 my->name.len = p_pEntry.name.len; | |
196 } | |
197 else | |
198 { | |
199 my->name.len = 0; | |
200 } | |
201 | |
202 numberText.dcs = ATB_DCS_ASCII; | |
203 numberText.data = my->number; | |
204 ATB_string_Length(&numberText); | |
205 | |
206 #ifdef EASY_TEXT_ENABLED | |
207 if ( my->name.data[0] ==0x80) | |
208 { | |
209 /* UNICODE */ | |
210 nameText.dcs = ATB_DCS_UNICODE; | |
211 nameText.data = &my->name.data[2]; | |
212 } | |
213 else | |
214 #endif /* EASY_TEXT_ENABLED */ | |
215 { | |
216 /* ASCII */ | |
217 nameText.dcs = ATB_DCS_ASCII; | |
218 nameText.data = my->name.data; | |
219 } | |
220 | |
221 ATB_string_Length(&nameText); | |
222 | |
223 ATB_edit_ResetMode(data->editor, ED_MODE_READONLY); /* Switch off read only to add text */ | |
224 ATB_edit_ClearAll(data->editor); /* Blank the editor */ | |
225 ATB_edit_InsertString(data->editor, &nameText); | |
226 ATB_edit_Char(data->editor, ctrlEnter, FALSE); | |
227 ATB_edit_InsertString(data->editor, &numberText); | |
228 ATB_edit_Char(data->editor, ctrlEnter, FALSE); | |
229 | |
230 if (CphsPresent() == TRUE) | |
231 { | |
232 sprintf(TempBuffer, "Line %d", my->line); | |
233 otherText.dcs = ATB_DCS_ASCII; | |
234 otherText.data = (UBYTE *)TempBuffer; | |
235 ATB_string_Length(&otherText); | |
236 ATB_edit_InsertString(data->editor, &otherText); | |
237 ATB_edit_Char(data->editor, ctrlEnter, FALSE); | |
238 } | |
239 | |
240 /* API - 10/09/03 - SPR2513 - Add support to display chinese Data & Time */ | |
241 /* API - 05/09/03 - SPR2357 - Get the character string for the date */ | |
242 | |
243 date = MmiRsrcGetText(TxtCallDate); | |
244 | |
245 if(Mmi_getCurrentLanguage() == CHINESE_LANGUAGE) | |
246 { | |
247 otherText.dcs = ATB_DCS_UNICODE; | |
248 otherText.data = (UBYTE *)date; | |
249 } | |
250 else | |
251 { | |
252 otherText.dcs = ATB_DCS_ASCII; | |
253 otherText.data = (UBYTE *)date; | |
254 } | |
255 ATB_string_Length(&otherText); | |
256 ATB_edit_InsertString(data->editor, &otherText); | |
257 | |
258 /* API - 05/09/03 - SPR2357 - END */ | |
259 /* API - 10/09/03 - SPR2513 - END */ | |
260 | |
261 // API - 21-01-03 - 1566 - Date and Time displayed for Recent calls | |
262 | |
263 // change by Sasken ( Rashmi C N) on March 31th 2004 | |
264 // Issue Number : MMI-SPR-12874 | |
265 // Bug: Wrong date and time in the Missed call details. | |
266 // Solution: converting the date and time into decimal format used in the | |
267 // phonebook management. | |
268 | |
269 sprintf((char*)TempBuffer, "%.2d/%.2d/%.2d",(UBYTE)((my->date.day[0])<<4)+(UBYTE) my->date.day[1], | |
270 (UBYTE) ((my->date.month[0])<<4)+(UBYTE) my->date.month[1], | |
271 (UBYTE) ((my->date.year[0])<<4)+(UBYTE) my->date.year[1]); | |
272 otherText.dcs = ATB_DCS_ASCII; | |
273 otherText.data = (UBYTE *)TempBuffer; | |
274 ATB_string_Length(&otherText); | |
275 ATB_edit_InsertString(data->editor, &otherText); | |
276 ATB_edit_Char(data->editor, ctrlEnter, FALSE); | |
277 | |
278 | |
279 | |
280 /* API - 10/09/03 - SPR2513 - Add support to display chinese Data & Time */ | |
281 /* API - 05/09/03 - SPR2357 - Get the character string for the Time */ | |
282 | |
283 time = MmiRsrcGetText(TxtCallTime); | |
284 | |
285 if(Mmi_getCurrentLanguage() == CHINESE_LANGUAGE) | |
286 { | |
287 otherText.dcs = ATB_DCS_UNICODE; | |
288 otherText.data = (UBYTE *)time; | |
289 } | |
290 else | |
291 { | |
292 otherText.dcs = ATB_DCS_ASCII; | |
293 otherText.data = (UBYTE *)time; | |
294 } | |
295 | |
296 ATB_edit_InsertString(data->editor, &otherText); | |
297 | |
298 /* API - 05/09/03 - SPR2357 - END */ | |
299 /* API - 10/09/03 - SPR2513 - END */ | |
300 | |
301 // API - 21-01-03 - 1566 - Date and Time displayed for Recent calls | |
302 | |
303 // change by Sasken ( Rashmi C N) on March 31th 2004 | |
304 // Issue Number : MMI-SPR-12874 | |
305 // Bug: Wrong date and time in the Missed call details. | |
306 // Solution: converting the date and time into decimal format used in the | |
307 // phonebook management. | |
308 sprintf((char*)TempBuffer, "%.2d:%.2d", (UBYTE) ((my->time.hour[0])<<4)+(UBYTE) my->time.hour[1], | |
309 (UBYTE) ((my->time.minute[0])<<4)+(UBYTE) my->time.minute[1]); | |
310 | |
311 otherText.dcs = ATB_DCS_ASCII; | |
312 otherText.data = (UBYTE *)TempBuffer; | |
313 ATB_string_Length(&otherText); | |
314 ATB_edit_InsertString(data->editor, &otherText); | |
315 | |
316 ATB_edit_SetMode(data->editor, ED_MODE_READONLY); /* Switch on read only again */ | |
317 | |
318 | |
319 FREE_MEMORY((void *)TempBuffer, CALLDETAILS_INFO_LEN); | |
320 | |
321 /* show the editor and update the soft keys | |
322 */ | |
323 /* SH - the string has changed, so we need to refresh the word-wrap */ | |
324 ATB_edit_Refresh(data->editor); | |
325 win_show(data->win); | |
326 | |
327 #else /* NEW_EDITOR */ | |
328 | |
329 if ( event == CALL_DETAILS_INIT ) | |
330 winShow( data->win ); | |
331 | |
332 #endif /* NEW_EDITOR */ | |
333 } | |
334 | |
335 | |
336 | |
337 | |
338 /******************************************************************************* | |
339 | |
340 $Function: bookCallDetailsWinCB | |
341 | |
342 $Description: Window call back function | |
343 | |
344 $Returns: MFW_EVENT_CONSUMED | |
345 | |
346 $Arguments: e, event to be handles, w, window handle | |
347 | |
348 *******************************************************************************/ | |
349 | |
350 static int bookCallDetailsWinCB( MfwEvt e, MfwWin *w ) | |
351 { | |
352 tBookStandard * data = (tBookStandard *)w->user; | |
353 // char *Time; // RAVI | |
354 // char *Date; // RAVI | |
355 | |
356 TRACE_FUNCTION("bookCallDetailsWinCB"); | |
357 switch( e ) | |
358 { | |
359 case MfwWinVisible: | |
360 { | |
361 /* SPR#1428 - SH - New Editor changes - Just show editor, calculate text | |
362 * string to display in bookCallDetails() */ | |
363 #ifdef NEW_EDITOR | |
364 ATB_edit_Show(data->editor); | |
365 resources_setTitleColour(COLOUR_EDITOR); | |
366 | |
367 /* TITLE */ | |
368 | |
369 dspl_Clear(0,0, SCREEN_SIZE_X-1, data->editor->attr->win_size.py-1); | |
370 PROMPT(0,0,0,TxtDetails); | |
371 #else /* NEW_EDITOR */ | |
372 char TempBuffer[32]; | |
373 T_MFW_PHB_ENTRY p_pEntry; | |
374 tMmiPhbData current = data->phbk->current; | |
375 T_MFW_PHB_ENTRY *my = ¤t.entry[ current.selectedName - current.missedCallsOffset ]; | |
376 | |
377 /* default screen update prior to painting below | |
378 */ | |
379 dspl_ClearAll(); | |
380 | |
381 /* try to get the name from the phone book, null the structure out | |
382 if we can't find it at all | |
383 */ | |
384 | |
385 #ifdef NO_ASCIIZ | |
386 { | |
387 UBYTE result; | |
388 | |
389 if ( bookFindNameInPhonebook( (const char *) my->number, &p_pEntry ) ) | |
390 { | |
391 | |
392 | |
393 //GW Copy name and length | |
394 bookCopyPhbName(my, &p_pEntry,PHB_MAX_LEN); | |
395 my->name.len = p_pEntry.name.len; | |
396 } | |
397 else | |
398 { | |
399 TRACE_EVENT(">>>>Length set to zero"); | |
400 my->name.len = 0; | |
401 } | |
402 | |
403 } | |
404 #else /* NO_ASCIIZ */ | |
405 | |
406 if ( bookFindNameInPhonebook( (const char *) my->number, &p_pEntry ) ) | |
407 bookCopyPhbName(my, &p_pEntry, NAME_SCREEN_MAX); //GW Copy name | |
408 else | |
409 memset( (char*) my->name, '\0', NAME_SCREEN_MAX ); | |
410 #endif /* NO_ASCIIZ */ | |
411 | |
412 memset((char*)TempBuffer ,'\0',32); | |
413 | |
414 | |
415 /* API - 1203 - 30/09/02 - Add the Data and the Time to the TempBuffer to be shown when the details of a | |
416 LDN, LMN etc is looked at. Currently commented out as the ACI does not store the | |
417 numbers at present and garbage would be displayed. | |
418 */ | |
419 | |
420 /* API - 1542 - 10/01/03 - Update from issue above Added the values written to the structure by ACI to | |
421 display them to the user. | |
422 */ | |
423 | |
424 /* API - 05/09/03 - SPR2357 - Get the character string for the date and time */ | |
425 Time = MmiRsrcGetText(TxtCallTime); | |
426 Date = MmiRsrcGetText(TxtCallDate); | |
427 | |
428 sprintf((char*)TempBuffer,"%s%d%d%s%d%d%s %s%d%d%s%d%d%s%d%d%s", | |
429 Time, (UBYTE) my->time.hour[0], (UBYTE) my->time.hour[1], ":", | |
430 (UBYTE) my->time.minute[0], (UBYTE) my->time.minute[1], "\n", | |
431 Date, (UBYTE) my->date.day[0], (UBYTE) my->date.day[1], "/", | |
432 (UBYTE) my->date.month[0], (UBYTE) my->date.month[1], "/", | |
433 (UBYTE) my->date.year[0], (UBYTE) my->date.year[1], "\n"); | |
434 /* API - 05/09/03 - SPR2357 - END */ | |
435 | |
436 | |
437 | |
438 #ifdef NO_ASCIIZ | |
439 #ifdef EASY_TEXT_ENABLED | |
440 /*MC SPR 1242, changed macros to function calls e.g FIRST_LINE_CHINESE->Mmi_layout_first_line()*/ | |
441 if (my->name.data[0] ==0x80)//if unicode | |
442 { //display name as unicode | |
443 dspl_TextOut(0,0, DSPL_TXTATTR_UNICODE, (char *)my->name.data); | |
444 if ((my->name.data[MAX_LINE+2] != 0) && (my->name.data[MAX_LINE+3] != 0)) | |
445 dspl_TextOut(0, Mmi_layout_first_line(), 0, (char *) &my->name.data[MAX_LINE+2]); | |
446 //display number | |
447 dspl_TextOut(0, Mmi_layout_second_line(), 0, (char *) my->number); | |
448 if (strlen((char *) my->number) > MAX_LINE) | |
449 /*MC end*/ dspl_TextOut(0, Mmi_layout_second_line() + 8, 0, (char *) &my->number[MAX_LINE]); | |
450 } | |
451 else | |
452 #endif /* EASY_TEXT_ENABLED */ | |
453 { | |
454 if (CphsPresent() == TRUE) | |
455 { | |
456 sprintf( (char *) data->edtBuf, "%s%s%s%s%d%s%s", | |
457 (char *) my->name.data, "\n", | |
458 (char *) my->number,"\n Line ", my->line,"\n", | |
459 TempBuffer ); | |
460 } | |
461 else | |
462 sprintf( (char *) data->edtBuf, "%s%s%s%s%s", | |
463 (char *) my->name.data, "\n", | |
464 (char *) my->number,"\n", | |
465 TempBuffer ); | |
466 | |
467 /* show the editor and update the soft keys | |
468 */ | |
469 edtShow( data->edt ); | |
470 } | |
471 | |
472 #else /* NO_ASCIIZ */ | |
473 if (CphsPresent() == TRUE) | |
474 { | |
475 sprintf( (char *) data->edtBuf, "%s%s%s%s%d%s%s", | |
476 (char *) my->name, "\n", | |
477 (char *) my->number,"\n Line ", my->line,"\n", | |
478 TempBuffer ); | |
479 } | |
480 else | |
481 sprintf( (char *) data->edtBuf, "%s%s%s%s%s", | |
482 (char *) my->name, "\n", | |
483 (char *) my->number,"\n", | |
484 TempBuffer ); | |
485 | |
486 /* show the editor and update the soft keys | |
487 */ | |
488 edtShow( data->edt ); | |
489 #endif /* NO_ASCIIZ */ | |
490 #endif /* NEW_EDITOR */ | |
491 | |
492 displaySoftKeys( TxtNull, TxtSoftBack ); | |
493 } | |
494 break; | |
495 | |
496 default: | |
497 { | |
498 /* default processing, we return IGNORED here and let the | |
499 default handler pick up the ball | |
500 */ | |
501 return MFW_EVENT_PASSED; | |
502 } | |
503 } | |
504 | |
505 return MFW_EVENT_CONSUMED; | |
506 } | |
507 | |
508 | |
509 | |
510 | |
511 /******************************************************************************* | |
512 | |
513 $Function: bookCallDetailsKeyCB | |
514 | |
515 $Description: normal keyboard handler | |
516 | |
517 $Returns: MFW_EVENT_CONSUMED in all cases | |
518 | |
519 $Arguments: e, event to be handled, k keyboard handle | |
520 | |
521 *******************************************************************************/ | |
522 | |
523 static int bookCallDetailsKeyCB( MfwEvt e, MfwKbd *k ) | |
524 { | |
525 T_MFW_HND win = mfwParent( mfw_header() ); | |
526 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; | |
527 tBookStandard *data = (tBookStandard *) win_data->user; | |
528 | |
529 /* make sure we handle null keyboards | |
530 */ | |
531 if ( k == NULL ) | |
532 return MFW_EVENT_CONSUMED; | |
533 | |
534 /* deal with the incoming key code | |
535 */ | |
536 switch( k->code ) | |
537 { | |
538 case KCD_MNUDOWN: | |
539 { | |
540 /* scroll down event | |
541 */ | |
542 | |
543 if ( data->phbk->current.selectedName == data->phbk->current.status.used_entries-1 ) | |
544 { | |
545 data->phbk->current.selectedName = 0; | |
546 } | |
547 else | |
548 data->phbk->current.selectedName++; | |
549 | |
550 } | |
551 break; | |
552 | |
553 case KCD_MNUUP: | |
554 { | |
555 /* scroll up event | |
556 */ | |
557 if ( data->phbk->current.selectedName == 0 ) | |
558 { | |
559 data->phbk->current.selectedName = data->phbk->current.status.used_entries-1; | |
560 } | |
561 else | |
562 data->phbk->current.selectedName--; | |
563 } | |
564 break; | |
565 | |
566 case KCD_CALL: | |
567 { | |
568 /* left, implies make call | |
569 */ | |
570 callNumber( data->phbk->current.entry[data->phbk->current.selectedName].number ); | |
571 bookPhonebookDestroy( data->phbk->win ); | |
572 } | |
573 break; | |
574 | |
575 case KCD_RIGHT: | |
576 { | |
577 bookCallDetailsDestroy(data->win); | |
578 } | |
579 break; | |
580 | |
581 case KCD_HUP: | |
582 { | |
583 /* clear, destroy the window | |
584 */ | |
585 bookCallDetailsDestroy( data->win ); | |
586 } | |
587 break; | |
588 | |
589 default: | |
590 { | |
591 /* no default behaviour required | |
592 */ | |
593 } | |
594 break; | |
595 } | |
596 | |
597 /* if we have scrolled then the behaviour needs to be to perform another | |
598 search to get the window updated correctly | |
599 */ | |
600 if ( ( k->code == KCD_MNUUP ) || ( k->code == KCD_MNUDOWN ) ) | |
601 { | |
602 SEND_EVENT(data->win, 0, 0, 0); | |
603 winShow( win ); | |
604 } | |
605 | |
606 /* and always return consumed | |
607 */ | |
608 return MFW_EVENT_CONSUMED; | |
609 } | |
610 | |
611 | |
612 | |
613 /******************************************************************************* | |
614 | |
615 $Function: bookCallDetailsKbdLongCB | |
616 | |
617 $Description: Keyboard Long Press event handler | |
618 | |
619 $Returns: MFW_EVENT_CONSUMED always | |
620 | |
621 $Arguments: e, event, k, keyboard handle | |
622 | |
623 *******************************************************************************/ | |
624 | |
625 static int bookCallDetailsKeyLongCB( MfwEvt e, MfwKbd *k ) | |
626 { | |
627 T_MFW_HND win = mfwParent( mfw_header() ); | |
628 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; | |
629 tBookStandard *data = (tBookStandard *) win_data->user; | |
630 | |
631 /* hand a long clear event only | |
632 */ | |
633 if ( ( e & KEY_CLEAR ) && ( e & KEY_LONG ) ) | |
634 bookCallDetailsDestroy( data->win ); | |
635 | |
636 return MFW_EVENT_CONSUMED; | |
637 } | |
638 | |
639 | |
640 | |
641 | |
642 /******************************************************************************* | |
643 | |
644 $Function: bookCallDetailsCreate | |
645 | |
646 $Description: Creates the window and associates editors and keyboards | |
647 with it. | |
648 | |
649 $Returns: handle of the newly created window, or NULL if failure | |
650 | |
651 $Arguments: parent, handle of parent window | |
652 | |
653 *******************************************************************************/ | |
654 | |
655 static T_MFW_HND bookCallDetailsCreate( MfwHnd parent ) | |
656 { | |
657 T_MFW_WIN *win_data; | |
658 tBookStandard *data = (tBookStandard *) ALLOC_MEMORY( sizeof( tBookStandard ) ); | |
659 T_MFW_WIN *parent_win_data = ((T_MFW_HDR *)parent)->data; | |
660 T_phbk *phbk = (T_phbk *)parent_win_data->user; | |
661 | |
662 TRACE_FUNCTION ("phbk_call_details_create()"); | |
663 | |
664 /* Deal with allocation failure on the data block | |
665 */ | |
666 if ( ! data ) | |
667 return NULL; | |
668 | |
669 /* create the window | |
670 */ | |
671 if ( ( data->win = win_create( parent, 0, E_WIN_VISIBLE, (T_MFW_CB) bookCallDetailsWinCB ) ) == NULL ) | |
672 return NULL; | |
673 | |
674 /* Associate the dialog and user data areas | |
675 */ | |
676 data->mmi_control.dialog = (T_DIALOG_FUNC) bookCallDetails; | |
677 data->mmi_control.data = data; | |
678 win_data = ((T_MFW_HDR *)data->win)->data; | |
679 win_data->user = (void *) data; | |
680 data->parent_win = parent; | |
681 | |
682 /* Create the keyboards and editor objects, and associate a phone book handler | |
683 */ | |
684 data->kbd = kbdCreate( data->win, KEY_ALL, (MfwCb) bookCallDetailsKeyCB ); | |
685 data->kbd_long = kbdCreate( data->win, KEY_ALL | KEY_LONG, (MfwCb) bookCallDetailsKeyLongCB ); | |
686 | |
687 /* 1945 MZ Initialise the edtBuf */ | |
688 memset(data->edtBuf,'\0', STANDARD_EDITOR_SIZE ); | |
689 | |
690 /* SPR#1428 - SH - New Editor changes */ | |
691 #ifdef NEW_EDITOR | |
692 AUI_edit_SetAttr( &data->editor_attr, PHB_EDITOR, COLOUR_EDITOR_XX, EDITOR_FONT, | |
693 ED_MODE_READONLY, ED_CURSOR_NONE, ATB_DCS_UNICODE/*SPR2102*/, (UBYTE*) data->edtBuf, STANDARD_EDITOR_SIZE); | |
694 data->editor = ATB_edit_Create(&data->editor_attr,0); | |
695 SEND_EVENT(data->win, 0, 0, 0); | |
696 ATB_edit_Init(data->editor); | |
697 #else/*NEW_EDITOR*/ | |
698 bookSetEditAttributes( PHB_EDITOR, COLOUR_EDITOR_XX , 0, edtCurBar1, 0, | |
699 (char*) data->edtBuf, STANDARD_EDITOR_SIZE, &data->attr ); | |
700 data->edt = edtCreate( data->win, &data->attr, 0, 0 ); | |
701 #endif /*NEW_EDITOR*/ | |
702 | |
703 data->phbk = phbk; | |
704 | |
705 /* return the handle to the newly created window | |
706 */ | |
707 return data->win; | |
708 } | |
709 | |
710 | |
711 /******************************************************************************* | |
712 | |
713 Public methods | |
714 | |
715 *******************************************************************************/ | |
716 | |
717 | |
718 | |
719 /******************************************************************************* | |
720 | |
721 $Function: bookCallDetailsStart | |
722 | |
723 $Description: entry point for the call details window | |
724 | |
725 $Returns: handle of newly created window, or NULL | |
726 | |
727 $Arguments: parent, handle of the parent window | |
728 | |
729 *******************************************************************************/ | |
730 | |
731 T_MFW_HND bookCallDetailsStart( MfwHnd parent ) | |
732 { | |
733 T_MFW_HND win; | |
734 | |
735 TRACE_FUNCTION( "bookCallDetailsStart()" ); | |
736 | |
737 /* create and initialise the window | |
738 */ | |
739 if ( ( win = bookCallDetailsCreate( parent ) ) != NULL ) | |
740 SEND_EVENT( win, CALL_DETAILS_INIT, 0, 0 ); | |
741 | |
742 /* return the handle, or NULL if it failed to be created correctly | |
743 */ | |
744 return win; | |
745 } | |
746 | |
747 | |
748 | |
749 /******************************************************************************* | |
750 | |
751 $Function: bookCallDetailsDestroy | |
752 | |
753 $Description: destroys the call details window | |
754 | |
755 $Returns: None. | |
756 | |
757 $Arguments: window, hande of the window to be destroyed | |
758 | |
759 *******************************************************************************/ | |
760 | |
761 void bookCallDetailsDestroy( MfwHnd window ) | |
762 { | |
763 T_MFW_WIN *win = ((T_MFW_HDR *)window)->data; | |
764 tBookStandard *data = (tBookStandard *)win->user; | |
765 | |
766 TRACE_FUNCTION ("bookCallDetailsDestroy()"); | |
767 | |
768 if ( data ) | |
769 { | |
770 /* SPR#1428 - SH - New Editor changes */ | |
771 #ifdef NEW_EDITOR | |
772 /* New editor isn't automatically destroyed with winDelete, | |
773 * so we destroy it here */ | |
774 if (data->editor) | |
775 { | |
776 ATB_edit_Destroy(data->editor); | |
777 } | |
778 #endif | |
779 winDelete( data->win ); | |
780 FREE_MEMORY( (unsigned char *) data, sizeof( tBookStandard ) ); | |
781 } | |
782 } | |
783 | |
784 | |
785 | |
786 | |
787 | |
788 | |
789 /******************************************************************************* | |
790 | |
791 End of File | |
792 | |
793 *******************************************************************************/ |