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