FreeCalypso > hg > fc-magnetite
comparison src/ui3/bmi/mmiBookMenuWindow.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/MmiBookMenuWindow.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: MmiBookMenuWindow.c | |
16 $Revision: 1.0 | |
17 | |
18 $Author: Condat(UK) | |
19 $Date: 25/10/00 | |
20 | |
21 ******************************************************************************** | |
22 | |
23 Description: | |
24 | |
25 Menu handling for the phone book | |
26 | |
27 ******************************************************************************** | |
28 $History: MmiBookMenuWindow.c | |
29 Mar 30, 2007 OMAPS00123019 a0393213(R.Prabakar) | |
30 Description : Reboot of the target when you unplug/plug USB cable using camera application | |
31 | |
32 xrashmic 28 Jun 2006, OMAPS00084172 | |
33 On pressing back from options menu in camera, the midi stopped playing. | |
34 Hence added stopRingerVolSettingInactivityTimer under the if(getSoundsReason() == SettingVolume) | |
35 | |
36 Sep 01, 2005 REF: CRR 32707 x0021334 | |
37 Description: Select Softkey dosen't work for the second time on choosing Volume option in Ringer menu | |
38 Fix: Select soft key operation in volume menu has been modified to fix this problem. | |
39 | |
40 Apr 05, 2005 REF: ENH 29994 xdeepadh | |
41 Description: Implementation of Generic Midi Ringer and Modification of existing Midi Test Application | |
42 Solution: Generic Midi Ringer and Midi Test Application were implemented. | |
43 | |
44 25/10/00 Original Condat(UK) BMI version. | |
45 | |
46 $End | |
47 | |
48 *******************************************************************************/ | |
49 | |
50 /******************************************************************************* | |
51 | |
52 Include Files | |
53 | |
54 *******************************************************************************/ | |
55 #define ENTITY_MFW | |
56 | |
57 /* includes */ | |
58 #include <string.h> | |
59 #include <stdio.h> | |
60 #include <stdlib.h> | |
61 | |
62 #if defined (NEW_FRAME) | |
63 | |
64 #include "typedefs.h" | |
65 #include "vsi.h" | |
66 #include "pei.h" | |
67 #include "custom.h" | |
68 #include "gsm.h" | |
69 | |
70 #else | |
71 | |
72 #include "STDDEFS.H" | |
73 #include "custom.h" | |
74 #include "gsm.h" | |
75 #include "vsi.h" | |
76 | |
77 #endif | |
78 | |
79 #include "mfw_sys.h" | |
80 | |
81 #include "mfw_mfw.h" | |
82 #include "mfw_win.h" | |
83 #include "mfw_kbd.h" | |
84 #include "mfw_lng.h" | |
85 /* SPR#1428 - SH - New Editor changes */ | |
86 #ifndef NEW_EDITOR | |
87 #include "mfw_edt.h" | |
88 #endif | |
89 #include "mfw_icn.h" | |
90 #include "mfw_mnu.h" | |
91 #include "mfw_tim.h" | |
92 | |
93 #include "mfw_sim.h" | |
94 #include "mfw_cm.h" | |
95 #include "mfw_nm.h" | |
96 #include "mfw_phb.h" | |
97 #include "mfw_mme.h" | |
98 #include "mfw_sat.h" | |
99 #include "mfw_sms.h" | |
100 | |
101 #include "dspl.h" | |
102 | |
103 #include "ksd.h" | |
104 #include "psa.h" | |
105 | |
106 #include "MmiMain.h" | |
107 #include "MmiBookController.h" | |
108 #include "MmiDummy.h" | |
109 #include "MmiDialogs.h" | |
110 #include "MmiLists.h" | |
111 #include "mmiColours.h" | |
112 | |
113 | |
114 #include "MmiMenu.h" | |
115 #include "mmiCall.h" | |
116 #include "Mmiicons.h" | |
117 #include "MmiIdle.h" | |
118 | |
119 #include "MmiSoftKeys.h" | |
120 #include "MmiSounds.h" | |
121 #include "MmiIdle.h" | |
122 #include "MmiNetwork.h" | |
123 #include "mmiSat_i.h" | |
124 #include "MmiAoc.h" | |
125 | |
126 #include "gdi.h" | |
127 #include "audio.h" | |
128 | |
129 #include "cus_aci.h" | |
130 #include "mfw_ffs.h" | |
131 #include "MmiTimers.h" | |
132 | |
133 #include "MmiBookShared.h" | |
134 #include "MmiSettings.h" // for keypadlock | |
135 #include "MmiSounds.h" | |
136 #include "MmiIdle.h" | |
137 | |
138 extern UBYTE HUPKeyOrigin; // Variable to indicate that long end key press is coming from menu | |
139 | |
140 /******************************************************************************* | |
141 External Function Prototype | |
142 | |
143 *******************************************************************************/ | |
144 /* Fix for the melody and volume settings. 3/4/01 MZ */ | |
145 extern BOOL getScrollSelectMenuItem(void); | |
146 extern clearScrollSelectMenuItem(void); | |
147 extern void volMenuItemSelected(void); | |
148 extern USHORT getSoundsReason(void); | |
149 extern void startRingerVolSettingInactivityTimer(void); | |
150 extern void stopRingerVolSettingInactivityTimer(void); | |
151 extern void restartVolSettingInactivityTimer(void); | |
152 //Apr 05, 2005 REF: ENH 29994 xdeepadh | |
153 #ifdef FF_MIDI_RINGER | |
154 extern MfwHnd hPlayerStartTimer; /* timeout till start of midi file */ | |
155 #endif | |
156 | |
157 /******************************************************************************* | |
158 | |
159 Private Methods | |
160 | |
161 *******************************************************************************/ | |
162 | |
163 | |
164 | |
165 /******************************************************************************* | |
166 | |
167 $Function: bookMenuMenuCB | |
168 | |
169 $Description: Menu handler for the menu window | |
170 | |
171 $Returns: MFW_EVENT_CONSUMED if event handled, otherwise | |
172 MFW_EVENT_PASSED | |
173 | |
174 $Arguments: e, event, m, menu handle | |
175 | |
176 *******************************************************************************/ | |
177 | |
178 static int bookMenuMenuCB( MfwEvt e, MfwMnu *m ) | |
179 { | |
180 T_MFW_HND window = mfwParent( mfw_header() ); | |
181 T_MFW_WIN *win_data = ((T_MFW_HDR *)window)->data; | |
182 tBookStandard *data = (tBookStandard *) win_data->user; | |
183 | |
184 TRACE_FUNCTION( "bookMenuMenuCB()" ); | |
185 | |
186 /* We only handle the ESCAPE event in here | |
187 */ | |
188 switch( e ) | |
189 { | |
190 case E_MNU_ESCAPE: | |
191 { | |
192 /* Escape requested, we need to shut down this window | |
193 */ | |
194 if (data->Callback) | |
195 (data->Callback) (data->parent_win, NULL, NULL); | |
196 bookMenuDestroy( window ); | |
197 //xrashmic 28 Jun 2006, OMAPS00084172 | |
198 //On pressing back from options menu in camera, the midi stopped playing. | |
199 if(getSoundsReason() == SettingVolume) | |
200 stopRingerVolSettingInactivityTimer(); | |
201 } | |
202 break; | |
203 | |
204 default: | |
205 { | |
206 /* unknown event, pass it up the tree for handling elsewhere | |
207 */ | |
208 return MFW_EVENT_PASSED; | |
209 } | |
210 /* break; */ /* RAVI */ | |
211 } | |
212 | |
213 /* We got here, event handled, prevent anyone else | |
214 dealing with it | |
215 */ | |
216 return MFW_EVENT_CONSUMED; | |
217 } | |
218 | |
219 | |
220 | |
221 | |
222 | |
223 | |
224 /******************************************************************************* | |
225 | |
226 $Function: bookMenuDialog | |
227 | |
228 $Description: Menu window dialog function | |
229 | |
230 $Returns: none | |
231 | |
232 $Arguments: win, window handle | |
233 event, event to be handled | |
234 value, not used | |
235 parameter, not used | |
236 | |
237 *******************************************************************************/ | |
238 | |
239 void bookMenuDialog( T_MFW_HND win, USHORT event, SHORT value, void *parameter ) | |
240 { | |
241 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; | |
242 tBookStandard *data = (tBookStandard *) win_data->user; | |
243 /* MfwMnu *mnu; */ /* RAVI */ | |
244 | |
245 TRACE_FUNCTION( "bookMenuDialog()" ); | |
246 | |
247 /* The menu dialog function has to deal with initialisation | |
248 and responses from the PIN2 validation methods | |
249 */ | |
250 switch( event ) | |
251 { | |
252 case MENU_INIT: | |
253 { | |
254 /* On initialisation, we can create the menus and | |
255 display the window | |
256 */ | |
257 data->menu = mnuCreate( data->win, (MfwMnuAttr *) parameter, E_MNU_ESCAPE, (MfwCb) bookMenuMenuCB ); | |
258 mnuLang( data->menu, mainMmiLng ); | |
259 mnuUnhide( data->menu ); | |
260 winShow( data->win ); | |
261 | |
262 if (value EQ PhbkMainMenu) | |
263 { | |
264 // start the timer for the keypadlock | |
265 tim_start (data->menu_tim); | |
266 data->status_of_timer = FALSE; | |
267 } | |
268 else | |
269 { | |
270 data->status_of_timer = TRUE; | |
271 } | |
272 if(value == SettingVolume) | |
273 { | |
274 /* | |
275 The ringer volume settings dialog has been invoked, create and start the | |
276 4 second time out. | |
277 */ | |
278 /* RAVI - 20-1-2006 */ | |
279 #ifdef NEPTUNE_BOARD | |
280 setSoundsReason(SettingVolume); | |
281 #endif | |
282 /* END RAVI */ | |
283 startRingerVolSettingInactivityTimer(); | |
284 } | |
285 | |
286 } | |
287 break; | |
288 | |
289 case ADD_CALLBACK: | |
290 { | |
291 /* Change the callback from the default menu callback to one specified | |
292 * in parameter */ | |
293 data->Callback = (T_VOID_FUNC)parameter; | |
294 } | |
295 break; | |
296 | |
297 case DEFAULT_OPTION: | |
298 { | |
299 /* Highlight an option in the menu when it is opened. Parameter points to a UBYTE. */ | |
300 | |
301 mnuChooseVisibleItem(data->menu, *((UBYTE *)parameter)); | |
302 } | |
303 break; | |
304 | |
305 case PIN2_OK: | |
306 { | |
307 /* We have received a PIN2 authorisation, so we can execute the | |
308 the requested function | |
309 */ | |
310 | |
311 TRACE_EVENT("PIN2_OK: Should carry on to perform phonebook op"); | |
312 (data->phbk->pin2_next)( data->phbk->menu, data->phbk->item); | |
313 | |
314 } | |
315 break; | |
316 case E_MNU_ESCAPE: | |
317 { | |
318 /* Escape requested, we need to shut down this window | |
319 */ | |
320 bookMenuDestroy( win); | |
321 } | |
322 break; | |
323 default: | |
324 { | |
325 /* In situations where a PIN2 abort is returned, we can handle it | |
326 as a default event, and just ignore it | |
327 */ | |
328 TRACE_EVENT("PIN2 not OK"); | |
329 } | |
330 break; | |
331 } | |
332 } | |
333 | |
334 | |
335 | |
336 /******************************************************************************* | |
337 | |
338 $Function: bookMenuTimCB | |
339 | |
340 $Description: Menu tim handler | |
341 | |
342 $Returns: | |
343 | |
344 $Arguments: | |
345 | |
346 *******************************************************************************/ | |
347 | |
348 static int bookMenuTimCB (T_MFW_EVENT event, T_MFW_TIM *tc) | |
349 { | |
350 T_MFW_HND window = mfwParent( mfw_header() ); | |
351 T_MFW_WIN *win_data = ((T_MFW_HDR *)window)->data; | |
352 tBookStandard *data = (tBookStandard *) win_data->user; | |
353 | |
354 data->status_of_timer = TRUE; | |
355 | |
356 /* ADDED RAVI - 25-11-2005 */ | |
357 return 0; | |
358 /* END RAVI */ | |
359 | |
360 } | |
361 | |
362 | |
363 | |
364 | |
365 | |
366 | |
367 /******************************************************************************* | |
368 | |
369 $Function: bookMenuWindowCB | |
370 | |
371 $Description: Menu window handler | |
372 | |
373 $Returns: MFW_EVENT_CONSUMED if event handled, otherwise | |
374 MFW_EVENT_PASSED | |
375 | |
376 $Arguments: e, event, m, window handle | |
377 | |
378 *******************************************************************************/ | |
379 | |
380 static int bookMenuWindowCB( MfwEvt e, MfwWin *w ) | |
381 { | |
382 tBookStandard * data = (tBookStandard *)w->user; | |
383 MfwMnu * mnu; | |
384 | |
385 TRACE_FUNCTION( "bookMenuWindowCB()" ); | |
386 | |
387 if (!w) | |
388 return MFW_EVENT_PASSED; | |
389 | |
390 switch( e ) | |
391 { | |
392 case MfwWinVisible: | |
393 { | |
394 dspl_ClearAll(); // sbh - clear screen before update | |
395 mnu = (MfwMnu *) mfwControl( data->menu ); | |
396 | |
397 /* | |
398 **Check whether the data is valid, if not use 'sensible' default values | |
399 */ | |
400 if (mnu) | |
401 { | |
402 if (mnu->curAttr) | |
403 softKeys_displayId( TxtSoftSelect, TxtSoftBack, 0, mnu->curAttr->mnuColour); | |
404 else | |
405 softKeys_displayId( TxtSoftSelect, TxtSoftBack, 0, COLOUR_LIST_SUBMENU); | |
406 | |
407 } | |
408 else | |
409 softKeys_displayId( TxtSoftSelect, TxtSoftBack, 0, COLOUR_LIST_SUBMENU); | |
410 } | |
411 break; | |
412 | |
413 default: | |
414 { | |
415 /* unknown event, pass it up the tree for handling elsewhere | |
416 */ | |
417 return MFW_EVENT_PASSED; | |
418 } | |
419 /* break; */ /* RAVI */ | |
420 } | |
421 | |
422 /* We got here, event handled, prevent anyone else | |
423 dealing with it | |
424 */ | |
425 return MFW_EVENT_CONSUMED; | |
426 } | |
427 | |
428 | |
429 | |
430 | |
431 | |
432 | |
433 /******************************************************************************* | |
434 | |
435 $Function: bookMenuKbdCB | |
436 | |
437 $Description: tbd | |
438 | |
439 $Returns: MFW_EVENT_CONSUMED always | |
440 | |
441 $Arguments: e, event, k, key handle | |
442 | |
443 *******************************************************************************/ | |
444 | |
445 static int bookMenuKbdCB( MfwEvt e, MfwKbd *k ) | |
446 { | |
447 static BOOL storeSelectedItemToPcm=FALSE; | |
448 T_MFW_HND window = mfwParent( mfw_header() ); | |
449 T_MFW_WIN *win_data = ((T_MFW_HDR *)window)->data; | |
450 tBookStandard *data = (tBookStandard *) win_data->user; | |
451 MfwMnu *mnu; | |
452 U8 keycode; /* SPR#1608 - SH */ | |
453 | |
454 TRACE_FUNCTION( "bookMenuKbdCB()" ); | |
455 | |
456 /* handle the keypress | |
457 */ | |
458 switch (k->code) | |
459 { | |
460 case KCD_MNUUP: | |
461 { | |
462 // keypadLock will not activate anymore | |
463 data->status_of_timer = TRUE; | |
464 /* Update the window with the previous element | |
465 */ | |
466 mnuUp( data->menu ); | |
467 /* | |
468 Special case when setting up ringer volume, the current ringer | |
469 is played as user scrolls the volume settings Silent -> cresendo. | |
470 MZ. | |
471 */ | |
472 /* RAVI - 20-1-2006 */ | |
473 #ifdef NEPTUNE_BOARD | |
474 if (getSoundsReason () == SettingVolume) | |
475 { | |
476 volumeMenuScrollUp(); | |
477 } | |
478 #endif | |
479 /* END RAVI */ | |
480 | |
481 if(getScrollSelectMenuItem() == TRUE ||(getSoundsReason() == SettingVolume) ) | |
482 { | |
483 mnuSelect(data->menu); | |
484 /* Scroll up in volume setting */ | |
485 restartVolSettingInactivityTimer(); | |
486 } | |
487 } | |
488 break; | |
489 | |
490 case KCD_MNUDOWN: | |
491 { | |
492 // keypadLock will not activate anymore | |
493 data->status_of_timer = TRUE; | |
494 /* Update the window with the next element | |
495 */ | |
496 mnuDown( data->menu ); | |
497 | |
498 /* | |
499 Special case when setting up ringer volume, the current ringer | |
500 is played as user scrolls the volume settings Silent -> cresendo. | |
501 MZ. | |
502 */ | |
503 /* RAVI - 20-1-2006 */ | |
504 #ifdef NEPTUNE_BOARD | |
505 if (getSoundsReason () == SettingVolume) | |
506 { | |
507 volumeMenuScrollDown(); | |
508 } | |
509 #endif | |
510 /* END RAVI */ | |
511 | |
512 if((getScrollSelectMenuItem() == TRUE) || (getSoundsReason() == SettingVolume)) | |
513 { | |
514 mnuSelect(data->menu); | |
515 restartVolSettingInactivityTimer(); | |
516 } | |
517 | |
518 } | |
519 break; | |
520 | |
521 case KCD_MNUSELECT: | |
522 case KCD_LEFT: | |
523 { | |
524 // keypadLock will not activate anymore | |
525 data->status_of_timer = TRUE; | |
526 | |
527 // Select this element | |
528 mnuSelect( data->menu ); | |
529 /*30 Mar 2007 a0393213 (R.Prabakar) | |
530 OMAPS00123019 ( Reboot of the target when you unplug/plug USB cable using camera application) | |
531 The usb enumeration option window has to be destroyed automatically once the user selects an option. | |
532 Earlier the menu was destroyed in the menu select call back function (mmi_usb_enumeration) and the same menu was | |
533 accesed further in this function. This was resulting in crash. | |
534 Now the menu is destroyed in this function and returned immediately. | |
535 */ | |
536 #ifdef FF_MMI_USBMS | |
537 if(usb_opt_win && | |
538 data->menu==((tBookStandard*)(((MfwWin*)(((T_MFW_HDR *)usb_opt_win)->data))->user))->menu) | |
539 { | |
540 bookMenuDestroy(usb_opt_win); | |
541 usb_opt_win=NULL; | |
542 break; | |
543 } | |
544 #endif | |
545 mnu = (MfwMnu *) mfwControl( data->menu ); | |
546 | |
547 if (mnu != NULL) | |
548 { | |
549 if (mnu->curAttr != NULL) | |
550 { | |
551 // API - 24-01-03 - 1606 - Soft Key updating add this win Focus check | |
552 if( winIsFocussed(window) ) | |
553 softKeys_displayId( TxtSoftSelect, TxtSoftBack, 0, mnu->curAttr->mnuColour); | |
554 } | |
555 } | |
556 | |
557 // A volume or tone setting menu has been entered. MZ 2/4/01 | |
558 if((getScrollSelectMenuItem() == TRUE) || (getSoundsReason() == SettingVolume)) | |
559 { | |
560 TRACE_FUNCTION("@@@@ A volume or tone settin"); | |
561 | |
562 /* | |
563 First time pcm flag is false, subsequent selection of menu item | |
564 will select and terminate the volume settings menu. 3/4/01 MZ. | |
565 */ | |
566 if(storeSelectedItemToPcm ==TRUE || getSoundsReason() == SettingVolume ) | |
567 { | |
568 clearScrollSelectMenuItem(); | |
569 volMenuItemSelected(); | |
570 storeSelectedItemToPcm =FALSE; | |
571 mnuEscape( data->menu ); | |
572 if(getSoundsReason() == SettingVolume) | |
573 { | |
574 setSoundsReason(SoundsNone); | |
575 stopRingerVolSettingInactivityTimer(); | |
576 } | |
577 //Apr 05, 2005 REF: ENH 29994 xdeepadh | |
578 #ifdef FF_MIDI_RINGER | |
579 //Delete the timer for volume scrolling | |
580 if(hPlayerStartTimer!=NULL) | |
581 timDelete(hPlayerStartTimer); | |
582 #endif | |
583 break; | |
584 } | |
585 /* | |
586 Second time the left soft key is used, store the setting in pcm and terminate the | |
587 volume settings menu. | |
588 */ | |
589 storeSelectedItemToPcm =TRUE; | |
590 | |
591 } | |
592 } | |
593 break; | |
594 | |
595 // POWER key takes us to idle screen. | |
596 case KCD_POWER: | |
597 data->status_of_timer = TRUE; | |
598 | |
599 HUPKeyOrigin = 0; // sbh - we're coming from the menu screen, so don't shut down right away | |
600 | |
601 //return to idle screen | |
602 | |
603 if (data->Callback) | |
604 (data->Callback) (data->parent_win, NULL, NULL); | |
605 | |
606 bookMenuDestroy(data->win); | |
607 stopRingerVolSettingInactivityTimer(); | |
608 | |
609 SEND_EVENT(idle_get_window(), IDLE_UPDATE, 0, 0); | |
610 break; | |
611 | |
612 case KCD_RIGHT: | |
613 case KCD_HUP: | |
614 { | |
615 // keypadLock will not activate anymore | |
616 data->status_of_timer = TRUE; | |
617 | |
618 // Sep 01, 2005 REF: CRR 32707 x0021334 | |
619 // Set storeSelectedItemToPcm to FALSE to enable proper operation every time instead of | |
620 // handling it in alterate attempts. | |
621 storeSelectedItemToPcm = FALSE; | |
622 | |
623 HUPKeyOrigin = 0; // sbh - we're coming from the menu screen, so don't shut down right away | |
624 | |
625 /* get us out of here | |
626 */ | |
627 mnuEscape( data->menu ); | |
628 mnu = (MfwMnu *) mfwControl( data->menu ); | |
629 if (mnu != NULL) | |
630 { | |
631 if (mnu->curAttr != NULL) | |
632 { | |
633 // API - 24-01-03 - 1606 - Soft Key updating add this win Focus check | |
634 if( winIsFocussed(window) ) | |
635 softKeys_displayId( TxtSoftSelect, TxtSoftBack, 0, mnu->curAttr->mnuColour); | |
636 } | |
637 } | |
638 | |
639 // Return the menu scroll behavior to normal. | |
640 if(getScrollSelectMenuItem() == TRUE) | |
641 { | |
642 clearScrollSelectMenuItem(); | |
643 } | |
644 /* | |
645 If user exits the volume settings menu from the Idle or Incoming call screen. | |
646 clear the soundsReason. | |
647 */ | |
648 if(getSoundsReason() == SettingVolume) | |
649 { | |
650 /* RAVI - 20-1-2006 */ | |
651 #ifdef NEPTUNE_BOARD | |
652 /* Restore the volume setting */ | |
653 restorePreviousVolumeSetting (); | |
654 #endif | |
655 /* END RAVI */ | |
656 stopRingerVolSettingInactivityTimer(); | |
657 setSoundsReason(SoundsNone); | |
658 //Apr 05, 2005 REF: ENH 29994 xdeepadh | |
659 #ifdef FF_MIDI_RINGER | |
660 //Delete teh timer for volume scrolling | |
661 if(hPlayerStartTimer!=NULL) | |
662 timDelete(hPlayerStartTimer); | |
663 #endif | |
664 } | |
665 | |
666 } | |
667 break; | |
668 | |
669 case KCD_STAR: | |
670 { | |
671 | |
672 /* | |
673 * Keypadlock will lock only | |
674 * within two seconds by press "*" | |
675 */ | |
676 | |
677 if(data->status_of_timer EQ FALSE) | |
678 { | |
679 TRACE_EVENT ("activate KEYpadLOCK"); | |
680 mnuEscape( data->menu ); | |
681 settingsKeyPadLockOn (); | |
682 } | |
683 | |
684 /* SPR#1608 - SH - Otherwise, send '*' keypress to idle screen */ | |
685 | |
686 else if (window == data->phbk->menu_main_win) | |
687 { | |
688 /* Number key presses in phonebook menu returns user to idle screen, | |
689 add key press to Idle edit screen. */ | |
690 | |
691 keycode = k->code; | |
692 | |
693 bookMenuDestroy(data->win); | |
694 | |
695 SEND_EVENT(idle_get_window(), IDLE_START_DIALLING_NUMBER, 0, &keycode); | |
696 } | |
697 } | |
698 break; | |
699 | |
700 case KCD_HASH: | |
701 { | |
702 /* | |
703 * Keypadlock will lock only | |
704 * within two seconds by press "*" | |
705 */ | |
706 if(data->status_of_timer EQ FALSE) | |
707 { | |
708 TRACE_EVENT ("activate Silent mode"); | |
709 | |
710 if(FFS_flashData.settings_status & SettingsSilentMode) | |
711 { | |
712 settingsSilentModeOff(); | |
713 } | |
714 else | |
715 { | |
716 settingsSilentModeOn(); | |
717 } | |
718 mnuEscape( data->menu ); | |
719 } | |
720 | |
721 /* SPR#1608 - SH - Otherwise, send '#' keypress to idle screen */ | |
722 | |
723 else if (window == data->phbk->menu_main_win) | |
724 { | |
725 /* Number key presses in phonebook menu returns user to idle screen, | |
726 add key press to Idle edit screen. */ | |
727 | |
728 keycode = k->code; | |
729 | |
730 bookMenuDestroy(data->win); | |
731 | |
732 SEND_EVENT(idle_get_window(), IDLE_START_DIALLING_NUMBER, 0, &keycode); | |
733 } | |
734 } | |
735 break; | |
736 | |
737 default: | |
738 { | |
739 TRACE_EVENT("bookMenuKbdCb - DEFAULT!"); | |
740 /* SH - only allow dialling if we are in the main menu */ | |
741 if (window == data->phbk->menu_main_win) | |
742 { | |
743 /* keypadLock will not activate anymore */ | |
744 data->status_of_timer = TRUE; | |
745 | |
746 /* Number key presses in phonebook menu returns user to idle screen, | |
747 add key press to Idle edit screen. */ | |
748 | |
749 keycode = k->code; | |
750 | |
751 bookMenuDestroy(data->win); | |
752 | |
753 /* x0045876, 14-Aug-2006 (WR - pointless comparison of unsigned integer with zero) */ | |
754 /* if ((k->code>=KCD_0 && k->code<=KCD_9)) */ | |
755 if (k->code<=KCD_9) | |
756 { | |
757 TRACE_EVENT("Idle Editor Start!"); | |
758 SEND_EVENT(idle_get_window(), IDLE_START_DIALLING_NUMBER, 0, &keycode); | |
759 } | |
760 } | |
761 } | |
762 break; | |
763 } | |
764 | |
765 /* always consume the event | |
766 */ | |
767 return MFW_EVENT_CONSUMED; | |
768 } | |
769 | |
770 | |
771 | |
772 | |
773 | |
774 | |
775 | |
776 /******************************************************************************* | |
777 | |
778 $Function: bookMenuKbdLongCB | |
779 | |
780 $Description: keyboard long press event handler | |
781 | |
782 $Returns: MFW_EVENT_CONSUMED always | |
783 | |
784 $Arguments: e, event, k, key handle | |
785 | |
786 *******************************************************************************/ | |
787 | |
788 static int bookMenuKbdLongCB( MfwEvt e, MfwKbd *k ) | |
789 { | |
790 T_MFW_HND window = mfwParent( mfw_header() ); | |
791 T_MFW_WIN *win_data = ((T_MFW_HDR *)window)->data; | |
792 tBookStandard *data = (tBookStandard *) win_data->user; | |
793 | |
794 TRACE_FUNCTION( "bookMenuKbdLongCB()" ); | |
795 | |
796 if ( ( e & KEY_CLEAR ) && ( e & KEY_LONG ) ) | |
797 { mnuEscape( data->menu ); | |
798 return MFW_EVENT_CONSUMED; | |
799 } | |
800 /*if long press on END key*/ | |
801 if ( ( e & KEY_HUP) && ( e & KEY_LONG ) ) | |
802 { | |
803 U8 keycode; | |
804 U8 uMode; | |
805 uMode = dspl_Enable(0); | |
806 | |
807 // keypadLock will not activate anymore | |
808 data->status_of_timer = TRUE; | |
809 | |
810 //return to idle screen | |
811 | |
812 keycode = k->code; | |
813 | |
814 if (data->Callback) | |
815 (data->Callback) (data->parent_win, NULL, NULL); | |
816 | |
817 bookMenuDestroy(data->win); | |
818 stopRingerVolSettingInactivityTimer(); | |
819 | |
820 SEND_EVENT(idle_get_window(), IDLE_UPDATE, 0, &keycode); | |
821 | |
822 dspl_Enable(uMode); | |
823 } | |
824 | |
825 return MFW_EVENT_CONSUMED; | |
826 } | |
827 | |
828 | |
829 | |
830 | |
831 | |
832 | |
833 /******************************************************************************* | |
834 | |
835 $Function: bookMenuCreate | |
836 | |
837 $Description: Create the menu window | |
838 | |
839 $Returns: handle of newly created window, or NULL if error | |
840 | |
841 $Arguments: parent, handle of the parent window | |
842 | |
843 *******************************************************************************/ | |
844 | |
845 static T_MFW_HND bookMenuCreate( MfwHnd parent ) | |
846 { | |
847 T_MFW_WIN *parent_win_data = ( (T_MFW_HDR *) parent )->data; | |
848 T_phbk *phbk = (T_phbk *)parent_win_data->user; | |
849 T_MFW_WIN *win_data; | |
850 tBookStandard *data; | |
851 | |
852 TRACE_FUNCTION( "bookMenuCreate()" ); | |
853 | |
854 /* allocate memory for our control block | |
855 */ | |
856 if ( ( data = (tBookStandard *) ALLOC_MEMORY( sizeof( tBookStandard ) ) ) == NULL ) | |
857 return NULL; | |
858 | |
859 /* Create the window if we can | |
860 */ | |
861 if ( ( data->win = win_create( parent, 0, E_WIN_VISIBLE, (T_MFW_CB) bookMenuWindowCB ) ) == NULL ) | |
862 { | |
863 FREE_MEMORY( (void *)data, sizeof( tBookStandard ) ); | |
864 return NULL; | |
865 } | |
866 | |
867 /* Okay, we have created the control block and the window, so | |
868 we now need to configure the dialog and data pointers | |
869 */ | |
870 data->mmi_control.dialog = (T_DIALOG_FUNC) bookMenuDialog; | |
871 data->mmi_control.data = data; | |
872 win_data = ((T_MFW_HDR *)data->win)->data; | |
873 win_data->user = (void *) data; | |
874 data->phbk = phbk; | |
875 data->parent_win = parent; | |
876 | |
877 /* create keyboards and menus for our window | |
878 */ | |
879 data->kbd = kbdCreate ( data->win, KEY_ALL, (MfwCb) bookMenuKbdCB ); | |
880 data->kbd_long = kbdCreate ( data->win, KEY_ALL | KEY_LONG, (MfwCb) bookMenuKbdLongCB ); | |
881 data->menu_tim = tim_create (data->win, THREE_SECS, (MfwCb) bookMenuTimCB); | |
882 | |
883 data->Callback = NULL; // Use standard menu callback (changed by sending event ADD_CALLBACK) | |
884 | |
885 /* And return the handle of the newly created window | |
886 */ | |
887 return data->win; | |
888 } | |
889 | |
890 | |
891 | |
892 | |
893 | |
894 /******************************************************************************* | |
895 | |
896 Public Methods | |
897 | |
898 *******************************************************************************/ | |
899 | |
900 /******************************************************************************* | |
901 | |
902 $Function: bookMenuStart | |
903 | |
904 $Description: tbd | |
905 | |
906 $Returns: tbd | |
907 | |
908 $Arguments: tbd | |
909 | |
910 *******************************************************************************/ | |
911 | |
912 T_MFW_HND bookMenuStart( MfwHnd parent, MfwMnuAttr *menuAttr,SHORT reason ) | |
913 { | |
914 T_MFW_HND win; | |
915 | |
916 win = bookMenuCreate( parent ); | |
917 | |
918 if ( win != NULL ) | |
919 SEND_EVENT( win, MENU_INIT, reason, (MfwMnuAttr *) menuAttr ); | |
920 return win; | |
921 } | |
922 | |
923 | |
924 | |
925 /******************************************************************************* | |
926 | |
927 $Function: bookMenuDestroy | |
928 | |
929 $Description: Destroy the menu window | |
930 | |
931 $Returns: none | |
932 | |
933 $Arguments: window, handle of the window being destroyed | |
934 | |
935 *******************************************************************************/ | |
936 | |
937 void bookMenuDestroy( MfwHnd window ) | |
938 { | |
939 T_MFW_WIN *win_data = ((T_MFW_HDR *)window)->data; | |
940 tBookStandard *data = (tBookStandard *) win_data->user; | |
941 char test_string[40]; | |
942 | |
943 TRACE_FUNCTION( "bookMenuDestroy()" ); | |
944 | |
945 if (window == NULL) | |
946 { | |
947 TRACE_EVENT ("Error : Called with NULL Pointer"); | |
948 return; | |
949 } | |
950 | |
951 if ( data ) | |
952 { | |
953 | |
954 /* If we have the root window here then we use the main phone | |
955 book destroy method | |
956 */ | |
957 if ( data->phbk->root_win == window ) | |
958 { | |
959 bookPhonebookDestroy( data->phbk->win ); | |
960 return; | |
961 } | |
962 | |
963 /* Otherwise clear down our pointers and free the current | |
964 menu window structures | |
965 */ | |
966 if ( data->phbk->search_win == window ) | |
967 data->phbk->search_win = 0; | |
968 if ( data->phbk->menu_main_win == window ) | |
969 data->phbk->menu_main_win = 0; | |
970 if ( data->phbk->menu_options_win == window ) | |
971 data->phbk->menu_options_win = 0; | |
972 if ( data->phbk->menu_options_win_2 == window ) | |
973 data->phbk->menu_options_win_2 = 0; | |
974 if ( data->phbk->menu_call_options_win == window ) | |
975 data->phbk->menu_call_options_win = 0; | |
976 if ( data->phbk->menu_call_options_win_2 == window ) | |
977 data->phbk->menu_call_options_win_2 = 0; | |
978 | |
979 winDelete( data->win ); | |
980 FREE_MEMORY( (void *)data, sizeof( tBookStandard ) ); | |
981 sprintf(test_string, "Bookmenudestroy: %d", mfwCheckMemoryLeft()); | |
982 TRACE_EVENT(test_string); | |
983 } | |
984 | |
985 } | |
986 | |
987 | |
988 | |
989 | |
990 | |
991 | |
992 /******************************************************************************* | |
993 | |
994 End of File | |
995 | |
996 *******************************************************************************/ |