comparison g23m/condat/ms/src/bmi/MmiBookUtils.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: MmiBookUtils.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 utility function for use in the
26 phone book application
27
28 ********************************************************************************
29
30 $History: MmiBookUtils.c
31
32 Feb 20, 2006 REF: OMAPS00061948 x0039928
33 Bug:PhoneBook-My number menu -failed.
34 Fix: phb_read_entries is called with used entries as the no of entries if used entries are less than
35 MAX_SEARCH_NAME.
36
37 Jan 27, 2006 REF: OMAPS00061925 x0039928
38 Bug:Phonebook-Changing an entry and Immidiately deleting the entry failed.
39 Fix: Phonebook is populated with phone numbers after some time and not immediately after deleting an entry.
40
41 Jan 22, 2006 REF: OMAPS00061930 x0039928
42 Bug:PhoneBook -Change entry and view entry through Change option-failed
43 Fix: Phonebook is populated with phone numbers after some time and not immediately while saving the changed entries.
44
45 25/10/00 Original Condat(UK) BMI version.
46
47 $End
48
49 // Issue Number : SPR#15671 on 24/03/04 by Ajith K.P
50
51 *******************************************************************************/
52
53
54
55 /*******************************************************************************
56
57 Include Files
58
59 *******************************************************************************/
60 #define ENTITY_MFW
61
62 /* includes */
63 #include <string.h>
64 #include <stdio.h>
65 #include <stdlib.h>
66
67 #if defined (NEW_FRAME)
68
69 #include "typedefs.h"
70 #include "vsi.h"
71 #include "pei.h"
72 #include "custom.h"
73 #include "gsm.h"
74
75 #else
76
77 #include "STDDEFS.H"
78 #include "custom.h"
79 #include "gsm.h"
80 #include "vsi.h"
81
82 #endif
83
84 #include "mfw_sys.h"
85
86 #include "mfw_mfw.h"
87 #include "mfw_win.h"
88 #include "mfw_kbd.h"
89 #include "mfw_lng.h"
90 /* SPR#1428 - SH - New Editor changes */
91 #ifndef NEW_EDITOR
92 #include "mfw_edt.h"
93 #endif
94 #include "mfw_icn.h"
95 #include "mfw_mnu.h"
96 #include "mfw_tim.h"
97
98 #include "mfw_sim.h"
99 #include "mfw_cm.h"
100 #include "mfw_nm.h"
101 #include "mfw_phb.h"
102 #include "mfw_mme.h"
103 #include "mfw_sat.h"
104 #include "mfw_sms.h"
105
106 #include "dspl.h"
107
108 #include "ksd.h"
109 #include "psa.h"
110
111 #include "MmiMain.h"
112 #include "MmiBookController.h"
113 #include "MmiDummy.h"
114 #include "MmiDialogs.h"
115 #include "MmiLists.h"
116
117
118
119 #include "MmiMenu.h"
120 #include "mmiCall.h"
121 #include "Mmiicons.h"
122 #include "MmiIdle.h"
123
124 #include "MmiSoftKeys.h"
125 #include "MmiSounds.h"
126 #include "MmiIdle.h"
127 #include "MmiNetwork.h"
128 #include "mmiSat_i.h"
129 #include "MmiAoc.h"
130
131 #include "gdi.h"
132 #include "audio.h"
133
134 #include "cus_aci.h"
135 #include "mfw_ffs.h"
136 #include "MmiTimers.h"
137
138 #include "MmiBookShared.h"
139
140 #include "mmiColours.h"
141 #include "mmiSmsRead.h"/*MC , SPR 1242 */
142
143
144 // May 24, 2004 REF: CRR MMI-SPR-15813 Ajith K P
145 // Issue description: Followup from 15623, this is the BMI part of this Issue.
146 // At last, in the record "SSC09" the number is displayed with the "+"
147 // character at the beginning of the number instead of "**21*+014543877989#".
148
149
150 extern int menuFDN;
151 extern T_call call_data;
152 // Jan 27, 2006 REF: OMAPS00061925 x0039928
153 // Fix : Declare a extern phonebook timer handler
154 extern T_MFW_HND PhbSearchTim;
155
156 /*******************************************************************************
157
158 Private data elements
159
160 *******************************************************************************/
161
162 static T_MFW_UPN_LIST *upnList = NULL;
163
164 /* SPR#1112 - SH - This is redundant */
165 //static T_phbk *GlobalPhoneBookHandle = NULL;
166
167 /* SPR#1112 - SH - Internal phonebook flag */
168 #ifdef INT_PHONEBOOK
169 static UBYTE ipbCopyIndex = 0;
170 static UBYTE ipbMove = FALSE;
171 static T_MFW_HND ipbWin = NULL;
172 #endif
173
174 // ADDED BY RAVI - 28-11-2005
175 EXTERN T_MFW mfw_Ucs2SIMStr(T_MFW_DCS outMode, U16 *inUcsStr, UBYTE maxOutSize,
176 UBYTE *outMfwStr, UBYTE *outLen);
177
178 EXTERN T_MFW mfw_Gsm2SIMStr(T_MFW_DCS outMode, UBYTE *inGsmStr, UBYTE maxOutSize,
179 UBYTE *outMfwStr,UBYTE *outLen);
180 // END RAVI - 28-11-2005
181 /*******************************************************************************
182
183 Private Methods
184
185 *******************************************************************************/
186
187 /*******************************************************************************
188
189 $Function: changeName
190
191 $Description: Change a phone book entry if we have a valid book selected
192
193 $Returns: status of change, or MWB_PHB_FAIL if an error occurs
194
195 $Arguments: book, to be updated
196 entry, to update
197 currentStatus, pointer to status word
198
199 *******************************************************************************/
200
201 static UBYTE changeName( UBYTE book, T_MFW_PHB_ENTRY *entry, T_MFW_PHB_STATUS *currentStatus )
202 {
203 TRACE_FUNCTION( "changeName()" );
204
205 if ( book == PHB_SDN )
206 return MFW_PHB_FAIL;
207
208 return phb_store_entry( book, entry, currentStatus );
209 }
210
211
212
213
214
215
216
217 /*******************************************************************************
218
219 $Function: deleteName
220
221 $Description: Delete a phone book entry
222
223 $Returns: status of delete, or MWB_PHB_FAIL if an error occurs
224
225 $Arguments: book, to be updated
226 index, index of entry to delete
227 currentStatus, pointer to status word
228
229 *******************************************************************************/
230
231 static UBYTE deleteName( UBYTE book, UBYTE index, T_MFW_PHB_STATUS *currentStatus )
232 {
233 TRACE_FUNCTION( "deleteName()" );
234
235 if ( book == PHB_SDN )
236 return MFW_PHB_FAIL;
237
238 return phb_delete_entry( book, index, currentStatus );
239 }
240
241
242
243
244
245
246
247
248
249
250 /*******************************************************************************
251
252 $Function: addName
253
254 $Description: Add a new name to the phone book
255
256 $Returns: status of change, or MWB_PHB_FAIL if an error occurs
257
258 $Arguments: book, to be updated
259 entry, to update
260 currentStatus, pointer to status word
261
262 *******************************************************************************/
263
264 static UBYTE addName( UBYTE book, T_MFW_PHB_ENTRY *entry, T_MFW_PHB_STATUS *currentStatus )
265 {
266 TRACE_FUNCTION( "addName()" );
267
268 //MC-- Commented out UPN-specific code as it causes the name string in a UPN
269 //entry to be stored incorrectly and doesn't seem to be neccessary.
270 //Generic code here seems to work fine for UPN
271 {
272 /* normal store operation
273 */
274 {
275 char temp[120];
276 memset(temp,'\0',100);
277 #ifdef NO_ASCIIZ
278 {
279 T_MFW_PHB_TEXT buf;
280
281 /*SPR 1752 check for unicode*/
282 if (entry->name.data[0] ==0x80)
283 {
284 /*MC, don't do any conversions!!*/
285 TRACE_EVENT("Converting Unicode 2 SIM");
286
287 sprintf(temp,"Book: %d Name %s Number %s",
288 book,
289 (char*)buf.data,(char*)entry->number);
290
291 }
292 else
293
294 {
295 // convert from GSM to Alpha characters
296 bookGsm2Alpha( (UBYTE *) entry->name.data );
297
298 sprintf(temp,"Book: %d Name %s Number %s",
299 book,
300 (char*)entry->name.data,(char*)entry->number);
301 }
302 }
303 #else
304 sprintf(temp,"Book: %d Name %s Number %s",
305 book,
306 (char*)entry->name,(char*)entry->number);
307 #endif
308 TRACE_EVENT(temp);
309 }
310 entry->index = 0;
311 return phb_store_entry( book, entry, currentStatus );
312 }
313 }
314
315
316
317
318
319
320
321
322 /*******************************************************************************
323
324 File Handling Utilities
325
326 *******************************************************************************/
327
328 /*******************************************************************************
329
330 $Function: storeInFile
331
332 $Description: Converts the name to a storeable format and stores it
333 in the phone book
334
335 $Returns: None
336
337 $Arguments: phbk, pointer to phonebook structure
338
339 *******************************************************************************/
340
341 void storeInFile( T_phbk *phbk )
342 { int i;
343 UBYTE actual_length = 0;
344 char debug[20];
345 TRACE_FUNCTION( "storeInFile()" );
346
347 /* Convert the name
348 */
349 #ifdef NO_ASCIIZ
350
351 /* if the pattern is GSM default format, use the function mfw_Gsm2SIMStr() here
352 */
353
354
355 if (phbk->edt_buf_name[0] == 0x80)//if unicode
356 {
357 for (i =0; i < PHB_MAX_LEN; i+=2) //work out string length
358 { if (phbk->edt_buf_name[i] == 0 && phbk->edt_buf_name[i+1] == 0)
359 { if (i== 0)
360 actual_length =0;
361 else
362 actual_length = i -2;
363 break;
364 }
365 }
366 phbk->edt_buf_name[0] = (UBYTE)(actual_length/2);//add string length to beginning of string
367 phbk->edt_buf_name[1] = 0x00;
368 /*MC SPR 1257, replacing PHB_MAX_LEN with MAX_ALPHA_LEN*/
369 memset(phbk->newEntry.name.data, 0,MAX_ALPHA_LEN);
370 //convert to SIM string
371
372 mfw_Ucs2SIMStr( MFW_DCS_UCS2 , (U16*)phbk->edt_buf_name, MAX_ALPHA_LEN,
373
374 phbk->newEntry.name.data, &phbk->newEntry.name.len );
375 TRACE_EVENT( (char*)phbk->newEntry.name.data);
376 sprintf(debug, "length:%d", phbk->newEntry.name.len);
377 TRACE_EVENT(debug);
378 }
379 else
380 {
381 mfw_Gsm2SIMStr( MFW_DCS_7bits, (U8*)phbk->edt_buf_name, MAX_ALPHA_LEN,
382 phbk->newEntry.name.data, &phbk->newEntry.name.len );
383 }
384
385 #else
386 /*MC SPR 1257, replacing PHB_MAX_LEN with MAX_ALPHA_LEN*/
387 strncpy( (char *)phbk->newEntry.name, (char *)phbk->edt_buf_name, MAX_ALPHA_LEN );
388
389 #endif
390
391 /* update the number
392 */
393 strncpy( (char *) phbk->newEntry.number, (char *) phbk->edt_buf_number, PHB_MAX_LEN );
394 /*SPR 1327, copy current phonebook type to new entry*/
395 phbk->newEntry.book = phbk->current.status.book;
396 /*If current phonebook UPN, don't overwrite phonebook type*/
397 // Feb 20, 2006 REF: OMAPS00061948 x0039928
398 // Fix : A check is made with enum PHB_UPN of MFW instead of UPN of ACI
399 if( phbk->newEntry.book != PHB_UPN)
400 phbk->newEntry.book = bookActiveBook(WRITE);
401 phbk->newEntry.index = 0;
402
403 /* Add the name/number combination to the phone book and setup
404 the current text status string
405 */
406 switch ( addName( phbk->newEntry.book, &phbk->newEntry, &phbk->current.status ) )
407 {
408 case MFW_PHB_OK :
409 {
410 /* Entry saved okay
411 */
412 MmiBookSetCurrentText( TxtSaved );
413 }
414 break;
415
416 case MFW_PHB_FULL :
417 {
418 /* Phone book full
419 */
420 MmiBookSetCurrentText( TxtPhbkFull );
421 }
422 break;
423
424 case MFW_PHB_FAIL :
425 {
426 /* Write failure
427 */
428 MmiBookSetCurrentText( TxtWriteError );
429 }
430 break;
431
432 default:
433 {
434 /* No other returns possible
435 */
436 }
437 break;
438 }
439 }
440
441
442
443
444
445
446
447 /*******************************************************************************
448
449 $Function: changeInFile
450
451 $Description: change the phone book entry
452
453 $Returns: none
454
455 $Arguments: phbk, pointer to phonebook structure
456
457 *******************************************************************************/
458
459 void changeInFile( T_phbk *phbk )
460 { int i;
461 int actual_length;
462 TRACE_FUNCTION( "changeInFile()" );
463
464 if(phbk->current.status.book == PHB_ADN_FDN)
465 phbk->current.status.book = PHB_ADN; //JVJE We can only store in ADN/FDN
466 else
467 phbk->current.status.book = phbk->current.status.book;
468
469 TRACE_EVENT_P1("Current Book = %d", phbk->current.status.book);
470 TRACE_EVENT_P1("Current Name = %s", phbk->current.selectedName);
471 TRACE_EVENT_P1("Current Buf Name = %s", phbk->edt_buf_name);
472
473
474 /* Convert the name
475 */
476 #ifdef NO_ASCIIZ
477 /*MC SPR 1257, replacing PHB_MAX_LEN with MAX_ALPHA_LEN for name strings*/
478 if (phbk->edt_buf_name[0] == 0x80)//if unicode
479 {
480 for (i =0; i < MAX_ALPHA_LEN; i+=2) //work out string length
481 { if (phbk->edt_buf_name[i] == 0 && phbk->edt_buf_name[i+1] == 0)
482 { if (i== 0)
483 actual_length =0;
484 else
485 actual_length = i -2;
486 break;
487 }
488 }
489 phbk->edt_buf_name[0] = (UBYTE)(actual_length/2);//add string length to beginning of string
490 phbk->edt_buf_name[1] = 0x00;
491
492 memset(phbk->current.entry[phbk->current.selectedName].name.data, 0, MAX_ALPHA_LEN);
493 //convert to SIM string
494 mfw_Ucs2SIMStr( MFW_DCS_UCS2, (U16*)phbk->edt_buf_name, MAX_ALPHA_LEN,
495 phbk->current.entry[phbk->current.selectedName].name.data,
496 &phbk->current.entry[phbk->current.selectedName].name.len );
497 }
498 else
499 { mfw_Gsm2SIMStr( MFW_DCS_7bits, (U8*)phbk->edt_buf_name, MAX_ALPHA_LEN,
500 phbk->current.entry[phbk->current.selectedName].name.data, &phbk->current.entry[phbk->current.selectedName].name.len );
501 }
502 #else
503
504 strncpy( (char *) phbk->current.entry[ phbk->current.selectedName ].name,
505 (char *) phbk->edt_buf_name, MAX_ALPHA_LEN );
506
507 #endif
508
509
510 /* update the number
511 */
512 strncpy( (char *) phbk->current.entry[ phbk->current.selectedName ].number,
513 (char *) phbk->edt_buf_number, PHB_MAX_LEN );
514
515 /* Add the name/number combination to the phone book and setup
516 the current text status string
517 */
518 switch ( changeName( phbk->current.status.book,
519 &phbk->current.entry[ phbk->current.selectedName ], &phbk->current.status ) )
520 {
521 case MFW_PHB_OK :
522 {
523 /* Entry saved okay
524 */
525 MmiBookSetCurrentText( TxtSaved );
526 }
527 break;
528
529 case MFW_PHB_FAIL :
530 {
531 /* Write failure
532 */
533 MmiBookSetCurrentText( TxtWriteError );
534 }
535 break;
536
537 default:
538 {
539 /* No other returns possible
540 */
541 }
542 break;
543 }
544 }
545
546
547
548
549
550
551
552
553
554 /*******************************************************************************
555
556 $Function: deleteFromFile
557
558 $Description: delete an entry from a phone book
559
560 $Returns: None
561
562 $Arguments: phbk, phone book handle,
563 book, book to update,
564
565 *******************************************************************************/
566
567 void deleteFromFile( T_phbk *phbk, UBYTE book )
568 {
569 int index;
570 TRACE_FUNCTION( "deleteFromFile()" );
571
572 index = phbk->current.selectedName - phbk->current.missedCallsOffset;
573 switch ( deleteName( book,
574 phbk->current.entry[index].index, &phbk->current.status ) )
575 {
576 case MFW_PHB_OK :
577 {
578 /* Entry saved okay
579 */
580 MmiBookSetCurrentText( TxtEntryDeleted );
581
582 #ifdef NO_ASCIIZ
583 phbk->current.entry[index].name.len = 0;
584 memset((char*)phbk->current.entry[index].number, '\0', PHB_MAX_LEN);
585
586 #else
587 /*MC SPR 1257, replacing PHB_MAX_LEN with MAX_ALPHA_LEN for name strings*/
588 memset((char*)phbk->current.entry[index].name, '\0', MAX_ALPHA_LEN);
589 memset((char*)phbk->current.entry[index].number, '\0', PHB_MAX_LEN);
590 #endif
591 /* Move the current index to the next valid entry
592 */
593 if(phbk->current.selectedName > 0)
594 phbk->current.selectedName --;
595 else
596 phbk->current.selectedName = 0;
597
598 if(phbk->current.index > 1)
599 phbk->current.index--;
600 else
601 phbk->current.index = 1;
602
603 /* And if we have a search window, perform the search to
604 update the current valid entry
605 */
606 if ( phbk->search_win )
607 {
608 bookGetCurrentStatus( &phbk->current.status );
609 if ( ! phbk->current.status.used_entries )
610 {
611 /* empty phone book
612 */
613 bookSearchDestroy( phbk->search_win );
614 phbk->search_win = 0;
615 }
616 else
617 {
618 /* perform the search
619 */
620 //Jan 27, 2006 REF: OMAPS00061925 x0039928
621 // Fix : Start the phonebook timer for populating the list
622 timStart(PhbSearchTim);
623 }
624 }
625 }
626 break;
627
628 case MFW_PHB_FAIL :
629 {
630 /* Write failure
631 */
632 MmiBookSetCurrentText( TxtWriteError );
633 }
634 break;
635
636 default:
637 {
638 /* No other action required
639 */
640 }
641 break;
642 }
643 }
644
645
646 /* SPR#1112 - SH - Internal phonebook use */
647 #ifdef INT_PHONEBOOK
648
649 /*******************************************************************************
650
651 $Function: bookChangePB
652
653 $Description: Change the phonebook
654
655 $Returns: None
656
657 $Arguments: None.
658
659 *******************************************************************************/
660
661 void bookChangePB(T_MFW_HND win, UBYTE identifier, UBYTE reason)
662 {
663 T_MFW_WIN *win_data = ( (T_MFW_HDR *) win )->data;
664 T_phbk *Phbk = (T_phbk *) win_data->user;
665
666 GI_pb_SetPhonebook(identifier);
667 bookShowInfoScreen( Phbk->win, TxtPhonebook, TxtChanged, NULL, NULL, 3000);
668 return;
669 }
670
671
672 /*******************************************************************************
673
674 $Function: bookCopy
675
676 $Description: Copy or move a phonebook entry from one book to another
677
678 $Returns: status of change, or MWB_PHB_FAIL if an error occurs
679
680 $Arguments: entry - the entry to be moved or copied
681 srcStatus - Status information about the source phonebook
682 destStatus - Status information about the destination phonebook
683 move - TRUE if the original record is to be deleted
684
685 *******************************************************************************/
686
687 UBYTE bookCopy( T_MFW_PHB_ENTRY *entry, T_MFW_PHB_STATUS *destStatus, T_MFW_PHB_STATUS *srcStatus, UBYTE move )
688 {
689 T_MFW ret;
690 UBYTE srcIndex;
691 UBYTE srcBook;
692
693 TRACE_FUNCTION("bookCopy");
694
695 if (!destStatus->avail_entries)
696 {
697 /* There's no room in the destination phonebook to add the entry */
698 TRACE_EVENT("bookCopy: dest phonebook full");
699 return MFW_PHB_FULL;
700 }
701
702 srcIndex = entry->index;
703 entry->index = 0;
704
705 if (entry->name.len>destStatus->tag_len)
706 {
707 TRACE_EVENT("bookCopy: Alpha tag cropped");
708 entry->name.len = destStatus->tag_len;
709 entry->name.data[entry->name.len] = NULL;
710 }
711
712 ret = phb_store_entry( destStatus->book, entry, destStatus );
713 TRACE_EVENT_P2("bookCopy: phb_store_entry book %d result %d", destStatus->book, ret);
714
715 if (ret!=MFW_PHB_OK)
716 return ret;
717
718 /* Only try to delete the entry if we are moving an entry from one book
719 * to another. Don't try if it is an FDN entry */
720
721 TRACE_EVENT_P2("move %d, entry->book %d", move, entry->book);
722
723 if (move && entry->book!=PHB_FDN)
724 {
725 if (( srcStatus->book == PHB_UPN) || (srcStatus->book == PHB_FDN ))
726 srcBook = srcStatus->book;
727 else
728 srcBook = bookActiveBook(WRITE);
729
730 ret = phb_delete_entry(srcBook, srcIndex, srcStatus);
731 TRACE_EVENT_P3("bookCopy: phb_delete_entry book %d index %d result %d", srcStatus->book, srcIndex, ret);
732 }
733
734 TRACE_EVENT("bookCopy: leaving function");
735
736 return ret;
737 }
738
739
740 /*******************************************************************************
741
742 $Function: bookCopySingle
743
744 $Description: Copy or move a single phonebook entry
745
746 $Returns: None
747
748 $Arguments: None.
749
750 *******************************************************************************/
751
752 void bookCopySingle(T_MFW_HND win, UBYTE identifier, UBYTE reason)
753 {
754 T_MFW_WIN *win_data = ( (T_MFW_HDR *) win )->data;
755 T_phbk *Phbk = (T_phbk *) win_data->user;
756 BOOL oldBook;
757 int txtId;
758 T_MFW_PHB_STATUS destStatus;
759 tMmiPhbData *current = &Phbk->phbk->current;
760
761 TRACE_FUNCTION("bookCopySingle");
762
763 oldBook = bookGetBookSelected();
764 // May 3, 2004 REF: CRR MMI-SPR-18555 Rashmi C N(Sasken)
765 // While doing a copy from the FDN menu the destination should always be internal phonebook
766
767 if(menuFDN && (call_data.calls.numCalls==0))
768 {
769 destStatus.book = PHB_IPB;
770 }
771 else
772 {
773 bookSetBookSelected(!oldBook);
774 destStatus.book = bookActiveBook(WRITE);
775 }
776 bookGetCurrentStatus( &destStatus );
777
778 bookSetBookSelected(oldBook);
779 txtId = TxtStored;
780
781 if (destStatus.avail_entries)
782 {
783 switch (bookCopy(&current->entry[current->selectedName], &destStatus, &current->status, identifier))
784 {
785 case MFW_PHB_OK:
786 txtId = TxtStored;
787 break;
788 case MFW_PHB_FULL:
789 txtId = TxtPhbkFull;
790 break;
791 default:
792 txtId = TxtFailed;
793 break;
794 }
795 }
796 else
797 {
798 txtId = TxtPhbkFull;
799 }
800
801 bookShowInformation( win, txtId, NULL, NULL );
802
803 if (identifier)
804 {
805 /* Destroy options menu and regenerate address list */
806
807 bookMenuDestroy(Phbk->menu_options_win);
808 if(Phbk->current.status.used_entries > 0)
809 SEND_EVENT(Phbk->search_win, SEARCH_SCROLL_UP, 0, 0 );
810 SEND_EVENT(Phbk->search_win, SEARCH_UPDATE, 0, (void*)Phbk->current.status.book );
811 }
812
813 return;
814 }
815
816
817 /*******************************************************************************
818
819 $Function: bookCopyMultiple
820
821 $Description: Copy or move multiple phonebook entries
822
823 $Returns: None
824
825 $Arguments: None.
826
827 *******************************************************************************/
828
829 void bookCopyMultiple(T_MFW_HND win, UBYTE move, UBYTE reason)
830 {
831 T_MFW_WIN *win_data = ( (T_MFW_HDR *) win )->data;
832 T_phbk *Phbk = (T_phbk *) win_data->user;
833 UBYTE oldBook;
834 T_MFW_PHB_STATUS destStatus;
835 T_MFW_PHB_STATUS srcStatus;
836 T_MFW_PHB_LIST entries;
837 T_MFW_PHB_ENTRY entry;
838 UBYTE readIndex;
839 int txtId;
840 // T_MFW_HND info_win; // RAVI
841 static T_MFW_HND waitWin = NULL;
842 /* Set up some data */
843
844 TRACE_FUNCTION("bookCopyMultiple");
845
846 entries.entry = &entry;
847
848 srcStatus.book = bookActiveBook(WRITE);
849 bookGetCurrentStatus( &srcStatus );
850
851 oldBook = bookGetBookSelected();
852 bookSetBookSelected(!oldBook);
853
854 destStatus.book = bookActiveBook(WRITE);
855 bookGetCurrentStatus( &destStatus );
856
857 bookSetBookSelected(oldBook);
858
859 /* First time entering function, set up values.
860 * Store information so this function can be called again
861 * when the phonebook is ready */
862
863 if (ipbCopyIndex==0)
864 {
865 ipbCopyIndex = srcStatus.used_entries;
866 ipbWin = win;
867 ipbMove = move;
868
869 if (!bookGetBookSelected() && !move)
870 {
871 /* We need to drop out of this function briefly in order to get the dialog to display
872 * for this particular case! Show info screen very briefly, which calls this function as
873 * a callback. The info screen remains until we drop out of this function a second
874 * time */
875 waitWin = NULL;
876 bookShowInfoScreen( Phbk->win, TxtPleaseWait, NULL, (T_VOID_FUNC)bookCopyMultiple, NULL, 100);
877 return;
878 }
879 waitWin = bookShowInfoScreen( Phbk->win, TxtPleaseWait, NULL, NULL, NULL, FOREVER);
880 }
881
882 TRACE_EVENT_P1("Entries in list: %d", srcStatus.used_entries);
883
884 /* For special case where SIM will give no E_PHB_READY response, the
885 * do...while operates as a loop below. Otherwise, it will only go through
886 * once, and this function will be called repeatedly every E_PHB_READY */
887
888 do
889 {
890 txtId = TxtStored;
891
892 if (!destStatus.avail_entries)
893 {
894 txtId = TxtPhbkFull;
895 }
896 else if (ipbCopyIndex==0)
897 {
898 txtId = TxtEmpty;
899 }
900 else
901 {
902 /* For moving, always delete first entry alphabetically, list moves down.
903 * For copying, move through the list */
904
905 if (move)
906 readIndex = 1;
907 else
908 readIndex = ipbCopyIndex;
909
910 TRACE_EVENT_P1("Moving entry %d", readIndex);
911
912 /* Read in entry and copy/move it */
913
914 phb_read_entries(srcStatus.book, readIndex, MFW_PHB_ALPHA, 1, &entries);
915
916 switch (bookCopy(entries.entry, &destStatus, &srcStatus, move))
917 {
918 case MFW_PHB_OK:
919 txtId = TxtStored;
920 break;
921 case MFW_PHB_FULL:
922 txtId = TxtPhbkFull;
923 break;
924 default:
925 txtId = TxtFailed;
926 break;
927 }
928
929 ipbCopyIndex--;
930 }
931 }/* Is a loop in special case - see above */
932 while (!bookGetBookSelected() && !move && txtId==TxtStored && ipbCopyIndex>0);
933
934 /* If we've finished, or an error has occurred, show info dialog */
935
936 if (ipbCopyIndex==0 || txtId!=TxtStored)
937 {
938 ipbCopyIndex = 0;
939
940 /* Destroy the Please Wait window and show the result message */
941
942 bookShowInformation( win, txtId, NULL, NULL );
943 if (waitWin)
944 {
945 SEND_EVENT(waitWin, DIALOG_DESTROY,0,0);
946 }
947
948 if (move)
949 {
950 /* Destroy options menu and regenerate address list */
951
952 bookMenuDestroy(Phbk->menu_options_win);
953 bookGetCurrentStatus( &Phbk->current.status );
954 if(Phbk->current.status.used_entries > 0)
955 {
956 SEND_EVENT(Phbk->search_win, SEARCH_SCROLL_UP, 0, 0 );
957 SEND_EVENT(Phbk->search_win, SEARCH_UPDATE, 0, (void*)Phbk->current.status.book );
958 }
959 else
960 bookSearchDestroy(Phbk->search_win);
961 }
962 }
963
964 return;
965 }
966 #endif
967
968
969
970 /*******************************************************************************
971
972 Public Methods
973
974 *******************************************************************************/
975
976
977
978
979 /*******************************************************************************
980
981 $Function: bookCurrentWindow
982
983 $Description:
984
985 This returns the window handle associated with the current
986 MFW element
987
988 $Returns: window handle of current MFW item
989
990 $Arguments: none.
991
992 *******************************************************************************/
993
994 tBookMfwHnd bookCurrentWindow( void )
995 {
996 return mfwParent( mfwHeader() );
997 }
998
999
1000
1001
1002
1003
1004
1005 /*******************************************************************************
1006
1007 $Function: bookDefaultCallBack
1008
1009 $Description:
1010
1011 This is a simple call back function which is invoked when
1012 a not implemented dialog is displayed. We don't want anyone
1013 outside of this module using it so define it as static,
1014 this will still be callable from the info dialogs as it
1015 will use the reference we set up.
1016
1017 $Returns: zero, always
1018
1019 $Arguments: win, parent window
1020 identifier, of the window
1021 reason, for the window
1022
1023 *******************************************************************************/
1024
1025 static tBookStatus bookDefaultCallBack( tBookMfwHnd win, UBYTE identifier, UBYTE reason )
1026 {
1027 if ( win )
1028 winShow( win );
1029
1030 return 0;
1031 }
1032
1033
1034
1035
1036
1037
1038
1039
1040 /*******************************************************************************
1041
1042 $Function: bookWindowData
1043
1044 $Description:
1045
1046 This routine is designed to be invoked from within a menu
1047 handler or call back function and will return a pointer to
1048 the window data associated with the current MFW element.
1049
1050 $Returns: pointer to the data area
1051
1052 $Arguments: none.
1053
1054 *******************************************************************************/
1055
1056 void *bookWindowData( void )
1057 {
1058 tBookMfwHnd WinPtr;
1059
1060 if ( ( WinPtr = bookCurrentWindow() ) == NULL )
1061 return (void *) NULL;
1062
1063 return (void *)((tBookMfwHdr *) WinPtr)->data;
1064 }
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074 /*******************************************************************************
1075
1076 $Function: bookMenuSelectedNumber
1077
1078 $Description:
1079
1080 This will return the currently selected entry in the phone
1081 book, when the routine is being called from a menu handler
1082
1083 $Returns: pointer to the selected number buffer
1084
1085 $Arguments: none.
1086
1087 *******************************************************************************/
1088
1089 char *bookMenuSelectedNumber( void )
1090 {
1091 tBookMfwHnd WinData;
1092
1093 /* Have we got a valid window ?
1094 */
1095 if ( ( WinData = (tBookMfwHnd) bookWindowData() ) == NULL )
1096 return NULL;
1097
1098 return NULL;
1099 }
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109 /*******************************************************************************
1110
1111 $Function: bookPhoneBookLoading
1112
1113 $Description: access routine for the local static menu area
1114
1115 Utility functions to determine if the phone book is
1116 still in the loading state
1117
1118 $Returns: BOOK_FAILURE if loading, otherwise BOOK_SUCCESS
1119
1120 $Arguments: none.
1121
1122 *******************************************************************************/
1123
1124 tBookStatus bookPhoneBookLoading( void )
1125 {
1126 int temp;
1127 char tempst[20];
1128 TRACE_FUNCTION("bookPhoneBookLoading");
1129 temp = phb_get_mode();
1130 sprintf(tempst,"phb_get_mode %d",temp);
1131 TRACE_EVENT(tempst);
1132 return ( (phb_get_mode() == PHB_LOADING)||(phb_get_mode() == MFW_PHB_FAIL) ) ? BOOK_FAILURE : BOOK_SUCCESS;
1133 }
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143 /*******************************************************************************
1144
1145 $Function: bookInfoDialog
1146
1147 $Description:
1148
1149 Utility functions just to throw a string onto the screen
1150 primarily for debug purposes, the modal version will wait
1151 for a user input before removing the message, the non-modal
1152 will clear after three seconds
1153
1154 $Returns: One.
1155
1156 $Arguments: String1, String2, character strings to be displayed.
1157
1158 *******************************************************************************/
1159
1160 tBookStatus bookInfoDialog( char *String1, char *String2 )
1161 {
1162 tBookMfwHnd Win = bookCurrentWindow();
1163 tBookDialogData Dialog;
1164
1165 /* Initialise the dialog control block with default information
1166 */
1167 dlg_initDisplayData_TextStr( &Dialog, TxtNull, TxtNull, String1, String2, COLOUR_STATUS);
1168 dlg_initDisplayData_events( &Dialog, (T_VOID_FUNC)bookDefaultCallBack, THREE_SECS, KEY_CLEAR);
1169
1170 /* Show the dialog
1171 */
1172 info_dialog( Win, &Dialog );
1173
1174 return 1;
1175 }
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185 /*******************************************************************************
1186
1187 $Function: bookNotImplemented
1188
1189 $Description:
1190
1191 This will present an information dialog indicating the current
1192 feature is still under development. This routine will use the
1193 current MFW element to detect the handle of the parent window
1194 if the incoming window handle is NULL.
1195
1196 $Returns: One
1197
1198 $Arguments: Parent, window, can be NULL
1199
1200 *******************************************************************************/
1201
1202 tBookStatus bookNotImplemented( tBookMfwHnd Parent )
1203 {
1204 tBookMfwHnd Win = ( Parent ) ? Parent : bookCurrentWindow();
1205 tBookDialogData Dialog;
1206
1207 /* Initialise the dialog control block with default information
1208 */
1209 dlg_initDisplayData_TextStr( &Dialog, TxtNull, TxtNull, MmiRsrcGetText( TxtNotImplemented ), NULL, COLOUR_STATUS);
1210 dlg_initDisplayData_events( &Dialog, (T_VOID_FUNC)bookDefaultCallBack, THREE_SECS, KEY_CLEAR);
1211
1212 /* Show the dialog
1213 */
1214 info_dialog( Win, &Dialog );
1215
1216 return 1;
1217
1218 }
1219
1220 /* Menu handler to invoke the routine above
1221 */
1222 tBookStatus bookMenuNotImplemented( tBookMfwMenu *Menu, tBookMfwMenuItem *Item )
1223 {
1224 return bookNotImplemented( NULL );
1225 }
1226
1227
1228
1229
1230
1231
1232 /* SPR#1428 - SH - New Editor changes: No longer required */
1233 #ifndef NEW_EDITOR
1234
1235 /*******************************************************************************
1236
1237 $Function: set_edt_attr
1238
1239 $Description:
1240
1241 Sets up the edit attribute structure with the provided parameters
1242
1243 $Returns: None
1244
1245 $Arguments: winPx, winPy, winSx, winSy, positioning information
1246 fgColor, colour for foreground
1247 font, mode, controls, pretty much what they say
1248 *text, initial text to be edited
1249 size, of the text (in bytes)
1250 attr, the block to be set up with the other parameters
1251
1252 GW - Changed colour from 8 bits (foreground) to 2x32bits fgd and bgd
1253 For the colour display we pass a 32 bit word that defines the size and position of the editor.
1254 This can be either a specific size or a more generic ('middle of the screen'/full width of display)
1255 *******************************************************************************/
1256 void bookSetEditAttributes(
1257 int zone_id,
1258 U32 colIndex,
1259 U8 font, U8 mode, U8 *controls,
1260 char *text, U16 size,
1261 MfwEdtAttr* attr)
1262 {
1263 /* Populate the structure with the parameters
1264 */
1265 calculateWindow(attr, zone_id );
1266 attr->edtCol = colIndex;
1267 attr->font = font;
1268 attr->mode = mode;
1269 attr->controls = controls;
1270 attr->text = text;
1271 attr->size = size;
1272 }
1273 #endif /* NEW_EDITOR */
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284 /*******************************************************************************
1285
1286 Name Handling Functions
1287
1288 *******************************************************************************/
1289
1290 /*******************************************************************************
1291
1292 $Function: bookGetCurrentStatus
1293
1294 $Description: Determines the current status of the phone book
1295
1296 $Returns: status byte
1297
1298 $Arguments: currentStatus, pointer to structure to be populated with
1299 status information
1300
1301 *******************************************************************************/
1302
1303 UBYTE bookGetCurrentStatus( T_MFW_PHB_STATUS *currentStatus )
1304 {
1305 UBYTE temp;
1306 TRACE_FUNCTION( "bookGetCurrentStatus()" );
1307
1308
1309 temp = phb_get_status( currentStatus );
1310 {
1311 char temp[255];
1312 sprintf(temp,"book %d max_entries %d used_entries %d aval_entries %d",
1313 currentStatus->book,currentStatus->max_entries,
1314 currentStatus->used_entries,
1315 currentStatus->avail_entries);
1316 TRACE_EVENT(temp);
1317 }
1318 return temp;
1319 }
1320
1321
1322
1323
1324
1325
1326
1327
1328 /*******************************************************************************
1329
1330 $Function: bookFindNames
1331
1332 $Description: Fine name in phone book
1333
1334 $Returns: status of search
1335
1336 $Arguments: number, number of entries to search, current,
1337 pointer to structure containing search context
1338
1339 *******************************************************************************/
1340
1341 UBYTE bookFindName( UBYTE number, tMmiPhbData *current )
1342 {
1343 UBYTE ret;
1344 int index; // , Count = 0; // RAVI
1345 UBYTE l_name[MAX_ALPHA_LEN];/*MC SPR 1257, name strings should use MAX_ALPHA_LEN*/
1346 UBYTE book_type, index_type;
1347 int i;
1348 char debug[22];
1349
1350 // May 24, 2004 REF: CRR MMI-SPR-15813 Ajith K P
1351 // Added these variables to Fix the Issue MMI-SPR-15813
1352 // nondigitindex => index after which '+' sign to be added
1353 // numlength = lenght of the number array.
1354 // nondigitFound = Checks whether nondigit is present in the number array or not.
1355
1356 int nondigitindex = -1,j,numlength = 0, nondigitFound = -1;
1357
1358
1359 TRACE_FUNCTION( "bookFindName()" );
1360
1361 /* Firstly, check for an empty book
1362 */
1363 bookGetCurrentStatus( &current->status );
1364 if ( current->status.used_entries < 1 )
1365 {
1366 current->index = 0;
1367 return MFW_PHB_OK;
1368 }
1369
1370 // Feb 20, 2006 REF: OMAPS00061948 x0039928
1371 // Fix : If used entries are less than MAX_SARCH_NAME then no. of entries
1372 // passed to the phb_read_entries is used entries.
1373 if(current->status.used_entries < MAX_SEARCH_NAME)
1374 number = current->status.used_entries;
1375
1376 /* Okay, we have some entries to search, so initialise the current
1377 entry buffer to empty
1378 */
1379 memset( current->entry, 0, MAX_SEARCH_CALL_LIST * sizeof( T_MFW_PHB_ENTRY ) );
1380
1381
1382
1383 current->list.entry = current->entry;
1384 current->list.num_entries = number;
1385
1386 /* Sort out how we index the information
1387 */
1388 book_type = current->status.book;
1389 index_type = MFW_PHB_INDEX;
1390 if ( ( book_type == bookActiveBook(WRITE) ) || ( book_type == PHB_SDN ) )
1391 index_type = MFW_PHB_ALPHA;
1392
1393 /* Sort out the type of search we are performing
1394 */
1395 if ((book_type == PHB_LDN) || (book_type == PHB_LRN)|| (book_type == PHB_LMN))
1396 index_type = MFW_PHB_INDEX;
1397 else
1398 {
1399 if ( current->KindOfSearch == SEARCH_BY_NAME )
1400 index_type = MFW_PHB_ALPHA;
1401 else if ( current->KindOfSearch == SEARCH_BY_NUMBER )
1402 index_type = MFW_PHB_NUMBER;
1403 else if ( current->KindOfSearch == SEARCH_BY_LOCATION )
1404 index_type = MFW_PHB_INDEX;
1405 }
1406
1407
1408 /* read the appropriate entries from the phone book
1409 */
1410 {
1411 char temp[255];
1412 sprintf(temp,"book %d index %d indextype %d number %d",
1413 book_type,current->index,index_type,number);
1414 TRACE_EVENT(temp);
1415 }
1416 // May 3, 2004 REF: CRR MMI-SPR-18555 Rashmi C N(Sasken)
1417 //When book is ADN, we need to read only ADN entries. no need to display ADN and FDN together
1418
1419 if (book_type == PHB_ADN) /*Quick test */
1420 {
1421 TRACE_EVENT("book_type == PHB_ADN");
1422 ret = phb_read_entries( PHB_ADN, current->index, index_type, number, &current->list );
1423 }
1424 else
1425 {
1426 TRACE_EVENT("book_type == OTHER");
1427 ret = phb_read_entries( book_type, current->index, index_type, number, &current->list );
1428 }
1429
1430 /* Populate the output structures
1431 */
1432 if (current->list.result == MFW_NO_ENTRY)
1433 current->index = 0;
1434
1435 for ( index = 0; index < number; index++ )
1436 #ifdef NO_ASCIIZ
1437
1438 #ifdef EASY_TEXT_ENABLED
1439 {/*MC , SPR 1242 merged in this section from b-sample build*/
1440
1441 /* GSM character sets
1442 */
1443 TRACE_EVENT( (char*)current->entry[index].name.data);
1444 TRACE_EVENT("Convert from SIM to UCS2");
1445
1446 TRACE_EVENT_P1("length of name string: %d", current->entry[index].name.len);
1447 /*MC SPR 1257, replacing PHB_MAX_LEN with MAX_ALPHA_LEN for name strings*/
1448 if (current->entry[index].name.data[0] == 0x80 )
1449 { for (i=1; i<MAX_ALPHA_LEN; i+=1)
1450 {
1451 l_name[i+1] = current->entry[index].name.data[i];
1452 }
1453 l_name[0] = current->entry[index].name.data[0];
1454 l_name[1] = MAX_ALPHA_LEN;
1455
1456 memcpy( current->entry[index].name.data, (char*)l_name, MAX_ALPHA_LEN );
1457 /*MC, we'll just use the length provided by the MFW*/
1458 if (current->entry[index].name.len%2 == 1)/*if length of string odd*/
1459 current->entry[index].name.len++;/* INCREASE LENGTH BY 1*/
1460
1461 /*make sure all chars after length are 0*/
1462 for (i=current->entry[index].name.len; i<MAX_ALPHA_LEN; i++)
1463 { current->entry[index].name.data[i] = 0; }
1464
1465 for (i=0; i < MAX_ALPHA_LEN;i++)
1466 {
1467 if ( current->entry[index].name.data[i]== 0 && current->entry[index].name.data[i+1] != 0)
1468 debug[i] = '0';
1469 else
1470 debug[i] = (char)current->entry[index].name.data[i];
1471 }
1472
1473
1474 TRACE_EVENT("Decoded entry");
1475 TRACE_EVENT(debug);
1476
1477 }
1478
1479 else
1480
1481 { /*SPR2175, use new function to convert from GSM to ASCII*/
1482 { ATB_convert_String((char*)current->entry[index].name.data, MFW_DCS_8bits, current->entry[index].name.len,
1483 (char*)l_name, MFW_ASCII, PHB_MAX_LEN, FALSE);
1484 current->entry[index].name.dcs = MFW_ASCII;
1485 memcpy( current->entry[index].name.data, (char*)l_name, MAX_ALPHA_LEN );
1486 }
1487
1488
1489 }
1490 }
1491
1492 #endif
1493 /*MC end*/
1494 #else
1495 { TRACE_EVENT_P1("length of name string: %d", current->entry[index].name.len);
1496 /*SPR2175, use new function to convert from GSM to ASCII*/
1497 { ATB_convert_String((char*)current->entry[index].name.data, MFW_DCS_8bits, current->entry[index].name.data.len,
1498 l_name.data, MFW_ASCII, PHB_MAX_LEN);
1499 current->entry[index].name.dcs = MFW_ASCII;
1500 memcpy( current->entry[index].name.data, (char*)l_name, MAX_ALPHA_LEN );
1501 }
1502 }
1503 #endif
1504
1505 /* Needed to make international calls from the phonebook
1506 */
1507 for ( index = 0; index < number; index++ )
1508 {
1509 if ( current->entry[index].ton )
1510 {
1511
1512 // May 24, 2004 REF: CRR MMI-SPR-15813 Ajith K P
1513
1514 // Issue description: Followup from 15623, this is the BMI part of this Issue.
1515 // At last, in the record "SSC09" the number is displayed with the "+"
1516 // character at the beginning of the number instead of "**21*+014543877989#"
1517
1518 // Solution: Find the location of nondigit(e.g:*, #) in the number array
1519 // and put '+' to next position if the index is less than numlength-8. This is done
1520 // as there can be ss strings(like *11*20#) attached to the number in the end.
1521 // For eg: **61#+9844093515*11*20#
1522 // If the total length is less than 8 assign this index to nondigitindex.
1523 // This solution is based on special sequences we have encountered till now.
1524
1525 // Finds the length of the number array.
1526 numlength = strlen((char*)current->entry[ index ].number);
1527 //checks whether the length is within the limit.
1528 if(numlength <=PHB_MAX_LEN)
1529 {
1530 for( j=0; j< numlength ; j++)
1531 {
1532 if( !isdigit((char*)current->entry[ index ].number[j]) )
1533 {
1534 // Found a nondigit can be */#
1535 nondigitFound = j;
1536 // Checking , whether the nondigit index is not at the end
1537 // part of the number array.
1538 if(j < (numlength-8))
1539 {
1540 // Current index is less than numlength-8
1541 nondigitindex = j;
1542 }
1543 else
1544 {
1545 if(numlength <8)
1546 {
1547 // If lenght of the number array is less than 8
1548 // assign the index to nondigitindex
1549 // This condition might occur when the user
1550 // presses invalid short sequence
1551 nondigitindex = j;
1552 }
1553 }
1554 }
1555 }
1556
1557 if((nondigitindex == -1) && (nondigitFound> -1) && (nondigitFound < 4))
1558 {
1559 // Nondigit is existing and it's position is less than 4 and not met
1560 // any of the above conditions.
1561 nondigitindex = nondigitFound;
1562 }
1563
1564 // Move the contents accordingly.
1565 memmove((char *) &(current->entry[ index ].number[ nondigitindex+2]),
1566 (char *) &(current->entry[ index ].number[nondigitindex+1]), numlength - nondigitindex+1);
1567
1568 // Add the '+' sign after the appropriate nondigit character, if any.
1569 current->entry[index].number[nondigitindex+1] = '+';
1570 }
1571
1572 }
1573 }
1574
1575 return current->result = ret;
1576 }
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586 /*******************************************************************************
1587
1588 $Function: bookEvent
1589
1590 $Description: Event handler for a phone book event
1591
1592 $Returns: MFW_EVENT_CONSUMED if recognised message, otherwise
1593 MFW_EVENT_PASSED
1594
1595 $Arguments: e, event, para, general parameter giving context of call
1596
1597 *******************************************************************************/
1598
1599 int bookEvent( MfwEvt e, void *para )
1600 {
1601 T_MFW_PHB_STATUS *status;
1602
1603 TRACE_FUNCTION( "bookEvent" );
1604
1605 /* deal with the incoming event
1606 */
1607 switch( e )
1608 {
1609 case E_PHB_UPN_LIST :
1610 {
1611 upnList = (T_MFW_UPN_LIST *)para;
1612 /* tbd */
1613 }
1614 break;
1615
1616 case E_PHB_STATUS:
1617 {
1618 status = (T_MFW_PHB_STATUS *)para;
1619 if ( ( status->book == PHB_FDN ) || ( status->book == PHB_ADN ) )
1620 {
1621 if ( pinsSetIsFocussed() == FOCUSSED_PINS )
1622 backpinFDNactdeact();
1623 }
1624 }
1625 break;
1626
1627 case E_PHB_ERROR:
1628 {
1629 /* tbd */
1630 }
1631 break;
1632
1633 /* SPR#1112 - SH - New events to indicate status of phonebook */
1634
1635 case E_PHB_READY:
1636 {
1637 TRACE_EVENT("E_PHB_READY");
1638 #ifdef INT_PHONEBOOK
1639 /* SPR#1112 - SH - If we're copying or moving a list,
1640 * the current operation has been successful - keep copying. */
1641 if (ipbCopyIndex)
1642 {
1643 TRACE_EVENT("Copying/moving in progress.");
1644 bookCopyMultiple(ipbWin, ipbMove, 0);
1645 }
1646 #endif
1647 }
1648 break;
1649
1650 case E_PHB_BUSY:
1651 {
1652 TRACE_EVENT("E_PHB_BUSY");
1653 }
1654 break;
1655
1656 /* end SPR#1112 */
1657
1658 default:
1659 {
1660 /* indicate we haven't dealt with event
1661 */
1662 return MFW_EVENT_PASSED;
1663 }
1664 // break; // RAVI
1665 }
1666
1667 /* got to here, we have dealt with the event
1668 */
1669 return MFW_EVENT_CONSUMED;
1670 }
1671
1672
1673
1674
1675
1676 /*******************************************************************************
1677
1678 $Function: bookCopyPhbName
1679
1680 $Description: Copiers a phonebook name structure (for NO_ASCII set or cleared)
1681
1682 $Returns: None
1683
1684 $Arguments: destEntry - destination phonebook entry structure
1685 srcEntry - source phonebook entry structure
1686 maxLen - max number oc chars to be copied
1687
1688 *******************************************************************************/
1689 //GW Created function to copy name (and length when required).
1690 void bookCopyPhbName( T_MFW_PHB_ENTRY* destEntry, T_MFW_PHB_ENTRY* srcEntry, int maxLen )
1691 {
1692 int len; //length of string to be copied
1693 if ((destEntry==NULL) || (srcEntry==NULL))
1694 return;
1695 #ifdef NO_ASCIIZ
1696 //Ensure we do not copy more than the PHB array can hold.
1697 if ((maxLen < PHB_MAX_LEN) && (maxLen >0))
1698 len = maxLen;
1699 else
1700 len = PHB_MAX_LEN;
1701
1702 #else
1703 /*MC SPR1319, name string is only up to MAX_ALPHA_LEN in length*/
1704 //Ensure we do not copy more than the PHB array can hold.
1705 if ((maxLen < MAX_ALPHA_LEN) && (maxLen >0))
1706 len = maxLen;
1707 else
1708 len = MAX_ALPHA_LEN;
1709 #endif
1710 #ifdef NO_ASCIIZ
1711 memset (destEntry->name.data, 0, PHB_MAX_LEN);
1712 memcpy( destEntry->name.data, srcEntry->name.data, len);
1713 if (srcEntry->name.len < len)
1714 destEntry->name.len = srcEntry->name.len;
1715 else
1716 { //we have truncated the name - add termination (if possible)
1717 destEntry->name.len = len;
1718 if (len < PHB_MAX_LEN)
1719 { // there is space in array for termination - add it.
1720 destEntry->name.data[len] = 0x00;
1721
1722 }
1723 }
1724 #else
1725
1726 memcpy( destEntry->name, srcEntry->name, maxLen);
1727 #endif
1728 }
1729
1730
1731
1732 /*******************************************************************************
1733
1734 End of File
1735
1736 *******************************************************************************/
1737