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