comparison src/ui/bmi/mmiBookSearchWindow.c @ 142:ec9f955fc487

mmiBook*.c: bogotab fixes
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 14 Nov 2020 08:43:59 +0000
parents c0052fe355d3
children
comparison
equal deleted inserted replaced
141:67b91d34f75e 142:ec9f955fc487
1 /******************************************************************************* 1 /*******************************************************************************
2 2
3 CONDAT (UK) 3 CONDAT (UK)
4 4
5 ******************************************************************************** 5 ********************************************************************************
6 6
7 This software product is the property of Condat (UK) Ltd and may not be 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. 8 disclosed to any third party without the express permission of the owner.
9 9
10 ******************************************************************************** 10 ********************************************************************************
11 11
12 $Project name: Basic MMI 12 $Project name: Basic MMI
13 $Project code: BMI (6349) 13 $Project code: BMI (6349)
14 $Module: PhoneBook 14 $Module: PhoneBook
15 $File: MmiSearchWindow.c 15 $File: MmiSearchWindow.c
16 $Revision: 1.0 16 $Revision: 1.0
17 17
18 $Author: Condat(UK) 18 $Author: Condat(UK)
19 $Date: 25/10/00 19 $Date: 25/10/00
20 20
21 ******************************************************************************** 21 ********************************************************************************
22 22
23 Description: 23 Description:
24 24
25 This module provides the phone book search window functionality for the 25 This module provides the phone book search window functionality for the
26 phone book module of the basic MMI 26 phone book module of the basic MMI
27 27
28 ******************************************************************************** 28 ********************************************************************************
29 $History: MmiSearchWindow.c 29 $History: MmiSearchWindow.c
30 30
31 23 April 2007 DR:OMAPS00121834, x0066692 Asha 31 23 April 2007 DR:OMAPS00121834, x0066692 Asha
43 Description: Should be able to select the number fro the phonebook while 43 Description: Should be able to select the number fro the phonebook while
44 sending MMS/EMS. 44 sending MMS/EMS.
45 Solution: The new feature to select the number from phonebook while sending 45 Solution: The new feature to select the number from phonebook while sending
46 MMS/EMS is added 46 MMS/EMS is added
47 47
48 Oct 26, 2004 REF: CRR 25354 xkundadu 48 Oct 26, 2004 REF: CRR 25354 xkundadu
49 Description: Phonebook: After entering precise name to search and then 49 Description: Phonebook: After entering precise name to search and then
50 trying to delete using RSK, first character is not deleted 50 trying to delete using RSK, first character is not deleted
51 Fix: If only one character is present in the editor and delete key is pressed, 51 Fix: If only one character is present in the editor and delete key is pressed,
52 delete the editor buffer and update the editor view. 52 delete the editor buffer and update the editor view.
53 53
54 Aug 16, 2004 REF: CRR 24323 Deepa M.D 54 Aug 16, 2004 REF: CRR 24323 Deepa M.D
55 Bug:Clenup of sprintf used for tracing 55 Bug:Clenup of sprintf used for tracing
56 Fix:Replace the char buf[]; sprintf (buf, "...", ...); TRACE_EVENT (buf); statements by TRACE_EVENT_PX 56 Fix:Replace the char buf[]; sprintf (buf, "...", ...); TRACE_EVENT (buf); statements by TRACE_EVENT_PX
57 57
58 25/10/00 Original Condat(UK) BMI version. 58 25/10/00 Original Condat(UK) BMI version.
59 20/02/02 Reinstated editor when in Chinese language by removing 59 20/02/02 Reinstated editor when in Chinese language by removing
60 "if not Chinese" conditions SPR 1742 60 "if not Chinese" conditions SPR 1742
61 61
62 $End 62 $End
63 63
64 *******************************************************************************/ 64 *******************************************************************************/
65 65
124 #include "MmiMain.h" 124 #include "MmiMain.h"
125 #include "MmiBookController.h" 125 #include "MmiBookController.h"
126 #include "MmiDummy.h" 126 #include "MmiDummy.h"
127 #include "MmiDialogs.h" 127 #include "MmiDialogs.h"
128 #include "MmiLists.h" 128 #include "MmiLists.h"
129
130 129
131 130
132 #include "MmiMenu.h" 131 #include "MmiMenu.h"
133 #include "mmiCall.h" 132 #include "mmiCall.h"
134 #include "Mmiicons.h" 133 #include "Mmiicons.h"
165 #endif 164 #endif
166 165
167 typedef struct 166 typedef struct
168 { 167 {
169 T_MMI_CONTROL mmi_control; 168 T_MMI_CONTROL mmi_control;
170 T_MFW_HND chinese_search_win; /* MFW win handler */ 169 T_MFW_HND chinese_search_win; /* MFW win handler */
171 T_MFW_HND parent; 170 T_MFW_HND parent;
172 ListMenuData * menu_list_data; 171 ListMenuData * menu_list_data;
173 } T_CHINESE_SEARCH_INFO; 172 } T_CHINESE_SEARCH_INFO;
174 #include "mmiColours.h" 173 #include "mmiColours.h"
175 174
187 #define TIME_TRACE_EVENT 186 #define TIME_TRACE_EVENT
188 #endif 187 #endif
189 188
190 /******************************************************************************* 189 /*******************************************************************************
191 190
192 $Function: bookSearchDialog 191 $Function: bookSearchDialog
193 192
194 $Description: dialog handler for the search window functionality 193 $Description: dialog handler for the search window functionality
195 194
196 $Returns: None 195 $Returns: None
197 196
198 $Arguments: win, window handle 197 $Arguments: win, window handle
199 event, event to be handled 198 event, event to be handled
200 value, not used 199 value, not used
201 parameter, not used 200 parameter, not used
202 201
203 *******************************************************************************/ 202 *******************************************************************************/
204 203
205 void bookSearchDialog( T_MFW_HND win, USHORT event, SHORT value, void *parameter ) 204 void bookSearchDialog( T_MFW_HND win, USHORT event, SHORT value, void *parameter )
206 { 205 {
207 T_MFW_WIN *win_data = ((T_MFW_HDR *) win)->data; 206 T_MFW_WIN *win_data = ((T_MFW_HDR *) win)->data;
208 tBookStandard *data = (tBookStandard *) win_data->user; 207 tBookStandard *data = (tBookStandard *) win_data->user;
209 tMmiPhbData *Current = &data->phbk->current; 208 tMmiPhbData *Current = &data->phbk->current;
210 MfwMnu *mnu; 209 MfwMnu *mnu;
211 //Jan 22, 2006 REF: OMAPS00061930 x0039928 210 //Jan 22, 2006 REF: OMAPS00061930 x0039928
212 // Fix : Add a local variable search_string 211 // Fix : Add a local variable search_string
213 char search_string[MAX_ALPHA_LEN]; 212 char search_string[MAX_ALPHA_LEN];
214 //x0066692 Date:23 April 2007 DR:OMAPS00121834, Asha 213 //x0066692 Date:23 April 2007 DR:OMAPS00121834, Asha
215 //Fix for phone book search issue - when phonebook has more than 240 entries. 214 //Fix for phone book search issue - when phonebook has more than 240 entries.
216 UBYTE max_search_name; 215 UBYTE max_search_name;
217 216
218 TRACE_FUNCTION( "bookSearchDialog()" ); 217 TRACE_FUNCTION( "bookSearchDialog()" );
219 218
220 switch( event ) 219 switch( event )
221 { 220 {
222 case SEARCH_INIT: 221 case SEARCH_INIT:
223 { 222 {
224 /* No initialisation required 223 /* No initialisation required
225 */ 224 */
226 } 225 }
227 break; 226 break;
228 227
229 case SEARCH_SCROLL_UP: 228 case SEARCH_SCROLL_UP:
230 { /*MC SPR 1541, flag to show whether we've scrolled off-screen and need to 229 { /*MC SPR 1541, flag to show whether we've scrolled off-screen and need to
231 update the portion of the list displayed*/ 230 update the portion of the list displayed*/
232 BOOL get_new_screen = FALSE; 231 BOOL get_new_screen = FALSE;
233 232
234 233
235 /* Scroll up 234 /* Scroll up
236 */ 235 */
237 if ( ( Current->index == 1 ) && ( Current->selectedName == 0 ) ) 236 if ( ( Current->index == 1 ) && ( Current->selectedName == 0 ) )
238 { 237 {
239 if ( Current->status.used_entries < MAX_SEARCH_NAME ) 238 if ( Current->status.used_entries < MAX_SEARCH_NAME )
240 Current->selectedName = Current->status.used_entries - 1; 239 Current->selectedName = Current->status.used_entries - 1;
241 else 240 else
242 { Current->selectedName = MAX_SEARCH_NAME - 1; 241 { Current->selectedName = MAX_SEARCH_NAME - 1;
243 /*SPR 1541, we're scrolling up from the first item in the list and are to go to 242 /*SPR 1541, we're scrolling up from the first item in the list and are to go to
244 the end*/ 243 the end*/
245 get_new_screen = TRUE; 244 get_new_screen = TRUE;
246 } 245 }
247 Current->index = Current->status.used_entries - Current->selectedName; 246 Current->index = Current->status.used_entries - Current->selectedName;
248 247
249 } 248 }
250 else 249 else
251 { 250 {
252 if (Current->selectedName == 0) 251 if (Current->selectedName == 0)
253 { Current->index--; 252 { Current->index--;
254 /*SPR 1541, we've just come off the top of the screen*/ 253 /*SPR 1541, we've just come off the top of the screen*/
255 get_new_screen = TRUE; 254 get_new_screen = TRUE;
256 } 255 }
257 else 256 else
258 Current->selectedName--; 257 Current->selectedName--;
259 } 258 }
260 259
261 mnu = (MfwMnu *) mfwControl( data->menu ); 260 mnu = (MfwMnu *) mfwControl( data->menu );
262 mnu->lCursor[mnu->level] = Current->selectedName; 261 mnu->lCursor[mnu->level] = Current->selectedName;
263 262
264 /*SPR 1541, only update the list if flag set*/ 263 /*SPR 1541, only update the list if flag set*/
265 if (get_new_screen == TRUE) 264 if (get_new_screen == TRUE)
266 bookFindName( MAX_SEARCH_NAME, &data->phbk->current ); 265 bookFindName( MAX_SEARCH_NAME, &data->phbk->current );
267 } 266 }
268 break; 267 break;
269 268
270 case SEARCH_SCROLL_DOWN: 269 case SEARCH_SCROLL_DOWN:
271 { /*MC SPR 1541, flag to show whether we've scrolled off-screen and need to 270 { /*MC SPR 1541, flag to show whether we've scrolled off-screen and need to
272 update the portion of the list displayed*/ 271 update the portion of the list displayed*/
273 BOOL get_new_screen = FALSE; 272 BOOL get_new_screen = FALSE;
274 273
275 /* Scroll Down 274 /* Scroll Down
276 */ 275 */
277 if ( ( Current->index + Current->selectedName ) == Current->status.used_entries ) 276 if ( ( Current->index + Current->selectedName ) == Current->status.used_entries )
278 { 277 {
279 Current->index = 1; 278 Current->index = 1;
280 Current->selectedName = 0; 279 Current->selectedName = 0;
281 /*SPR 1541, we've come off the end of the list and are to go back to 280 /*SPR 1541, we've come off the end of the list and are to go back to
282 the beginning*/ 281 the beginning*/
283 get_new_screen = TRUE; 282 get_new_screen = TRUE;
284 } 283 }
285 else 284 else
286 { 285 {
287 if ( Current->selectedName == MAX_SEARCH_NAME - 1 ) 286 if ( Current->selectedName == MAX_SEARCH_NAME - 1 )
288 { Current->index++; 287 { Current->index++;
289 /*SPR 1541, we've just come off the bottom of the screen*/ 288 /*SPR 1541, we've just come off the bottom of the screen*/
290 get_new_screen = TRUE; 289 get_new_screen = TRUE;
291 } 290 }
292 else 291 else
293 Current->selectedName++; 292 Current->selectedName++;
294 } 293 }
295 294
296 mnu = (MfwMnu *) mfwControl( data->menu ); 295 mnu = (MfwMnu *) mfwControl( data->menu );
297 mnu->lCursor[mnu->level] = Current->selectedName; 296 mnu->lCursor[mnu->level] = Current->selectedName;
298 /*SPR 1541, only update the list if flag set*/ 297 /*SPR 1541, only update the list if flag set*/
299 if (get_new_screen == TRUE) 298 if (get_new_screen == TRUE)
300 bookFindName( MAX_SEARCH_NAME, &data->phbk->current ); 299 bookFindName( MAX_SEARCH_NAME, &data->phbk->current );
301 } 300 }
302 break; 301 break;
303 302
304 case SEARCH_STRING: 303 case SEARCH_STRING:
305 { 304 {
306 { 305 {
307 //Jan 22, 2006 REF: OMAPS00061930 x0039928 306 //Jan 22, 2006 REF: OMAPS00061930 x0039928
308 //Fix : Copy the number to be searched into the search_string variable and give a search for it 307 //Fix : Copy the number to be searched into the search_string variable and give a search for it
309 if ( value == TRUE) 308 if ( value == TRUE)
310 strcpy(search_string,(char*)data->phbk->edt_buf_name); 309 strcpy(search_string,(char*)data->phbk->edt_buf_name);
311 else 310 else
312 strcpy(search_string,(char*)data->edtBuf); 311 strcpy(search_string,(char*)data->edtBuf);
313 312
314 /* Find name 313 /* Find name
315 */ 314 */
316 Current->index = Current->index + Current->selectedName; 315 Current->index = Current->index + Current->selectedName;
317 if ( bookSearchName( search_string, MAX_SEARCH_NAME, Current ) == MFW_PHB_OK ) 316 if ( bookSearchName( search_string, MAX_SEARCH_NAME, Current ) == MFW_PHB_OK )
318 { 317 {
319 //x0066692 Date:23 April 2007 DR:OMAPS00121834, Asha 318 //x0066692 Date:23 April 2007 DR:OMAPS00121834, Asha
320 //Fix is added to make cursor point to the correct entry in the phonebook. 319 //Fix is added to make cursor point to the correct entry in the phonebook.
321 max_search_name = Current->status.used_entries - Current->index +1; 320 max_search_name = Current->status.used_entries - Current->index +1;
322 if ( max_search_name > MAX_SEARCH_NAME ) 321 if ( max_search_name > MAX_SEARCH_NAME )
323 max_search_name = MAX_SEARCH_NAME; 322 max_search_name = MAX_SEARCH_NAME;
324 323
325 if ( Current->index > ( Current->status.used_entries + 1 - max_search_name ) ) 324 if ( Current->index > ( Current->status.used_entries + 1 - max_search_name ) )
326 { 325 {
327 if ( Current->status.used_entries > MAX_SEARCH_NAME ) 326 if ( Current->status.used_entries > MAX_SEARCH_NAME )
328 { 327 {
329 Current->selectedName = Current->index - Current->status.used_entries + max_search_name - 1; 328 Current->selectedName = Current->index - Current->status.used_entries + max_search_name - 1;
330 Current->index = Current->index - Current->selectedName; 329 Current->index = Current->index - Current->selectedName;
331 } 330 }
332 else 331 else
333 { 332 {
334 Current->selectedName = Current->index - 1; 333 Current->selectedName = Current->index - 1;
335 Current->index=1; 334 Current->index=1;
336 } 335 }
337 336
338 /* go find the name 337 /* go find the name
339 */ 338 */
340 339
341 bookFindName(MAX_SEARCH_NAME,&data->phbk->current); 340 bookFindName(MAX_SEARCH_NAME,&data->phbk->current);
342 } 341 }
343 else 342 else
344 { 343 {
345 Current->selectedName =0; 344 Current->selectedName =0;
346 345
347 } 346 }
348 347
349 /* update the menu */ 348 /* update the menu */
350 /* SPR881 - SH - Move name find to below */ 349 /* SPR881 - SH - Move name find to below */
351 } 350 }
352 else 351 else
353 {/*SPR 2233, if no name found, go to beginning of list*/ 352 {/*SPR 2233, if no name found, go to beginning of list*/
354 Current->index = 1; 353 Current->index = 1;
355 Current->selectedName = 0; 354 Current->selectedName = 0;
356 } 355 }
357 356
358 /* update the menu 357 /* update the menu
359 */ 358 */
360 /* SPR881 - SH - is necessary even when BookSearchName, above, fails */ 359 /* SPR881 - SH - is necessary even when BookSearchName, above, fails */
361 360
362 mnu = (MfwMnu *) mfwControl( data->menu ); 361 mnu = (MfwMnu *) mfwControl( data->menu );
363 mnu->lCursor[mnu->level] = Current->selectedName; 362 mnu->lCursor[mnu->level] = Current->selectedName;
364 TRACE_EVENT_P1("Current->selectedName: %d", Current->selectedName); 363 TRACE_EVENT_P1("Current->selectedName: %d", Current->selectedName);
365 /* go find the name 364 /* go find the name
366 */ 365 */
367 bookFindName(MAX_SEARCH_NAME,&data->phbk->current); 366 bookFindName(MAX_SEARCH_NAME,&data->phbk->current);
368 } 367 }
369 } 368 }
370 break; 369 break;
371 370
372 case SEARCH_UPDATE: 371 case SEARCH_UPDATE:
373 { 372 {
374 /* Update, actually an initialisation/reset phase 373 /* Update, actually an initialisation/reset phase
375 */ 374 */
376 Current->index = 1; 375 Current->index = 1;
377 Current->selectedName = 0; 376 Current->selectedName = 0;
378 377
379 { 378 {
380 memset( data->edtBuf, '\0', sizeof( data->edtBuf ) ); 379 memset( data->edtBuf, '\0', sizeof( data->edtBuf ) );
381 /* SPR#1428 - SH - New Editor changes */ 380 /* SPR#1428 - SH - New Editor changes */
382 #ifdef NEW_EDITOR 381 #ifdef NEW_EDITOR
383 ATB_edit_Reset( data->editor ); 382 ATB_edit_Reset( data->editor );
384 #else /* NEW_EDITOR */ 383 #else /* NEW_EDITOR */
385 edtReset( data->edt ); 384 edtReset( data->edt );
386 #endif /* NEW_EDITOR */ 385 #endif /* NEW_EDITOR */
387 SEND_EVENT( win, SEARCH_STRING, 0, 0 ); 386 SEND_EVENT( win, SEARCH_STRING, 0, 0 );
388 } 387 }
389 } 388 }
390 break; 389 break;
391 390
392 /* SPR#1428 - SH - New Editor: Add this to allow redraw of 391 /* SPR#1428 - SH - New Editor: Add this to allow redraw of
393 * window on request. */ 392 * window on request. */
394 393
395 #ifdef NEW_EDITOR 394 #ifdef NEW_EDITOR
396 case SEARCH_REDRAW: 395 case SEARCH_REDRAW:
397 /*SPR 2104, TRACE seems to fix timing probs :/ */ 396 /*SPR 2104, TRACE seems to fix timing probs :/ */
398 TRACE_EVENT("UPDATE SEARCH REDRAW"); 397 TRACE_EVENT("UPDATE SEARCH REDRAW");
399 SEND_EVENT(data->win, SEARCH_STRING, 0, 0); 398 SEND_EVENT(data->win, SEARCH_STRING, 0, 0);
400 win_show(data->win); 399 win_show(data->win);
401 break; 400 break;
402 #endif /* NEW_EDITOR */ 401 #endif /* NEW_EDITOR */
403 402
404 default: 403 default:
405 { 404 {
406 /* 405 /*
407 */ 406 */
408 } 407 }
409 break; 408 break;
410 } 409 }
411 } 410 }
412 411
413 412
414
415
416
417
418 /******************************************************************************* 413 /*******************************************************************************
419 414
420 $Function: bookSearchWindowCB 415 $Function: bookSearchWindowCB
421 416
422 $Description: Window call back function 417 $Description: Window call back function
423 418
424 $Returns: MFW_EVENT_CONSUMED, or MFW_EVENT_PASSED 419 $Returns: MFW_EVENT_CONSUMED, or MFW_EVENT_PASSED
425 420
426 $Arguments: e, event, w, window handle 421 $Arguments: e, event, w, window handle
427 422
428 *******************************************************************************/ 423 *******************************************************************************/
429 424
430 static int bookSearchWindowCB( MfwEvt e, MfwWin *w ) 425 static int bookSearchWindowCB( MfwEvt e, MfwWin *w )
431 { 426 {
432 tBookStandard *data = (tBookStandard *) w->user; 427 tBookStandard *data = (tBookStandard *) w->user;
433 tMmiPhbData *Current = &data->phbk->current; 428 tMmiPhbData *Current = &data->phbk->current;
434 int index; 429 int index;
435 char *pchr; 430 char *pchr;
436 char pchr2[PHB_MAX_LEN*2 +4];/*mc, SPR 1442*/ 431 char pchr2[PHB_MAX_LEN*2 +4];/*mc, SPR 1442*/
437 TRACE_FUNCTION( "bookSearchWindowCB()" ); 432 TRACE_FUNCTION( "bookSearchWindowCB()" );
438 433
439 // May 3, 2004 REF: CRR MMI-SPR-18555 Rashmi C N(Sasken) 434 // May 3, 2004 REF: CRR MMI-SPR-18555 Rashmi C N(Sasken)
440 // When FDN is disabled we need to display only ADN entries in the phonebook menu. 435 // When FDN is disabled we need to display only ADN entries in the phonebook menu.
441 // We just use the preset PHB_ADN as the current book. 436 // We just use the preset PHB_ADN as the current book.
442 //if(data->phbk->current.status.book == PHB_ADN) 437 //if(data->phbk->current.status.book == PHB_ADN)
443 // data->phbk->current.status.book = PHB_ADN_FDN; 438 // data->phbk->current.status.book = PHB_ADN_FDN;
444 439
445 440
446 /* Deal with the visible event 441 /* Deal with the visible event
447 */ 442 */
448 switch (e) 443 switch (e)
449 { 444 {
450 case MfwWinVisible: 445 case MfwWinVisible:
451 { 446 {
452 /* Deal with the window visible event 447 /* Deal with the window visible event
453 */ 448 */
454 MmiBookShowDefault(); 449 MmiBookShowDefault();
455 450
456 { 451 {
457 /* SPR#1428 - SH - New Editor changes */ 452 /* SPR#1428 - SH - New Editor changes */
458 #ifdef NEW_EDITOR 453 #ifdef NEW_EDITOR
459 ATB_edit_Show( data->editor ); 454 ATB_edit_Show( data->editor );
460 #else /* NEW_EDITOR */ 455 #else /* NEW_EDITOR */
461 edtShow( data->edt ); 456 edtShow( data->edt );
462 #endif /* NEW_EDITOR */ 457 #endif /* NEW_EDITOR */
463 } 458 }
464 459
465 /* SPR#1428 - SH - New Editor: Only update the list if we're not in multi-tap */ 460 /* SPR#1428 - SH - New Editor: Only update the list if we're not in multi-tap */
466 #ifdef NEW_EDITOR 461 #ifdef NEW_EDITOR
467 if (!data->editor->multitap) 462 if (!data->editor->multitap)
468 { 463 {
469 #endif /* NEW_EDITOR */ 464 #endif /* NEW_EDITOR */
470 465
471 for ( index = 0; index < MAX_SEARCH_NAME; index++ ) 466 for ( index = 0; index < MAX_SEARCH_NAME; index++ )
472 { 467 {
473 TRACE_EVENT( "bookSearchWindowCB()-loopstart" ); 468 TRACE_EVENT( "bookSearchWindowCB()-loopstart" );
474 469
475 pchr = (char *) MmiBookCallList( index ); 470 pchr = (char *) MmiBookCallList( index );
476 471
477 memset( pchr, '\0', NAME_SCREEN_MAX ); 472 memset( pchr, '\0', NAME_SCREEN_MAX );
478 473
479 /* SPR#1428 - SH - remove extraneous call to edtShow*/ 474 /* SPR#1428 - SH - remove extraneous call to edtShow*/
480 /*SPR 2123, using new macro PHONEBOOK_ITEM_LENGTH*/ 475 /*SPR 2123, using new macro PHONEBOOK_ITEM_LENGTH*/
481 #ifdef NO_ASCIIZ 476 #ifdef NO_ASCIIZ
482 /*if current language chinese*/ 477 /*if current language chinese*/
483 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE) 478 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)
484 { /*SPR 2653, this check should be here too*/ 479 { /*SPR 2653, this check should be here too*/
485 if (!Current->list.entry == NULL) 480 if (!Current->list.entry == NULL)
486 { if ( Current->entry[ index ].name.len NEQ 0) //if name not empty 481 { if ( Current->entry[ index ].name.len NEQ 0) //if name not empty
487 { 482 {
488 if (Current->entry[ index ].name.data[0] != 0x80)//if not unicode 483 if (Current->entry[ index ].name.data[0] != 0x80)//if not unicode
489 {/*we have to convert to unicode*/ 484 {/*we have to convert to unicode*/
490 pchr2[0]= (char)0x80;/*SPR 1442, add unicode tag*//*a0393213 lint warnings removal - typecast done*/ 485 pchr2[0]= (char)0x80;/*SPR 1442, add unicode tag*//*a0393213 lint warnings removal - typecast done*/
491 pchr2[1]= 0x7f; 486 pchr2[1]= 0x7f;
492 /*SPR2175, use new function*/ 487 /*SPR2175, use new function*/
493 ATB_convert_String((char*)Current->entry[ index ].name.data, MFW_ASCII, 488 ATB_convert_String((char*)Current->entry[ index ].name.data, MFW_ASCII,
494 (UBYTE)strlen((char*)Current->entry[ index ].name.data), &pchr2[2], MFW_DCS_UCS2, PHONEBOOK_ITEM_LENGTH-2, FALSE); 489 (UBYTE)strlen((char*)Current->entry[ index ].name.data), &pchr2[2], MFW_DCS_UCS2, PHONEBOOK_ITEM_LENGTH-2, FALSE);
495 /*SPR 1442 and now truncate the string*/ 490 /*SPR 1442 and now truncate the string*/
496 resources_truncate_to_screen_width((char *) pchr2, Current->entry[ index ].name.len*2+2, pchr,PHONEBOOK_ITEM_LENGTH , SCREEN_SIZE_X, TRUE); 491 resources_truncate_to_screen_width((char *) pchr2, Current->entry[ index ].name.len*2+2, pchr,PHONEBOOK_ITEM_LENGTH , SCREEN_SIZE_X, TRUE);
497 } 492 }
498 else /*MC SPR 1257, replacing PHB_MAX_LEN with MAX_ALPHA_LEN for name strings*/ 493 else /*MC SPR 1257, replacing PHB_MAX_LEN with MAX_ALPHA_LEN for name strings*/
499 { 494 {
500 /*SPR 1442 truncate the string*/ 495 /*SPR 1442 truncate the string*/
501 resources_truncate_to_screen_width((char *) Current->entry[index].name.data, Current->entry[index].name.len, pchr, MAX_ALPHA_LEN, SCREEN_SIZE_X, TRUE); 496 resources_truncate_to_screen_width((char *) Current->entry[index].name.data, Current->entry[index].name.len, pchr, MAX_ALPHA_LEN, SCREEN_SIZE_X, TRUE);
502 } 497 }
503 } 498 }
504 else /*we convert number string into unicode*/ 499 else /*we convert number string into unicode*/
505 { pchr2[0]= (char)0x80;/*SPR 1442, add unicode tag*//*a0393213 lint warnings removal-typecast done*/ 500 { pchr2[0]= (char)0x80;/*SPR 1442, add unicode tag*//*a0393213 lint warnings removal-typecast done*/
506 pchr2[1]= 0x7f; 501 pchr2[1]= 0x7f;
507 /*SPR 2175, use new function*/ 502 /*SPR 2175, use new function*/
508 ATB_convert_String((char*)Current->entry[ index ].number, MFW_ASCII, 503 ATB_convert_String((char*)Current->entry[ index ].number, MFW_ASCII,
509 (UBYTE)strlen((char*)Current->entry[ index ].number), &pchr2[2], MFW_DCS_UCS2, PHONEBOOK_ITEM_LENGTH-2, FALSE); 504 (UBYTE)strlen((char*)Current->entry[ index ].number), &pchr2[2], MFW_DCS_UCS2, PHONEBOOK_ITEM_LENGTH-2, FALSE);
510 /*SPR 1442 and now truncate the string*/ 505 /*SPR 1442 and now truncate the string*/
511 resources_truncate_to_screen_width((char *) pchr2, strlen((char*)Current->entry[ index ].number)*2+2, pchr,PHONEBOOK_ITEM_LENGTH, SCREEN_SIZE_X, TRUE); 506 resources_truncate_to_screen_width((char *) pchr2, strlen((char*)Current->entry[ index ].number)*2+2, pchr,PHONEBOOK_ITEM_LENGTH, SCREEN_SIZE_X, TRUE);
512 } 507 }
513 } 508 }
514 509
515 } 510 }
516 511
517 else 512 else
518 { /*if current language a latin language*/ 513 { /*if current language a latin language*/
519 /*SPR 2653, removed consitional compilation, this check applies whether we're in simulation mode or target hardware*/ 514 /*SPR 2653, removed consitional compilation, this check applies whether we're in simulation mode or target hardware*/
520 // EF check for null pointer first 515 // EF check for null pointer first
521 if (!Current->list.entry == NULL) 516 if (!Current->list.entry == NULL)
522 /*SPR 2104, don't need this test*/ 517 /*SPR 2104, don't need this test*/
523 518
524 if ( Current->entry[ index ].name.len NEQ 0&&Current->entry[ index ].name.data[0] != 0x80/*mc*/) //Should check to see if null name 519 if ( Current->entry[ index ].name.len NEQ 0&&Current->entry[ index ].name.data[0] != 0x80/*mc*/) //Should check to see if null name
525 { /*mc, SPR 1442, replaced old truncation function with new one*/ 520 { /*mc, SPR 1442, replaced old truncation function with new one*/
526 resources_truncate_to_screen_width((char *) Current->entry[index].name.data, Current->entry[index].name.len, pchr, PHONEBOOK_ITEM_LENGTH, SCREEN_SIZE_X, FALSE); 521 resources_truncate_to_screen_width((char *) Current->entry[index].name.data, Current->entry[index].name.len, pchr, PHONEBOOK_ITEM_LENGTH, SCREEN_SIZE_X, FALSE);
527 } 522 }
528 else 523 else
529 {/*mc, SPR 1442, replaced old truncation function with new one*/ 524 {/*mc, SPR 1442, replaced old truncation function with new one*/
530 resources_truncate_to_screen_width((char *) Current->entry[index].number, strlen((char*)Current->entry[index].number), pchr, PHONEBOOK_ITEM_LENGTH, SCREEN_SIZE_X,FALSE); 525 resources_truncate_to_screen_width((char *) Current->entry[index].number, strlen((char*)Current->entry[index].number), pchr, PHONEBOOK_ITEM_LENGTH, SCREEN_SIZE_X,FALSE);
531 } 526 }
532 527
533 #else 528 #else
534 if ( Current->entry[ index ].name[ 0 ] != NULL) //Should check to see if null name 529 if ( Current->entry[ index ].name[ 0 ] != NULL) //Should check to see if null name
535 { /*mc, SPR 1442, replaced old truncation function with new one*/ 530 { /*mc, SPR 1442, replaced old truncation function with new one*/
536 resources_truncate_to_screen_width((char *) Current->entry[index].name, 0, pchr, PHONEBOOK_ITEM_LENGTH, SCREEN_SIZE_X, FALSE); 531 resources_truncate_to_screen_width((char *) Current->entry[index].name, 0, pchr, PHONEBOOK_ITEM_LENGTH, SCREEN_SIZE_X, FALSE);
537 } 532 }
538 else 533 else
539 { /*mc, SPR 1442, replaced old truncation function with new one*/ 534 { /*mc, SPR 1442, replaced old truncation function with new one*/
540 resources_truncate_to_screen_width((char *) Current->entry[index].number, strlen((char*)Current->entry[index].number), pchr, PHONEBOOK_ITEM_LENGTH, SCREEN_SIZE_X,FALSE); 535 resources_truncate_to_screen_width((char *) Current->entry[index].number, strlen((char*)Current->entry[index].number), pchr, PHONEBOOK_ITEM_LENGTH, SCREEN_SIZE_X,FALSE);
541 } 536 }
542 /*SPR 2123 end*/ 537 /*SPR 2123 end*/
543 #endif 538 #endif
544 #ifdef NO_ASCIIZ/*MC SPR 975, opening bracket only exists when NO_ASCIIZ defined*/ 539 #ifdef NO_ASCIIZ/*MC SPR 975, opening bracket only exists when NO_ASCIIZ defined*/
545 } 540 }
546 #endif 541 #endif
547 } 542 }
548 543
549 TRACE_EVENT( "bookSearchWindowCB()-end of loop" ); 544 TRACE_EVENT( "bookSearchWindowCB()-end of loop" );
550 mnuShow(data->menu); 545 mnuShow(data->menu);
551 /* SPR#1428 - SH - End of condition to check if we're in multi-tap */ 546 /* SPR#1428 - SH - End of condition to check if we're in multi-tap */
552 #ifdef NEW_EDITOR 547 #ifdef NEW_EDITOR
553 } 548 }
554 #endif 549 #endif
555 550
556 /* special case if invoked from SMS or using SDN book 551 /* special case if invoked from SMS or using SDN book
557 */ 552 */
558 if ( ( data->phbk->fromSMS )|| 553 if ( ( data->phbk->fromSMS )||
559 ( data->phbk->fromSMSSC ) || /* SPR#1428 - SH - New event for service centre editor */ 554 ( data->phbk->fromSMSSC ) || /* SPR#1428 - SH - New event for service centre editor */
560 ( data->phbk->fromDivert ) || 555 ( data->phbk->fromDivert ) ||
561 ( data->phbk->fromDeflect )|| 556 ( data->phbk->fromDeflect )||
562 //CRR: 25302 - xpradipg 10 Nov 2004 557 //CRR: 25302 - xpradipg 10 Nov 2004
563 //check if it was invoked from MMS/EMS 558 //check if it was invoked from MMS/EMS
564 ( data->phbk->fromMmsEms)|| 559 ( data->phbk->fromMmsEms)||
565 ( Current->status.book == PHB_SDN ) ) 560 ( Current->status.book == PHB_SDN ) )
566 { 561 {
567 //displaySoftKeys( TxtSoftSelect, TxtSoftBack ); 562 //displaySoftKeys( TxtSoftSelect, TxtSoftBack );
568 // Jun 07, 2004 REF: CRR MMI-SPR-12818 Rashmi C N(Sasken) 563 // Jun 07, 2004 REF: CRR MMI-SPR-12818 Rashmi C N(Sasken)
569 // when the editor is empty, we need to display BACK softkey 564 // when the editor is empty, we need to display BACK softkey
570 // Delete softkey is displayed when it contains some characters 565 // Delete softkey is displayed when it contains some characters
571 if (data->editor_attr.text.len==0) 566 if (data->editor_attr.text.len==0)
572 { 567 {
573 displaySoftKeys( TxtSoftSelect, TxtSoftBack ); 568 displaySoftKeys( TxtSoftSelect, TxtSoftBack );
574 } 569 }
575 else 570 else
576 { 571 {
577 displaySoftKeys( TxtSoftSelect, TxtDelete ); 572 displaySoftKeys( TxtSoftSelect, TxtDelete );
578 } 573 }
579 } 574 }
580 else 575 else
581 { 576 {
582 //displaySoftKeys( TxtSoftOptions, TxtSoftBack ); 577 //displaySoftKeys( TxtSoftOptions, TxtSoftBack );
583 // Jun 07, 2004 REF: CRR MMI-SPR-12818 Rashmi C N(Sasken) 578 // Jun 07, 2004 REF: CRR MMI-SPR-12818 Rashmi C N(Sasken)
584 // when the editor is empty, we need to display BACK softkey 579 // when the editor is empty, we need to display BACK softkey
585 // Delete softkey is displayed when it contains some characters 580 // Delete softkey is displayed when it contains some characters
586 if (data->editor_attr.text.len==0) 581 if (data->editor_attr.text.len==0)
587 { 582 {
588 displaySoftKeys( TxtSoftOptions, TxtSoftBack ); 583 displaySoftKeys( TxtSoftOptions, TxtSoftBack );
589 } 584 }
590 else 585 else
591 { 586 {
592 displaySoftKeys( TxtSoftOptions, TxtDelete ); 587 displaySoftKeys( TxtSoftOptions, TxtDelete );
593 } 588 }
594 } 589 }
595 590
596 } 591 }
597 TRACE_EVENT( "bookSearchWindowCB()-sk display end" ); 592 TRACE_EVENT( "bookSearchWindowCB()-sk display end" );
598 break; 593 break;
599 594
600 default: 595 default:
601 { 596 {
602 /* default is to pass event back for further handling 597 /* default is to pass event back for further handling
603 */ 598 */
604 return MFW_EVENT_PASSED; 599 return MFW_EVENT_PASSED;
605 } 600 }
606 // break; // RAVI 601 // break; // RAVI
607 602
608 } 603 }
609 604
610 /* consume the event 605 /* consume the event
611 */ 606 */
612 return MFW_EVENT_CONSUMED; 607 return MFW_EVENT_CONSUMED;
613 } 608 }
614 609
615 610
616
617
618
619
620
621
622 /******************************************************************************* 611 /*******************************************************************************
623 612
624 $Function: bookSearchKbdCB 613 $Function: bookSearchKbdCB
625 614
626 $Description: Keyboard handler 615 $Description: Keyboard handler
627 616
628 $Returns: MFW_EVENT_CONSUMED always 617 $Returns: MFW_EVENT_CONSUMED always
629 618
630 $Arguments: e, event, k, key handle 619 $Arguments: e, event, k, key handle
631 620
632 *******************************************************************************/ 621 *******************************************************************************/
633 622
634 static int bookSearchKbdCB( MfwEvt e, MfwKbd *k ) 623 static int bookSearchKbdCB( MfwEvt e, MfwKbd *k )
635 { 624 {
636 T_MFW_HND win = mfwParent( mfw_header() ); 625 T_MFW_HND win = mfwParent( mfw_header() );
637 T_MFW_WIN *win_data = ((T_MFW_HDR *) win)->data; 626 T_MFW_WIN *win_data = ((T_MFW_HDR *) win)->data;
638 tBookStandard *data = (tBookStandard *) win_data->user; 627 tBookStandard *data = (tBookStandard *) win_data->user;
639 tMmiPhbData *Current = &data->phbk->current; 628 tMmiPhbData *Current = &data->phbk->current;
640 629
641 TRACE_FUNCTION ("bookSearchKbdCB()"); 630 TRACE_FUNCTION ("bookSearchKbdCB()");
642 631
643 /* SPR#1428 - SH - New editor doesn't require editActivate */ 632 /* SPR#1428 - SH - New editor doesn't require editActivate */
644 #ifndef NEW_EDITOR 633 #ifndef NEW_EDITOR
645 /* Set our editor active if it isn't already 634 /* Set our editor active if it isn't already
646 */ 635 */
647 if ( activeEditor() != data->edt ) 636 if ( activeEditor() != data->edt )
648 editActivate( data->edt, TRUE); 637 editActivate( data->edt, TRUE);
649 #endif 638 #endif
650 639
651 /* Deal with the key and event combinatino 640 /* Deal with the key and event combinatino
652 */ 641 */
653 642
654 643
655 switch( k->code ) 644 switch( k->code )
656 { 645 {
657 case KCD_MNUUP: 646 case KCD_MNUUP:
658 { 647 {
659 /* scroll up 648 /* scroll up
660 */ 649 */
661 SEND_EVENT( data->win, SEARCH_SCROLL_UP, 0, 0 ); 650 SEND_EVENT( data->win, SEARCH_SCROLL_UP, 0, 0 );
662 winShow( data->win ); 651 winShow( data->win );
663 } 652 }
664 break; 653 break;
665 654
666 case KCD_MNUDOWN: 655 case KCD_MNUDOWN:
667 { 656 {
668 /* scroll down 657 /* scroll down
669 */ 658 */
670 SEND_EVENT( data->win, SEARCH_SCROLL_DOWN, 0, 0 ); 659 SEND_EVENT( data->win, SEARCH_SCROLL_DOWN, 0, 0 );
671 winShow( data->win ); 660 winShow( data->win );
672 } 661 }
673 break; 662 break;
674 663
675 664
676 665 case KCD_CALL:
677 case KCD_CALL: 666 if ( data->phbk->fromSMS )
678 if ( data->phbk->fromSMS ) 667 SEND_EVENT( data->phbk->parent_win, SMS_PHBK_NUMBER, PHBK_ID,
679 SEND_EVENT( data->phbk->parent_win, SMS_PHBK_NUMBER, PHBK_ID, 668 (UBYTE *) Current->entry[ Current->selectedName ].number );
680 (UBYTE *) Current->entry[ Current->selectedName ].number ); 669 else if ( data->phbk->fromSMSSC )
681 else if ( data->phbk->fromSMSSC ) 670 SEND_EVENT( data->phbk->parent_win, SMSSC_PHBK_NUMBER, PHBK_ID,
682 SEND_EVENT( data->phbk->parent_win, SMSSC_PHBK_NUMBER, PHBK_ID, 671 (UBYTE *) Current->entry[ Current->selectedName ].number );
683 (UBYTE *) Current->entry[ Current->selectedName ].number ); 672 else
684 else 673 { if (data->phbk->fromDeflect /*SPR 1392, select number don't call it*/ )
685 { if (data->phbk->fromDeflect /*SPR 1392, select number don't call it*/ ) 674 SEND_EVENT( data->phbk->parent_win, DEFLECT_PHBK_NUMBER, PHBK_ID,
686 SEND_EVENT( data->phbk->parent_win, DEFLECT_PHBK_NUMBER, PHBK_ID, 675 (UBYTE *) Current->entry[ Current->selectedName ].number );
687 (UBYTE *) Current->entry[ Current->selectedName ].number ); 676 else
688 else 677 callNumber( Current->entry[ Current->selectedName ].number );
689 callNumber( Current->entry[ Current->selectedName ].number ); 678 }
690 } 679 bookPhonebookDestroy(data->phbk->win);
691 bookPhonebookDestroy(data->phbk->win); 680 break;
692 break;
693 /* JVJ #1743 Right key deletes the characters, HUP destroys the window */ 681 /* JVJ #1743 Right key deletes the characters, HUP destroys the window */
694 #ifdef NEW_EDITOR 682 #ifdef NEW_EDITOR
695 case KCD_HUP: 683 case KCD_HUP:
696 #else /* NEW_EDITOR */ 684 #else /* NEW_EDITOR */
697 case KCD_HUP: 685 case KCD_HUP:
698 #endif /* NEW_EDITOR */ 686 #endif /* NEW_EDITOR */
699 { 687 {
700 if ( data->phbk->fromSMS ){ /* Send empty string so that ptr can be set 0*/ 688 if ( data->phbk->fromSMS ){ /* Send empty string so that ptr can be set 0*/
701 SEND_EVENT( data->phbk->parent_win, SMS_PHBK_NUMBER, PHBK_ID, 689 SEND_EVENT( data->phbk->parent_win, SMS_PHBK_NUMBER, PHBK_ID,
702 "" ); 690 "" );
703 bookPhonebookDestroy(data->phbk->win); 691 bookPhonebookDestroy(data->phbk->win);
704 } 692 }
705 else if ( data->phbk->fromSMSSC ){ 693 else if ( data->phbk->fromSMSSC ){
706 SEND_EVENT( data->phbk->parent_win, SMSSC_PHBK_NUMBER, PHBK_ID, 694 SEND_EVENT( data->phbk->parent_win, SMSSC_PHBK_NUMBER, PHBK_ID,
707 NULL ); 695 NULL );
708 bookPhonebookDestroy(data->phbk->win); 696 bookPhonebookDestroy(data->phbk->win);
709 } 697 }
710 /* Marcus (mk): Issue 1010: 2002-08-22: Start */ 698 /* Marcus (mk): Issue 1010: 2002-08-22: Start */
711 else if (data->phbk->fromDivert) 699 else if (data->phbk->fromDivert)
712 { 700 {
713 bookPhonebookDestroy(data->phbk->win); 701 bookPhonebookDestroy(data->phbk->win);
714 } 702 }
715 else if (data->phbk->fromDeflect)/*MC SPR 1392*/ 703 else if (data->phbk->fromDeflect)/*MC SPR 1392*/
716 { /*Send empty string so that pointer to this window can be set to 0*/ 704 { /*Send empty string so that pointer to this window can be set to 0*/
717 SEND_EVENT( data->phbk->parent_win, DEFLECT_PHBK_NUMBER, PHBK_ID,""); 705 SEND_EVENT( data->phbk->parent_win, DEFLECT_PHBK_NUMBER, PHBK_ID,"");
718 bookPhonebookDestroy(data->phbk->win); 706 bookPhonebookDestroy(data->phbk->win);
719 } 707 }
720 //CRR: 25302 - xpradipg 10 Nov 2004 708 //CRR: 25302 - xpradipg 10 Nov 2004
721 //also handle if invoked by MMS/EMS 709 //also handle if invoked by MMS/EMS
722 else if ( data->phbk->fromMmsEms ) 710 else if ( data->phbk->fromMmsEms )
723 { /* Send empty string so that ptr can be set 0*/ 711 { /* Send empty string so that ptr can be set 0*/
724 SEND_EVENT( data->phbk->parent_win, MMS_EMS_PHBK_NUMBER, PHBK_ID,"" ); 712 SEND_EVENT( data->phbk->parent_win, MMS_EMS_PHBK_NUMBER, PHBK_ID,"" );
725 bookPhonebookDestroy(data->phbk->win); 713 bookPhonebookDestroy(data->phbk->win);
726 } 714 }
727 /* Marcus (mk): Issue 1010: 2002-08-22: End */ 715 /* Marcus (mk): Issue 1010: 2002-08-22: End */
728 else 716 else
729 bookSearchDestroy(data->win); 717 bookSearchDestroy(data->win);
730 718
731 } 719 }
732 break; 720 break;
733 721
734 case KCD_MNUSELECT: 722 case KCD_MNUSELECT:
735 case KCD_LEFT: 723 case KCD_LEFT:
736 724
737 { 725 {
738 /* if in SMS send the event to it 726 /* if in SMS send the event to it
739 */ 727 */
740 if ( data->phbk->fromSMS ) 728 if ( data->phbk->fromSMS )
741 { SEND_EVENT( data->phbk->parent_win, SMS_PHBK_NUMBER, PHBK_ID /*MZ 6/2/01 */, 729 { SEND_EVENT( data->phbk->parent_win, SMS_PHBK_NUMBER, PHBK_ID /*MZ 6/2/01 */,
742 (UBYTE *) Current->entry[ Current->selectedName ].number ); 730 (UBYTE *) Current->entry[ Current->selectedName ].number );
743 bookPhonebookDestroy(data->phbk->win); 731 bookPhonebookDestroy(data->phbk->win);
744 } 732 }
745 else if ( data->phbk->fromSMSSC ) 733 else if ( data->phbk->fromSMSSC )
746 { SEND_EVENT( data->phbk->parent_win, SMSSC_PHBK_NUMBER, PHBK_ID /*MZ 6/2/01 */, 734 { SEND_EVENT( data->phbk->parent_win, SMSSC_PHBK_NUMBER, PHBK_ID /*MZ 6/2/01 */,
747 (UBYTE *) Current->entry[ Current->selectedName ].number ); 735 (UBYTE *) Current->entry[ Current->selectedName ].number );
748 bookPhonebookDestroy(data->phbk->win); 736 bookPhonebookDestroy(data->phbk->win);
749 } 737 }
750 else if(data->phbk->fromDivert ) //MZ 26/02/01 check for divert If in Divert send event. 738 else if(data->phbk->fromDivert ) //MZ 26/02/01 check for divert If in Divert send event.
751 { 739 {
752 SEND_EVENT( data->phbk->parent_win, DIVERT_PHBK_NUMBER, PHBK_ID /*MZ 28/2/01 */, 740 SEND_EVENT( data->phbk->parent_win, DIVERT_PHBK_NUMBER, PHBK_ID /*MZ 28/2/01 */,
753 (UBYTE *) Current->entry[ Current->selectedName ].number ); 741 (UBYTE *) Current->entry[ Current->selectedName ].number );
754 bookPhonebookDestroy(data->phbk->win); 742 bookPhonebookDestroy(data->phbk->win);
755 } 743 }
756 else if(data->phbk->fromDeflect ) /*SPR 1392*/ 744 else if(data->phbk->fromDeflect ) /*SPR 1392*/
757 { 745 {
758 TRACE_EVENT_P1("<< API deflection no. = %s", (char*) Current->entry[ Current->selectedName ].number); 746 TRACE_EVENT_P1("<< API deflection no. = %s", (char*) Current->entry[ Current->selectedName ].number);
759 SEND_EVENT( data->phbk->parent_win, DEFLECT_PHBK_NUMBER, PHBK_ID, 747 SEND_EVENT( data->phbk->parent_win, DEFLECT_PHBK_NUMBER, PHBK_ID,
760 (UBYTE *) Current->entry[ Current->selectedName ].number ); 748 (UBYTE *) Current->entry[ Current->selectedName ].number );
761 bookPhonebookDestroy(data->phbk->win); 749 bookPhonebookDestroy(data->phbk->win);
762 } 750 }
763 //CRR: 25302 - xpradipg 10 Nov 2004 751 //CRR: 25302 - xpradipg 10 Nov 2004
764 //send the number to the MMS/EMS window 752 //send the number to the MMS/EMS window
765 else if(data->phbk->fromMmsEms) 753 else if(data->phbk->fromMmsEms)
766 { 754 {
767 TRACE_EVENT_P1("the value if win from MMS is %x",data->phbk->parent_win); 755 TRACE_EVENT_P1("the value if win from MMS is %x",data->phbk->parent_win);
768 SEND_EVENT( data->phbk->parent_win, MMS_EMS_PHBK_NUMBER,PHBK_ID,(void *) Current->entry[ Current->selectedName ].number ); 756 SEND_EVENT( data->phbk->parent_win, MMS_EMS_PHBK_NUMBER,PHBK_ID,(void *) Current->entry[ Current->selectedName ].number );
769 bookPhonebookDestroy(data->phbk->win); 757 bookPhonebookDestroy(data->phbk->win);
770 } 758 }
771 else 759 else
772 /* Start a new options menu 760 /* Start a new options menu
773 */ 761 */
774 /*check for UPN SPR 1327*/ 762 /*check for UPN SPR 1327*/
775 if (Current->status.book != PHB_UPN) 763 if (Current->status.book != PHB_UPN)
776 data->phbk->menu_options_win = bookMenuStart( data->phbk->win, bookNameMenuAttributes(),0); 764 data->phbk->menu_options_win = bookMenuStart( data->phbk->win, bookNameMenuAttributes(),0);
777 else 765 else
778 data->phbk->menu_options_win = bookMenuStart( data->phbk->win, bookUPNMenuAttributes(),0); 766 data->phbk->menu_options_win = bookMenuStart( data->phbk->win, bookUPNMenuAttributes(),0);
779 } 767 }
780 break; 768 break;
781 769
782 /* JVJ #1743 Right key deletes search character*/ 770 /* JVJ #1743 Right key deletes search character*/
783 #ifdef NEW_EDITOR 771 #ifdef NEW_EDITOR
784 case KCD_RIGHT: 772 case KCD_RIGHT:
785 #else /* NEW_EDITOR */ 773 #else /* NEW_EDITOR */
786 case KCD_HUP: 774 case KCD_HUP:
787 #endif /* NEW_EDITOR */ 775 #endif /* NEW_EDITOR */
788 { 776 {
789 777
790 778 /* If we have any characters in the buffer, step back, otherwise
791 779 destroy the window
792 /* If we have any characters in the buffer, step back, otherwise 780 */
793 destroy the window 781
794 */ 782 if ( data->edtBuf[0])
795 783 {
796 if ( data->edtBuf[0]) 784
797 { 785 // Oct 26, 2004 REF: CRR 25354 xkundadu
798 786 // Description: Phonebook: After entering precise name to search and then
799 // Oct 26, 2004 REF: CRR 25354 xkundadu 787 // trying to delete using RSK, first character is not deleted.
800 // Description: Phonebook: After entering precise name to search and then 788 // Fix: If only one character is present in the editor and delete key is
801 // trying to delete using RSK, first character is not deleted. 789 // pressed, delete the editor buffer and update the editor view.
802 // Fix: If only one character is present in the editor and delete key is 790
803 // pressed, delete the editor buffer and update the editor view. 791 // Find out the length of the buffer.
804 792 if(strlen((char*)data->edtBuf) == 1)
805 // Find out the length of the buffer. 793 {
806 if(strlen((char*)data->edtBuf) == 1) 794 //If only one character is present, delete and set the buffer
807 { 795 //to NULL.
808 //If only one character is present, delete and set the buffer 796 data->edtBuf[0] = '\0';
809 //to NULL. 797 data->editor_attr.text.len = 0;
810 data->edtBuf[0] = '\0'; 798 //Move the cursor accordingly.
811 data->editor_attr.text.len = 0; 799 ATB_edit_MoveCursor(data->editor, ctrlLeft, TRUE);
812 //Move the cursor accordingly. 800 data->editor->update = ED_UPDATE_TRIVIAL;
813 ATB_edit_MoveCursor(data->editor, ctrlLeft, TRUE); 801 SEND_EVENT( data->win, SEARCH_STRING, 0, 0);
814 data->editor->update = ED_UPDATE_TRIVIAL; 802 //Update the window.
815 SEND_EVENT( data->win, SEARCH_STRING, 0, 0); 803 winShow( data->win );
816 //Update the window. 804 break;
817 winShow( data->win ); 805 }
818 break; 806
819 } 807 /* SPR#1428 - SH - New Editor changes */
820
821 /* SPR#1428 - SH - New Editor changes */
822 #ifdef NEW_EDITOR 808 #ifdef NEW_EDITOR
823 /* SPR#2174 - SH - If multitap is in progress, delete current character 809 /* SPR#2174 - SH - If multitap is in progress, delete current character
824 * rather than previous character */ 810 * rather than previous character */
825 811
826 if (data->editor->multitap) 812 if (data->editor->multitap)
827 { 813 {
828 AUI_entry_StopMultitap(data->entry_data); /* Cancel multitap */ 814 AUI_entry_StopMultitap(data->entry_data); /* Cancel multitap */
829 ATB_edit_DeleteRight(data->editor, TRUE); /* SPR#2342 - SH */ 815 ATB_edit_DeleteRight(data->editor, TRUE); /* SPR#2342 - SH */
830 } 816 }
831 else 817 else
832 { 818 {
833 ATB_edit_DeleteLeft(data->editor, TRUE); /* SPR#2342 - SH */ 819 ATB_edit_DeleteLeft(data->editor, TRUE); /* SPR#2342 - SH */
834 } 820 }
835 #else /* NEW_EDITOR */ 821 #else /* NEW_EDITOR */
836 edtChar( data->edt,ecBack ); 822 edtChar( data->edt,ecBack );
837 #endif /* NEW_EDITOR */ 823 #endif /* NEW_EDITOR */
838 824
839 SEND_EVENT( data->win, SEARCH_STRING, 0, 0 ); 825 SEND_EVENT( data->win, SEARCH_STRING, 0, 0 );
840 winShow( data->win ); 826 winShow( data->win );
841 } 827 }
842 else 828 else
843 { 829 {
844 /*API - 12/08/03 - CQ11268 - Add this so the phonebbok is destoryed on right key press*/ 830 /*API - 12/08/03 - CQ11268 - Add this so the phonebbok is destoryed on right key press*/
845 if ( data->phbk->fromSMS ) 831 if ( data->phbk->fromSMS )
846 { /* Send empty string so that ptr can be set 0*/ 832 { /* Send empty string so that ptr can be set 0*/
847 bookPhonebookDestroy(data->phbk->win); 833 bookPhonebookDestroy(data->phbk->win);
848 } 834 }
849 else if ( data->phbk->fromSMSSC ) 835 else if ( data->phbk->fromSMSSC )
850 { 836 {
851 bookPhonebookDestroy(data->phbk->win); 837 bookPhonebookDestroy(data->phbk->win);
852 } 838 }
853 /* Marcus (mk): Issue 1010: 2002-08-22: Start */ 839 /* Marcus (mk): Issue 1010: 2002-08-22: Start */
854 else if (data->phbk->fromDivert) 840 else if (data->phbk->fromDivert)
855 { 841 {
856 bookPhonebookDestroy(data->phbk->win); 842 bookPhonebookDestroy(data->phbk->win);
857 } 843 }
858 else if (data->phbk->fromDeflect)/*MC SPR 1392*/ 844 else if (data->phbk->fromDeflect)/*MC SPR 1392*/
859 { /*Send empty string so that pointer to this window can be set to 0*/ 845 { /*Send empty string so that pointer to this window can be set to 0*/
860 bookPhonebookDestroy(data->phbk->win); 846 bookPhonebookDestroy(data->phbk->win);
861 } 847 }
862 //CRR: 25302 - xpradipg 10 Nov 2004 848 //CRR: 25302 - xpradipg 10 Nov 2004
863 //Handle if invoked from MMS/EMS 849 //Handle if invoked from MMS/EMS
864 else if(data->phbk->fromMmsEms) 850 else if(data->phbk->fromMmsEms)
865 { 851 {
866 bookPhonebookDestroy(data->phbk->win); 852 bookPhonebookDestroy(data->phbk->win);
867 } 853 }
868 /* Marcus (mk): Issue 1010: 2002-08-22: End */ 854 /* Marcus (mk): Issue 1010: 2002-08-22: End */
869 else 855 else
870 bookSearchDestroy(data->win); 856 bookSearchDestroy(data->win);
871 /*API - 12/08/03 - CQ11268 - END*/ 857 /*API - 12/08/03 - CQ11268 - END*/
872 } 858 }
873 } 859 }
874 break; 860 break;
875 861
876 case KCD_HASH: 862 case KCD_HASH:
877 { 863 {
878 864
879 { 865 {
880 /* SPR#1428 - SH - New Editor changes */ 866 /* SPR#1428 - SH - New Editor changes */
881 #ifdef NEW_EDITOR 867 #ifdef NEW_EDITOR
882 ATB_edit_DeleteLeft( data->editor, TRUE); /* SPR#2342 - SH */ 868 ATB_edit_DeleteLeft( data->editor, TRUE); /* SPR#2342 - SH */
883 #else /* NEW_EDITOR */ 869 #else /* NEW_EDITOR */
884 edtChar( data->edt,ecBack ); 870 edtChar( data->edt,ecBack );
885 #endif /* NEW_EDITOR */ 871 #endif /* NEW_EDITOR */
886 } 872 }
887 873
888 /*NM, p016 874 /*NM, p016
889 even updating when deleting characters 875 even updating when deleting characters
890 */ 876 */
891 SEND_EVENT( data->win, SEARCH_STRING, 0, 0 ); 877 SEND_EVENT( data->win, SEARCH_STRING, 0, 0 );
892 winShow( data->win ); 878 winShow( data->win );
893 } 879 }
894 break; 880 break;
895 881
896 default: 882 default:
897 { 883 {
898 884
899 { 885 {
900 /* SPR#1428 - SH - New Editor changes */ 886 /* SPR#1428 - SH - New Editor changes */
901 #ifdef NEW_EDITOR 887 #ifdef NEW_EDITOR
902 AUI_entry_EventKey( data->entry_data, e, k ); 888 AUI_entry_EventKey( data->entry_data, e, k );
903 889
904 /* send the search event to ourselves, 890 /* send the search event to ourselves,
905 * but only when a character is finished in multi-tap 891 * but only when a character is finished in multi-tap
906 */ 892 */
907 if (!data->editor->multitap) 893 if (!data->editor->multitap)
908 { 894 {
909 SEND_EVENT( data->win, SEARCH_STRING, 0, 0 ); 895 SEND_EVENT( data->win, SEARCH_STRING, 0, 0 );
910 } 896 }
911 #else /* NEW_EDITOR */ 897 #else /* NEW_EDITOR */
912 editEventKey( e, k ); 898 editEventKey( e, k );
913 /* send the search event to ourselves, 899 /* send the search event to ourselves,
914 */ 900 */
915 SEND_EVENT( data->win, SEARCH_STRING, 0, 0 ); 901 SEND_EVENT( data->win, SEARCH_STRING, 0, 0 );
916 #endif /* NEW_EDITOR */ 902 #endif /* NEW_EDITOR */
917 winShow( data->win ); 903 winShow( data->win );
918 } 904 }
919 } 905 }
920 break; 906 break;
921 907
922 } 908 }
923 909
924 /* always consume the event 910 /* always consume the event
925 */ 911 */
926 return MFW_EVENT_CONSUMED; 912 return MFW_EVENT_CONSUMED;
927 } 913 }
928 914
929 915
930
931
932
933
934
935 /******************************************************************************* 916 /*******************************************************************************
936 917
937 $Function: bookSearchKbdLongCB 918 $Function: bookSearchKbdLongCB
938 919
939 $Description: long keypress event handler, handles long clear event only 920 $Description: long keypress event handler, handles long clear event only
940 921
941 $Returns: MFW_EVENT_CONSUMED always 922 $Returns: MFW_EVENT_CONSUMED always
942 923
943 $Arguments: e, event, k, key handle 924 $Arguments: e, event, k, key handle
944 925
945 *******************************************************************************/ 926 *******************************************************************************/
946 927
947 static int bookSearchKbdLongCB( MfwEvt e, MfwKbd *k ) 928 static int bookSearchKbdLongCB( MfwEvt e, MfwKbd *k )
948 { 929 {
949 T_MFW_HND win = mfwParent( mfw_header() ); 930 T_MFW_HND win = mfwParent( mfw_header() );
950 T_MFW_WIN *win_data = ((T_MFW_HDR *) win)->data; 931 T_MFW_WIN *win_data = ((T_MFW_HDR *) win)->data;
951 tBookStandard *data = (tBookStandard *) win_data->user; 932 tBookStandard *data = (tBookStandard *) win_data->user;
952 933
953 TRACE_FUNCTION ("bookSearchKbdLongCB()"); 934 TRACE_FUNCTION ("bookSearchKbdLongCB()");
954 935
955 /* deal with the clear event 936 /* deal with the clear event
956 */ 937 */
957 if ( ( e & KEY_CLEAR ) && ( e & KEY_LONG ) ) 938 if ( ( e & KEY_CLEAR ) && ( e & KEY_LONG ) )
958 { 939 {
959 bookSearchDestroy( win ); 940 bookSearchDestroy( win );
960 data->phbk->search_win = 0; 941 data->phbk->search_win = 0;
961 } 942 }
962 943
963 /* consume the event 944 /* consume the event
964 */ 945 */
965 return MFW_EVENT_CONSUMED; 946 return MFW_EVENT_CONSUMED;
966 } 947 }
967 948
968 //Jan 22, 2006 REF: OMAPS00061930 x0039928 949 //Jan 22, 2006 REF: OMAPS00061930 x0039928
969 // Fix : Add a temporary timer handle for future reference. 950 // Fix : Add a temporary timer handle for future reference.
970 T_MFW_HND PhbSearchTim; 951 T_MFW_HND PhbSearchTim;
971 952
972 /******************************************************************************* 953 /*******************************************************************************
973 954
974 $Function: bookSearchTimCB 955 $Function: bookSearchTimCB
975 956
976 $Description: Callback function for the Phonebook timer. 957 $Description: Callback function for the Phonebook timer.
977 958
978 $Returns: None 959 $Returns: None
979 960
980 $Arguments: window handle event, timer control block 961 $Arguments: window handle event, timer control block
981 962
982 *******************************************************************************/ 963 *******************************************************************************/
983 964
984 static int bookSearchTimCB (MfwEvt event, MfwTim *timer) 965 static int bookSearchTimCB (MfwEvt event, MfwTim *timer)
985 { 966 {
986 T_MFW_HND win = mfwParent( mfw_header() ); 967 T_MFW_HND win = mfwParent( mfw_header() );
987 T_MFW_WIN *win_data = ((T_MFW_HDR *) win)->data; 968 T_MFW_WIN *win_data = ((T_MFW_HDR *) win)->data;
988 tBookStandard *data = (tBookStandard *) win_data->user; 969 tBookStandard *data = (tBookStandard *) win_data->user;
989 970
990 /* x0045876, 14-Aug-2006 (WR - "Current" was declared but never referenced) */ 971 /* x0045876, 14-Aug-2006 (WR - "Current" was declared but never referenced) */
991 /* tMmiPhbData *Current = &data->phbk->current; */ 972 /* tMmiPhbData *Current = &data->phbk->current; */
992 TRACE_FUNCTION ("bookSearchTimCB()"); 973 TRACE_FUNCTION ("bookSearchTimCB()");
993 974
994 SEND_EVENT( data->win, SEARCH_STRING, 1, 0); 975 SEND_EVENT( data->win, SEARCH_STRING, 1, 0);
995 winShow( data->win ); 976 winShow( data->win );
996 return MFW_EVENT_CONSUMED; 977 return MFW_EVENT_CONSUMED;
997 } 978 }
998 979
999 980
1000 /******************************************************************************* 981 /*******************************************************************************
1001 982
1002 $Function: bookSearchCreate 983 $Function: bookSearchCreate
1003 984
1004 $Description: Create the search window 985 $Description: Create the search window
1005 986
1006 $Returns: handle of window or NULL if error 987 $Returns: handle of window or NULL if error
1007 988
1008 $Arguments: parent, handle of parent window 989 $Arguments: parent, handle of parent window
1009 990
1010 *******************************************************************************/ 991 *******************************************************************************/
1011 992
1012 static T_MFW_HND bookSearchCreate( MfwHnd parent ) 993 static T_MFW_HND bookSearchCreate( MfwHnd parent )
1013 { 994 {
1014 T_MFW_WIN *parent_win_data = ( (T_MFW_HDR *) parent )->data; 995 T_MFW_WIN *parent_win_data = ( (T_MFW_HDR *) parent )->data;
1015 T_phbk *phbk = (T_phbk *)parent_win_data->user; 996 T_phbk *phbk = (T_phbk *)parent_win_data->user;
1016 T_MFW_WIN *win_data; 997 T_MFW_WIN *win_data;
1017 tBookStandard *data; 998 tBookStandard *data;
1018 // int i; // RAVI 999 // int i; // RAVI
1019 // char debug[50]; // RAVI 1000 // char debug[50]; // RAVI
1020 1001
1021 TRACE_FUNCTION ("bookSearchCreate()"); 1002 TRACE_FUNCTION ("bookSearchCreate()");
1022 1003
1023 /* allocate memory for our control block 1004 /* allocate memory for our control block
1024 */ 1005 */
1025 if ( ( data = (tBookStandard *) ALLOC_MEMORY( sizeof( tBookStandard ) ) ) == NULL ) 1006 if ( ( data = (tBookStandard *) ALLOC_MEMORY( sizeof( tBookStandard ) ) ) == NULL )
1026 return NULL; 1007 return NULL;
1027 1008
1028 /*SPR 2123, MC allocate memory for phonebook list*/ 1009 /*SPR 2123, MC allocate memory for phonebook list*/
1029 if (create_mmi_phonebook_names_list() == NULL) 1010 if (create_mmi_phonebook_names_list() == NULL)
1030 return NULL; 1011 return NULL;
1031 1012
1032 /* Create the window if we can 1013 /* Create the window if we can
1033 */ 1014 */
1034 if ( ( data->win = win_create( parent, 0, E_WIN_VISIBLE, (T_MFW_CB) bookSearchWindowCB ) ) == NULL ) 1015 if ( ( data->win = win_create( parent, 0, E_WIN_VISIBLE, (T_MFW_CB) bookSearchWindowCB ) ) == NULL )
1035 { 1016 {
1036 FREE_MEMORY( (void *) data, sizeof( tBookStandard ) ); 1017 FREE_MEMORY( (void *) data, sizeof( tBookStandard ) );
1037 return NULL; 1018 return NULL;
1038 } 1019 }
1039 1020
1040 /* Okay, we have created the control block and the window, so 1021 /* Okay, we have created the control block and the window, so
1041 we now need to configure the dialog and data pointers 1022 we now need to configure the dialog and data pointers
1042 */ 1023 */
1043 data->mmi_control.dialog = (T_DIALOG_FUNC) bookSearchDialog; 1024 data->mmi_control.dialog = (T_DIALOG_FUNC) bookSearchDialog;
1044 data->mmi_control.data = data; 1025 data->mmi_control.data = data;
1045 win_data = ((T_MFW_HDR *)data->win)->data; 1026 win_data = ((T_MFW_HDR *)data->win)->data;
1046 win_data->user = (void *) data; 1027 win_data->user = (void *) data;
1047 data->phbk = phbk; 1028 data->phbk = phbk;
1048 data->parent_win = parent; 1029 data->parent_win = parent;
1049 1030
1050 /* create keyboards and menus for our window 1031 /* create keyboards and menus for our window
1051 */ 1032 */
1052 data->kbd = kbdCreate( data->win, KEY_ALL, (MfwCb) bookSearchKbdCB ); 1033 data->kbd = kbdCreate( data->win, KEY_ALL, (MfwCb) bookSearchKbdCB );
1053 data->kbd_long = kbdCreate( data->win, KEY_ALL | KEY_LONG, (MfwCb) bookSearchKbdLongCB ); 1034 data->kbd_long = kbdCreate( data->win, KEY_ALL | KEY_LONG, (MfwCb) bookSearchKbdLongCB );
1054 //Jan 22, 2006 REF: OMAPS00061930 x0039928 1035 //Jan 22, 2006 REF: OMAPS00061930 x0039928
1055 // Fix: Create a timer and assign to PhbSearchTim 1036 // Fix: Create a timer and assign to PhbSearchTim
1056 data->tim = timCreate(data->win, 1000, (MfwCb)bookSearchTimCB); 1037 data->tim = timCreate(data->win, 1000, (MfwCb)bookSearchTimCB);
1057 data->menu = mnuCreate( data->win,MmiBookMenuDetailsList() , 0, 0 ); 1038 data->menu = mnuCreate( data->win,MmiBookMenuDetailsList() , 0, 0 );
1058 PhbSearchTim = data->tim; 1039 PhbSearchTim = data->tim;
1059 mnuLang (data->menu,0); 1040 mnuLang (data->menu,0);
1060 1041
1061 /* 1945 MZ Initialise the edtBuf */ 1042 /* 1945 MZ Initialise the edtBuf */
1062 memset(data->edtBuf,'\0', STANDARD_EDITOR_SIZE ); 1043 memset(data->edtBuf,'\0', STANDARD_EDITOR_SIZE );
1063 1044
1064 { 1045 {
1065 1046
1066 /* SPR#1428 - SH - New Editor changes */ 1047 /* SPR#1428 - SH - New Editor changes */
1067 #ifdef NEW_EDITOR 1048 #ifdef NEW_EDITOR
1068 /*SPR 2233, make sure editor only displays lower-case chars*/ 1049 /*SPR 2233, make sure editor only displays lower-case chars*/
1069 AUI_edit_SetAttr(&data->editor_attr, BOOKSEARCH_EDITOR, COLOUR_EDITOR_XX,EDITOR_FONT, 1050 AUI_edit_SetAttr(&data->editor_attr, BOOKSEARCH_EDITOR, COLOUR_EDITOR_XX,EDITOR_FONT,
1070 ED_MODE_ALPHA | ED_MODE_FORMATTED, ED_CURSOR_BAR, ATB_DCS_ASCII, (UBYTE*) data->edtBuf, MAX_SEARCH_CHAR); 1051 ED_MODE_ALPHA | ED_MODE_FORMATTED, ED_CURSOR_BAR, ATB_DCS_ASCII, (UBYTE*) data->edtBuf, MAX_SEARCH_CHAR);
1071 data->editor_attr.FormatString = "*a"; 1052 data->editor_attr.FormatString = "*a";
1072 data->editor = ATB_edit_Create( &data->editor_attr, 0 ); 1053 data->editor = ATB_edit_Create( &data->editor_attr, 0 );
1073 data->entry_data = AUI_entry_Create(data->win, data->editor, SEARCH_REDRAW); 1054 data->entry_data = AUI_entry_Create(data->win, data->editor, SEARCH_REDRAW);
1074 /*SPR2233 end*/ 1055 /*SPR2233 end*/
1075 ATB_edit_Init(data->editor); 1056 ATB_edit_Init(data->editor);
1076 #else /* NEW_EDITOR */ 1057 #else /* NEW_EDITOR */
1077 bookSetEditAttributes(BOOKSEARCH_EDITOR, COLOUR_EDITOR_XX, 0, edtCurBar1, 0, 1058 bookSetEditAttributes(BOOKSEARCH_EDITOR, COLOUR_EDITOR_XX, 0, edtCurBar1, 0,
1078 (char *) data->edtBuf, MAX_SEARCH_CHAR, &data->attr ); 1059 (char *) data->edtBuf, MAX_SEARCH_CHAR, &data->attr );
1079 data->edt = edtCreate( data->win, &data->attr, 0, 0 ); 1060 data->edt = edtCreate( data->win, &data->attr, 0, 0 );
1080 #endif /* NEW_EDITOR */ 1061 #endif /* NEW_EDITOR */
1081 } 1062 }
1082 1063
1083 1064
1084 /* allow the window and menu to be created 1065 /* allow the window and menu to be created
1085 */ 1066 */
1086 mnuUnhide(data->menu); 1067 mnuUnhide(data->menu);
1087 winShow(data->win); 1068 winShow(data->win);
1088 1069
1089 /* And return the handle of the newly created window 1070 /* And return the handle of the newly created window
1090 */ 1071 */
1091 return data->win; 1072 return data->win;
1092 } 1073 }
1093 1074
1094 1075
1095
1096 /******************************************************************************* 1076 /*******************************************************************************
1097 1077
1098 Public Methods 1078 Public Methods
1099 1079
1100 *******************************************************************************/ 1080 *******************************************************************************/
1101 1081
1102 1082
1103
1104
1105 /******************************************************************************* 1083 /*******************************************************************************
1106 1084
1107 $Function: bookSearchStart 1085 $Function: bookSearchStart
1108 1086
1109 $Description: Starts the search window 1087 $Description: Starts the search window
1110 1088
1111 $Returns: handle of newly created window, or NULL if error 1089 $Returns: handle of newly created window, or NULL if error
1112 1090
1113 $Arguments: parent, handle of parent window 1091 $Arguments: parent, handle of parent window
1114 1092
1115 *******************************************************************************/ 1093 *******************************************************************************/
1116 1094
1117 T_MFW_HND bookSearchStart( MfwHnd parent ) 1095 T_MFW_HND bookSearchStart( MfwHnd parent )
1118 { 1096 {
1119 T_MFW_HND win; 1097 T_MFW_HND win;
1120 T_MFW_WIN *win_data; 1098 T_MFW_WIN *win_data;
1121 tBookStandard *data; 1099 tBookStandard *data;
1122 MfwMnu *mnu; 1100 MfwMnu *mnu;
1123 tMmiPhbData *Current; 1101 tMmiPhbData *Current;
1124 1102
1125 /* if the phone book is still loading, we can't do anything 1103 /* if the phone book is still loading, we can't do anything
1126 with it, so return a NULL, after showing an information 1104 with it, so return a NULL, after showing an information
1127 dialog 1105 dialog
1128 */ 1106 */
1129 if ( phb_get_mode() == PHB_LOADING ) 1107 if ( phb_get_mode() == PHB_LOADING )
1130 { 1108 {
1131 bookShowInformation( idle_get_window(), TxtPleaseWait ,NULL, NULL ); 1109 bookShowInformation( idle_get_window(), TxtPleaseWait ,NULL, NULL );
1132 return NULL; 1110 return NULL;
1133 } 1111 }
1134 1112
1135 /* try to create the window 1113 /* try to create the window
1136 */ 1114 */
1137 if ( ( win = bookSearchCreate( parent ) ) == NULL ) 1115 if ( ( win = bookSearchCreate( parent ) ) == NULL )
1138 return NULL; 1116 return NULL;
1139 1117
1140 /* having created the window, we now need to initialise it to 1118 /* having created the window, we now need to initialise it to
1141 sensible data 1119 sensible data
1142 */ 1120 */
1143 win_data = ( (T_MFW_HDR *) win)->data; 1121 win_data = ( (T_MFW_HDR *) win)->data;
1144 data = (tBookStandard *) win_data->user; 1122 data = (tBookStandard *) win_data->user;
1145 Current = &data->phbk->current; 1123 Current = &data->phbk->current;
1146 1124
1147 /* establish the status of the phone book 1125 /* establish the status of the phone book
1148 */ 1126 */
1149 if ( ( Current->status.book != PHB_UPN ) && ( Current->status.book != PHB_SDN ) ) 1127 if ( ( Current->status.book != PHB_UPN ) && ( Current->status.book != PHB_SDN ) )
1150 Current->status.book = bookActiveBook(READ); 1128 Current->status.book = bookActiveBook(READ);
1151 bookGetCurrentStatus( &Current->status ); 1129 bookGetCurrentStatus( &Current->status );
1152 1130
1153 /* try to establish if we have information in the phone book 1131 /* try to establish if we have information in the phone book
1154 */ 1132 */
1155 Current->index = 1; 1133 Current->index = 1;
1156 Current->selectedName = 0; 1134 Current->selectedName = 0;
1157 bookFindName( MAX_SEARCH_NAME, Current ); 1135 bookFindName( MAX_SEARCH_NAME, Current );
1158 1136
1159 if ( ! Current->index ) 1137 if ( ! Current->index )
1160 { 1138 {
1161 bookSearchDestroy( win ); 1139 bookSearchDestroy( win );
1162 bookShowInformation( idle_get_window(), TxtEmptyList, NULL, NULL ); 1140 bookShowInformation( idle_get_window(), TxtEmptyList, NULL, NULL );
1163 return NULL; 1141 return NULL;
1164 } 1142 }
1165 1143
1166 /* clear the edit buffer prior to displaying the editor and menus 1144 /* clear the edit buffer prior to displaying the editor and menus
1167 */ 1145 */
1168 1146
1169 1147 memset( data->edtBuf, '\0', sizeof( data->edtBuf ) );
1170 memset( data->edtBuf, '\0', sizeof( data->edtBuf ) ); 1148 /* SPR#1428 - SH - New Editor: don't need editActivate */
1171 /* SPR#1428 - SH - New Editor: don't need editActivate */
1172 #ifndef NEW_EDITOR 1149 #ifndef NEW_EDITOR
1173 editActivate( data->edt, true ); 1150 editActivate( data->edt, true );
1174 #endif /* NEW_EDITOR */ 1151 #endif /* NEW_EDITOR */
1175 1152
1176 mnu = (MfwMnu *) mfwControl( data->menu ); 1153 mnu = (MfwMnu *) mfwControl( data->menu );
1177 mnu->lCursor[mnu->level] = Current->selectedName; 1154 mnu->lCursor[mnu->level] = Current->selectedName;
1178 winShow(data->win); 1155 winShow(data->win);
1179 1156
1180 /* return the handle to the newly created window 1157 /* return the handle to the newly created window
1181 */ 1158 */
1182 return win; 1159 return win;
1183 } 1160 }
1184 1161
1185 1162
1186
1187
1188 /******************************************************************************* 1163 /*******************************************************************************
1189 1164
1190 $Function: bookSearchDestroy 1165 $Function: bookSearchDestroy
1191 1166
1192 $Description: Destroy the search window 1167 $Description: Destroy the search window
1193 1168
1194 $Returns: None 1169 $Returns: None
1195 1170
1196 $Arguments: Window, handle of the window to be destroyed 1171 $Arguments: Window, handle of the window to be destroyed
1197 1172
1198 *******************************************************************************/ 1173 *******************************************************************************/
1199 1174
1200 void bookSearchDestroy( MfwHnd window ) 1175 void bookSearchDestroy( MfwHnd window )
1201 { 1176 {
1202 T_MFW_WIN *win = ((T_MFW_HDR *) window)->data; 1177 T_MFW_WIN *win = ((T_MFW_HDR *) window)->data;
1203 tBookStandard *data = (tBookStandard *) win->user; 1178 tBookStandard *data = (tBookStandard *) win->user;
1204 1179
1205 TRACE_FUNCTION( "bookSearchDestroy()" ); 1180 TRACE_FUNCTION( "bookSearchDestroy()" );
1206 1181
1207 /* Only destroy if the data is valid 1182 /* Only destroy if the data is valid
1208 */ 1183 */
1209 if ( data ) 1184 if ( data )
1210 { 1185 {
1211 /* SPR#1428 - SH - New Editor changes */ 1186 /* SPR#1428 - SH - New Editor changes */
1212 #ifdef NEW_EDITOR 1187 #ifdef NEW_EDITOR
1213 /* Editor now not automatically destroyed by winDelete, 1188 /* Editor now not automatically destroyed by winDelete,
1214 * so destroy it here. */ 1189 * so destroy it here. */
1215 if (data->entry_data) 1190 if (data->entry_data)
1216 { 1191 {
1217 AUI_entry_Destroy(data->entry_data); 1192 AUI_entry_Destroy(data->entry_data);
1218 data->entry_data = 0; 1193 data->entry_data = 0;
1219 } 1194 }
1220 if (data->editor) 1195 if (data->editor)
1221 { 1196 {
1222 ATB_edit_Destroy(data->editor); 1197 ATB_edit_Destroy(data->editor);
1223 data->editor = 0; 1198 data->editor = 0;
1224 } 1199 }
1225 #endif /* NEW_EDITOR */ 1200 #endif /* NEW_EDITOR */
1226 1201
1227 /* If we're the root window we destroy using it's function 1202 /* If we're the root window we destroy using it's function
1228 */ 1203 */
1229 if ( data->phbk->root_win == window ) 1204 if ( data->phbk->root_win == window )
1230 { 1205 {
1231 bookPhonebookDestroy( data->phbk->win ); 1206 bookPhonebookDestroy( data->phbk->win );
1232 return; 1207 return;
1233 } 1208 }
1234 1209
1235 /* delete ourself 1210 /* delete ourself
1236 */ 1211 */
1237 data->phbk->search_win = 0; 1212 data->phbk->search_win = 0;
1238 winDelete( data->win ); 1213 winDelete( data->win );
1239 FREE_MEMORY( (void *) data, sizeof( tBookStandard ) ); 1214 FREE_MEMORY( (void *) data, sizeof( tBookStandard ) );
1240 } 1215 }
1241 /*SPR2123, MC deallocate memory for phonebook list*/ 1216 /*SPR2123, MC deallocate memory for phonebook list*/
1242 destroy_mmi_phonebook_names_list(MmiBookMenuDetailsList()); 1217 destroy_mmi_phonebook_names_list(MmiBookMenuDetailsList());
1243 } 1218 }
1244 1219
1245 1220
1246
1247
1248
1249
1250
1251 /******************************************************************************* 1221 /*******************************************************************************
1252 1222
1253 $Function: bookSearchName 1223 $Function: bookSearchName
1254 1224
1255 $Description: locate a requested name in the phone book 1225 $Description: locate a requested name in the phone book
1256 1226
1257 $Returns: status of the findName routine 1227 $Returns: status of the findName routine
1258 1228
1259 $Arguments: pattern, to be searched for 1229 $Arguments: pattern, to be searched for
1260 number, of elements to limit the search to 1230 number, of elements to limit the search to
1261 current, pointer to a buffer to store the results 1231 current, pointer to a buffer to store the results
1262 1232
1263 *******************************************************************************/ 1233 *******************************************************************************/
1264 1234
1265 UBYTE bookSearchName (char *pattern,UBYTE number,tMmiPhbData *current) 1235 UBYTE bookSearchName (char *pattern,UBYTE number,tMmiPhbData *current)
1266 { 1236 {
1267 #ifdef NO_ASCIIZ 1237 #ifdef NO_ASCIIZ
1268 T_MFW_PHB_TEXT l_name; 1238 T_MFW_PHB_TEXT l_name;
1269 #else 1239 #else
1270 UBYTE l_name[PHB_MAX_LEN]; 1240 UBYTE l_name[PHB_MAX_LEN];
1271 #endif 1241 #endif
1272 // UBYTE len; // RAVI 1242 // UBYTE len; // RAVI
1273 int i; 1243 int i;
1274 UBYTE ret = (UBYTE)PHB_FAIL; 1244 UBYTE ret = (UBYTE)PHB_FAIL;
1275 1245
1276 TRACE_FUNCTION( "bookSearchName()" ); 1246 TRACE_FUNCTION( "bookSearchName()" );
1277 1247
1278 /* if using UPN phone book, return status of findname 1248 /* if using UPN phone book, return status of findname
1279 */ 1249 */
1280 if ( current->status.book == PHB_UPN ) 1250 if ( current->status.book == PHB_UPN )
1281 return ret = current->result = bookFindName( MAX_SEARCH_NAME, current ); 1251 return ret = current->result = bookFindName( MAX_SEARCH_NAME, current );
1282 1252
1283 /* otherwise we need to be a little bit more clever with this 1253 /* otherwise we need to be a little bit more clever with this
1284 */ 1254 */
1285 memset( current->entry, 0, MAX_SEARCH_CALL_LIST * sizeof( T_MFW_PHB_ENTRY ) ); 1255 memset( current->entry, 0, MAX_SEARCH_CALL_LIST * sizeof( T_MFW_PHB_ENTRY ) );
1286 bookGetCurrentStatus( &current->status ); 1256 bookGetCurrentStatus( &current->status );
1287 1257
1288 current->list.entry = current->entry; 1258 current->list.entry = current->entry;
1289 current->list.num_entries = number; 1259 current->list.num_entries = number;
1290 1260
1291 /* convert from GSM characters 1261 /* convert from GSM characters
1292 */ 1262 */
1293 #ifdef NO_ASCIIZ 1263 #ifdef NO_ASCIIZ
1294 1264
1295 memset( l_name.data, 0, PHB_MAX_LEN ); 1265 memset( l_name.data, 0, PHB_MAX_LEN );
1296 mfw_Gsm2SIMStr( MFW_DCS_7bits, (UBYTE *) pattern, PHB_MAX_LEN, l_name.data, &l_name.len ); 1266 mfw_Gsm2SIMStr( MFW_DCS_7bits, (UBYTE *) pattern, PHB_MAX_LEN, l_name.data, &l_name.len );
1297 #else 1267 #else
1298 memset( l_name, 0, PHB_MAX_LEN ); 1268 memset( l_name, 0, PHB_MAX_LEN );
1299 mfw_Gsm2SIMStr( MFW_DCS_7bits, (UBYTE *) pattern, PHB_MAX_LEN, l_name, &len ); 1269 mfw_Gsm2SIMStr( MFW_DCS_7bits, (UBYTE *) pattern, PHB_MAX_LEN, l_name, &len );
1300 #endif 1270 #endif
1301 /* perform a search to locate a match with this criteria 1271 /* perform a search to locate a match with this criteria
1302 */ 1272 */
1303 if ( strlen(pattern) != 0 ) 1273 if ( strlen(pattern) != 0 )
1304 { 1274 {
1305 #ifdef WIN32 1275 #ifdef WIN32
1306 #ifndef NO_ASCIIZ 1276 #ifndef NO_ASCIIZ
1307 /***************************Go-lite Optimization changes Start***********************/ 1277 /***************************Go-lite Optimization changes Start***********************/
1308 //Aug 16, 2004 REF: CRR 24323 Deepa M.D 1278 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
1309 TRACE_EVENT_P1("Search str: %s", l_name.data); 1279 TRACE_EVENT_P1("Search str: %s", l_name.data);
1310 /***************************Go-lite Optimization changes end***********************/ 1280 /***************************Go-lite Optimization changes end***********************/
1311 ret = phb_find_entries( current->status.book, &current->index, MFW_PHB_ALPHA, number, (UBYTE *) l_name, len, &current->list ); 1281 ret = phb_find_entries( current->status.book, &current->index, MFW_PHB_ALPHA, number, (UBYTE *) l_name, len, &current->list );
1312 #endif 1282 #endif
1313 #else 1283 #else
1314 //not WIN32 1284 //not WIN32
1315 1285
1323 } 1293 }
1324 else 1294 else
1325 { 1295 {
1326 /* we don't have any name information, so start at the beginning 1296 /* we don't have any name information, so start at the beginning
1327 */ 1297 */
1328 current->index = 1; 1298 current->index = 1;
1329 current->selectedName = 0; 1299 current->selectedName = 0;
1330 bookFindName( MAX_SEARCH_NAME, current ); 1300 bookFindName( MAX_SEARCH_NAME, current );
1331 } 1301 }
1332 1302
1333 /* check for match 1303 /* check for match
1334 */ 1304 */
1335 if ( ( current->list.num_entries < MAX_SEARCH_NAME ) 1305 if ( ( current->list.num_entries < MAX_SEARCH_NAME )
1336 || ( current->list.result == MFW_NO_ENTRY ) || ( ret == (UBYTE)PHB_FAIL ) ) 1306 || ( current->list.result == MFW_NO_ENTRY ) || ( ret == (UBYTE)PHB_FAIL ) )
1337 { 1307 {
1338 /* no, then try to find again 1308 /* no, then try to find again
1339 */ 1309 */
1340 ret = bookFindName( MAX_SEARCH_NAME, current ); 1310 ret = bookFindName( MAX_SEARCH_NAME, current );
1341 } 1311 }
1342 else 1312 else
1343 { 1313 {
1344 for ( i = 0; i < number; i++ ) 1314 for ( i = 0; i < number; i++ )
1345 #ifdef NO_ASCIIZ 1315 #ifdef NO_ASCIIZ
1346 { 1316 {
1347 /* convert from Sim to GSM and then copy to output buffer 1317 /* convert from Sim to GSM and then copy to output buffer
1348 */ 1318 */
1349 /*MC SPR 1257, replacing PHB_MAX_LEN with MAX_ALPHA_LEN for name strings*/ 1319 /*MC SPR 1257, replacing PHB_MAX_LEN with MAX_ALPHA_LEN for name strings*/
1350 /*MC SPR 2175, using new function to convert name string*/ 1320 /*MC SPR 2175, using new function to convert name string*/
1351 if (current->entry[i].name.dcs == MFW_DCS_8bits && current->entry[i].name.data[0] != 0x80) 1321 if (current->entry[i].name.dcs == MFW_DCS_8bits && current->entry[i].name.data[0] != 0x80)
1352 { ATB_convert_String((char*)current->entry[i].name.data, MFW_DCS_8bits, current->entry[i].name.len, (char*)l_name.data, MFW_ASCII, MAX_ALPHA_LEN, FALSE); 1322 { ATB_convert_String((char*)current->entry[i].name.data, MFW_DCS_8bits, current->entry[i].name.len, (char*)l_name.data, MFW_ASCII, MAX_ALPHA_LEN, FALSE);
1353 memcpy( current->entry[i].name.data, l_name.data, MAX_ALPHA_LEN ); 1323 memcpy( current->entry[i].name.data, l_name.data, MAX_ALPHA_LEN );
1354 current->entry[i].name.len = l_name.len; 1324 current->entry[i].name.len = l_name.len;
1355 current->entry[i].name.dcs = MFW_ASCII; 1325 current->entry[i].name.dcs = MFW_ASCII;
1356 } 1326 }
1357 } 1327 }
1358 #else 1328 #else
1359 /* convert from GSM to Alpha characters 1329 /* convert from GSM to Alpha characters
1360 */ 1330 */
1361 bookGsm2Alpha( (UBYTE *) current->entry[i].name ); 1331 bookGsm2Alpha( (UBYTE *) current->entry[i].name );
1362 #endif 1332 #endif
1363 } 1333 }
1364 1334
1365 /* return the status, and store it as part of current as well 1335 /* return the status, and store it as part of current as well
1366 */ 1336 */
1367 TRACE_EVENT_P1("BookSearchName returns: %d", ret); 1337 TRACE_EVENT_P1("BookSearchName returns: %d", ret);
1368 return current->result = ret; 1338 return current->result = ret;
1369 } 1339 }
1370 1340
1371 1341
1372
1373 /******************************************************************************* 1342 /*******************************************************************************
1374 1343
1375 End of File 1344 End of File
1376 1345
1377 *******************************************************************************/ 1346 *******************************************************************************/
1378