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