comparison src/ui3/bmi/mmiSatMenu.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
4 CONDAT (UK)
5
6 ********************************************************************************
7
8 This software product is the property of Condat (UK) Ltd and may not be
9 disclosed to any third party without the express permission of the owner.
10
11 ********************************************************************************
12
13 $Project name: Basic MMI
14 $Project code: BMI (6349)
15 $Module: MMI
16 $File: MmiSatMenu.c
17 $Revision: 1.0
18
19 $Author: Condat(UK)
20 $Date: 25/10/00
21
22 ********************************************************************************
23
24 Description:
25
26 Implementation of MMI SIM Application Toolkit (SAT)
27
28 ********************************************************************************
29
30 $History: MmiSatMenu.c
31
32
33
34
35 Jun 06, 2006 DR: OMAPS00080543 - xreddymn
36 Description: Default item is not being highlighted for SELECT ITEM command.
37 Solution: Change list menu highlight index based on the default item provided
38 in the SELECT ITEM command.
39
40 June 05, 2006 REF:OMAPS00060424 x0045876
41 Description: Header Toggling
42 Solution: Implemented the toggling of header when displaying the length text in SELECT ITEM and SET UP MENU
43
44 Apr 24, 2006 REF: DRT OMAPS00075832 x0039928
45 Description: SIM tool kit crash on plus 2.5 image
46 Fix: Memory freeing of data->list_menu_data.Attr->icon is put under if conditon
47 setupMenuHeaderIconData.dst != NULL for setup menu and selectItemHeaderIconData.dst != NULL
48 for select item.
49
50 Shashi Shekar B.S., a0876501, 16 Mar, 2006, OMAPS00061462
51 Icon support for SetupMenu & Select item.
52
53 xrashmic 5 Oct, 2005 MMI-SPR-29356, MMI-SPR-29357
54 Using the MenuSelect Key for requesting the help info in STK menu.
55
56 May 24, 2005 REF: CRR 29358 x0021334
57 Description: CT_PTCRB 27.22.4.9.8 fails: wrong terminal response
58 Fix: The implementation is now based on timer. After the specified timeout period
59 the control comes back to SAT main menu, if there is no selection done by the user.
60
61 Aug 16, 2004 REF: CRR 24323 Deepa M.D
62 Bug:Clenup of sprintf used for tracing
63 Fix:Replace the char buf[]; sprintf (buf, "...", ...); TRACE_EVENT (buf); statements by TRACE_EVENT_PX
64
65 25/10/00 Original Condat(UK) BMI version.
66
67 $End
68
69 *******************************************************************************/
70
71
72
73 /*******************************************************************************
74
75 Include Files
76
77 *******************************************************************************/
78 #define ENTITY_MFW
79
80 /* includes */
81 #include <string.h>
82 #include <stdio.h>
83 #include <stdlib.h>
84
85 #if defined (NEW_FRAME)
86
87 #include "typedefs.h"
88 #include "vsi.h"
89 #include "pei.h"
90 #include "custom.h"
91 #include "gsm.h"
92
93 #else
94
95 #include "STDDEFS.H"
96 #include "custom.h"
97 #include "gsm.h"
98 #include "vsi.h"
99
100 #endif
101 #include "mfw_sys.h"
102 #include "prim.h"
103
104
105
106 #include "mfw_mfw.h"
107 #include "mfw_win.h"
108 #include "mfw_kbd.h"
109 /* SPR#1428 - SH - New Editor changes */
110 #ifndef NEW_EDITOR
111 #include "mfw_edt.h"
112 #endif
113 #include "mfw_lng.h"
114 #include "mfw_icn.h"
115 #include "mfw_phb.h"
116 #include "mfw_sim.h"
117 #include "mfw_nm.h"
118 #include "mfw_sms.h"
119 #include "mfw_mnu.h"
120 #include "mfw_sat.h"
121 #include "mfw_tim.h"
122
123 #include "ksd.h"
124 #include "psa.h"
125 #include "dspl.h"
126
127
128 #include "MmiMmi.h"
129 #include "MmiDummy.h"
130 #include "MmiDialogs.h"
131 #include "MmiLists.h"
132
133 #include "MmiMain.h"
134 #include "MmiStart.h"
135 #include "MmiPins.h"
136 #include "MmiMenu.h"
137 #include "MmiSoftKeys.h"
138 #include "MmiSounds.h"
139 #include "mmiCall.h"
140
141 #include "mmiSat_i.h"
142
143 #include "cus_aci.h"
144
145 #include "prim.h"
146 #ifndef PCM_2_FFS
147 #include "pcm.h"
148 #endif
149
150
151 #include "mmiColours.h"
152
153 BOOL g_SATsession_is_active = FALSE;
154
155 // May 24, 2005 REF: CRR 29358 x0021334
156 static BOOL g_sat_scroll_status = FALSE; // to determine if the user has scrolled up/down
157 BOOL getScrollStatus(void); // function prototype
158
159 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462
160 #ifdef FF_MMI_SAT_ICON
161 static T_SAT_IconInfo setupMenuItemIconData, setupMenuHeaderIconData;
162 static T_SAT_IconInfo selectItemIconData, selectItemHeaderIconData;
163 #endif
164
165
166 /*********************************************************************
167 **********************************************************************
168
169 setup_menu DYNAMIC MENU WINDOW. DECLARATION
170
171 *********************************************************************
172 **********************************************************************/
173 typedef struct
174 {
175 /* administrative data */
176
177 T_MMI_CONTROL mmi_control;
178 T_MFW_HND win;
179 T_MFW_HND kbd; /* sbh - keyboard handler, so window can be destroyed by user */
180
181 /* associated handlers */
182
183 /* internal data */
184 T_SAT_CMD *sat_command; /* pointer to sat_command in parent */
185 ListMenuData_t list_menu_data;
186 } T_sat_setup_menu;
187
188 static T_MFW_HND sat_setup_menu_create (T_MFW_HND parent);
189 static void sat_setup_menu_destroy (T_MFW_HND window);
190 static void sat_setup_menu_exec (T_MFW_HND win, USHORT event, SHORT value, T_SAT_CMD * sat_command);
191 static void sat_setup_menu_listmnu_cb (T_MFW_HND win, ListMenuData_t * ListData);
192 static T_MFW sat_setup_menu_recreate(T_sat_setup_menu *data);
193
194 // May 24, 2005 REF: CRR 29358 x0021334
195 // Prototype declaratio for sat_select_TimerCb().
196 static int sat_select_TimerCb (T_MFW_EVENT event, T_MFW_TIM *timer);
197
198 static MfwMnuAttr sat_setup_menuAttrib =
199 {
200 &sat_setup_menuArea,
201 MNU_LEFT | MNU_LIST | MNU_CUR_LINE,
202 /* x0045876, 14-Aug-2006 (WR - integer conversion resulted in a change of sign) */
203 (UBYTE) -1, /* use default font */
204 NULL, /* with these items */
205 0 , /* number of items */
206 COLOUR_LIST_XX, TxtNull, NULL, MNUATTRSPARE,
207 /* 05-June-2006, x0045876 (OMAPS00060424 - Header Toggle) */
208 TRUE
209
210 };
211
212 static MfwMnuAttr sat_select_menuAttrib =
213 {
214 &sat_select_menuArea,
215 MNU_LEFT | MNU_LIST | MNU_CUR_LINE,
216 /* x0045876, 14-Aug-2006 (WR - integer conversion resulted in a change of sign) */
217 (UBYTE) -1, /* use default font */
218 NULL, /* with these items */
219 0, /* number of items */
220 COLOUR_LIST_XX, TxtNull, NULL, MNUATTRSPARE,
221 /* 05-June-2006, x0045876 (OMAPS00060424 - Header Toggle) */
222 TRUE
223 };
224
225 /* SPR#2492 - DS - Dynamically allocated string storage for SAT menu header */
226 static char* menuHdr = NULL;
227
228
229 /*********************************************************************
230 **********************************************************************
231
232 setup_menu DYNAMIC MENU WINDOW. IMPLEMENTATION
233
234 *********************************************************************
235 **********************************************************************/
236
237 T_MFW_HND sat_setup_menu_start(T_SAT_CMD * sat_command)
238 {
239 T_MFW_HND win;
240
241 TRACE_FUNCTION ("sat_setup_menu_start()");
242 /***************************Go-lite Optimization changes Start***********************/
243 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
244 TRACE_EVENT_P1("MFW Memory Left after starting SAT %d",mfwCheckMemoryLeft());
245 /***************************Go-lite Optimization changes end***********************/
246
247 win = sat_setup_menu_create (NULL);
248
249 if (win NEQ NULL)
250 {
251 SEND_EVENT (win, SAT_SETUP_MENU, 0, sat_command);
252 }
253 return win;
254 }
255
256 static T_MFW_HND sat_setup_menu_create(MfwHnd parent_window)
257 {
258 T_sat_setup_menu * data = (T_sat_setup_menu *)ALLOC_MEMORY (sizeof (T_sat_setup_menu));
259 T_MFW_WIN * win;
260
261 TRACE_EVENT ("sat_setup_menu_create()");
262
263 /*
264 * Create window handler
265 */
266
267 data->win = win_create (parent_window, 0, E_WIN_VISIBLE, (T_MFW_CB)sat_win_cb);
268 sat_set_setup_menu_win(data->win); // c030 rsa
269
270 if (data->win EQ NULL)
271 {
272 return NULL;
273 }
274
275 /*
276 * connect the dialog data to the MFW-window
277 */
278
279 data->mmi_control.dialog = (T_DIALOG_FUNC)sat_setup_menu_exec;
280 data->mmi_control.data = data;
281 win = ((T_MFW_HDR *)data->win)->data;
282 win->user = (MfwUserDataPtr)data;
283
284 data->kbd = kbdCreate( data->win, KEY_ALL, (T_MFW_CB) sat_kbd_cb); /* sbh - add keyboard handler */
285
286 /*
287 * return window handle
288 */
289
290
291 g_SATsession_is_active = TRUE;
292
293 win_show(data->win);
294 return data->win;
295 }
296
297 static void sat_setup_menu_destroy(MfwHnd own_window)
298 {
299 T_MFW_WIN * win_data;
300 T_sat_setup_menu * data;
301 int i;
302
303 TRACE_EVENT ("sat_setup_menu_destroy()");
304
305 g_SATsession_is_active = FALSE;
306
307 if (own_window)
308 {
309 win_data = ((T_MFW_HDR *)own_window)->data;
310 data = (T_sat_setup_menu *)win_data->user;
311
312 if (data)
313 {
314 /*
315 * Delete WIN handler
316 */
317 win_delete (data->win);
318
319 /*
320 * Free Memory
321 */
322
323 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462
324 #ifdef FF_MMI_SAT_ICON
325 /* Free the memory allocated for Item icon data. */
326 if(setupMenuItemIconData.dst != NULL)
327 {
328 FREE_MEMORY((U8 *)setupMenuItemIconData.dst, setupMenuItemIconData.width *
329 setupMenuItemIconData.height);
330 setupMenuItemIconData.dst = NULL;
331 }
332
333 /* Free the memory allocated for Header icon data. */
334 if(setupMenuHeaderIconData.dst != NULL)
335 {
336 FREE_MEMORY((U8 *)setupMenuHeaderIconData.dst, setupMenuHeaderIconData.width *
337 setupMenuHeaderIconData.height);
338 setupMenuHeaderIconData.dst = NULL;
339
340 //Apr 24, 2006 REF: DRT OMAPS00075832 x0039928
341 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462
342 if(data->list_menu_data.Attr->icon != NULL)
343 {
344 FREE_MEMORY((U8 *)data->list_menu_data.Attr->icon, sizeof (MfwIcnAttr));
345 data->list_menu_data.Attr->icon = NULL;
346 }
347 }
348 #endif
349
350 for (i=0; i < data->list_menu_data.ListLength; i++)
351 {
352 sat_destroy_ITEM_ASCIIZ (data->list_menu_data.List[i].str);
353
354 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462
355 #ifdef FF_MMI_SAT_ICON
356 if(data->list_menu_data.List[i].icon != NULL)
357 {
358 FREE_MEMORY((U8 *)data->list_menu_data.List[i].icon, sizeof (MfwIcnAttr));
359 data->list_menu_data.List[i].icon = NULL;
360 }
361 #endif
362 }
363 FREE_MEMORY ((U8 *)data->list_menu_data.List,
364 (data->list_menu_data.ListLength * sizeof (MfwMnuItem)));
365 data->list_menu_data.List = NULL;
366 FREE_MEMORY ((U8 *)data, sizeof (T_sat_setup_menu));
367
368 /* SPR#2492 - DS - Free SAT menu header if it exists */
369 if (menuHdr)
370 {
371 TRACE_EVENT_P2("Destroy menuHdr %d with size %d", menuHdr, *(menuHdr -(U16)sizeof(U16)) );
372 sat_destroy_TEXT_ASCIIZ(menuHdr);
373 menuHdr = NULL; /* dsm 01/12/03 - Added to explicitly set menuHdr to NULL */
374
375 }
376
377 sat_set_setup_menu_win(NULL); // c030 rsa
378 }
379 else
380 {
381 TRACE_EVENT ("sat_setup_menu_destroy() called twice");
382 }
383 }
384 }
385
386 static T_MFW sat_setup_menu_recreate(T_sat_setup_menu *data)
387 {
388 int i;
389 SatMenu * menu = &data->sat_command->c.menu;
390 int Unicode_menu = FALSE; /*MC, SPR 940/2flag to lay-out as Unicode*/
391 T_MFW retVal;
392
393 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462
394 #ifdef FF_MMI_SAT_ICON
395 USHORT icon_length;
396 USHORT fontHeight = 0, menuHeight = 0, titleHeight;
397 #endif
398
399 TRACE_EVENT ("sat_setup_menu_recreate()");
400
401 #ifdef __COMPLETE_LIST_SUPPORT__ /* ??? rsa for future extension */
402 if ((&data->sat_command.qual & SAT_M_SETUP_HELP_AVAIL) NEQ 0)
403 {
404 data->list_menu_data.AlternateLeftSoftKey = TxtHelp; /* help available */
405 }
406 else
407 {
408 data->list_menu_data.AlternateLeftSoftKey = TxtNull; /* no help available */
409 }
410 #endif
411
412 if (data->list_menu_data.List EQ NULL)
413 {
414 /* c030 rsa first time creation */
415 /* allocate sufficient memory to hold the list of menu items */
416 data->list_menu_data.ListLength = menu->nItems; /* actual number of entries in list menu. */
417 data->list_menu_data.List = (MfwMnuItem *)ALLOC_MEMORY (data->list_menu_data.ListLength * sizeof (MfwMnuItem));
418 memset(data->list_menu_data.List, 0x00, data->list_menu_data.ListLength * sizeof (MfwMnuItem));
419
420 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462
421 #ifdef FF_MMI_SAT_ICON
422 if(data->sat_command->c.menu.itemIconQual != 0xFF)
423 {
424 /* We have icon to be displayed*/
425 /* Copy the icon data to the editor attributes*/
426 setupMenuItemIconData.width = data->sat_command->c.menu.items[0].iconInfo.width;
427 setupMenuItemIconData.height = data->sat_command->c.menu.items[0].iconInfo.height;
428
429 icon_length = data->sat_command->c.menu.items[0].iconInfo.width * data->sat_command->c.menu.items[0].iconInfo.height;
430
431 setupMenuItemIconData.dst = (char *)ALLOC_MEMORY (icon_length);
432
433 memcpy(setupMenuItemIconData.dst, data->sat_command->c.menu.items[0].iconInfo.dst, icon_length);
434
435 /* Icon is self-explanatory. No need to display text for this case.*/
436 if(data->sat_command->c.menu.itemIconQual == 0x00)
437 {
438 /* Icon is self-explanatory. Do not display the text*/
439 setupMenuItemIconData.selfExplanatory = TRUE;
440 }
441 else
442 setupMenuItemIconData.selfExplanatory = FALSE;
443
444 /* Get the height of Title & Line. This will be used to calculate the icon co-ordinates. */
445 fontHeight = dspl_GetFontHeight();
446 titleHeight = res_getTitleHeight();
447
448 /* Set the initial menu height to the title height*/
449 menuHeight = titleHeight + ((fontHeight - 2) / 2) - (setupMenuItemIconData.height / 2);
450
451 /* Free the memory of icon data that we got through the SATK command*/
452 mfwFree((U8 *)data->sat_command->c.menu.items[0].iconInfo.dst, icon_length);
453 data->sat_command->c.menu.items[0].iconInfo.dst = NULL;
454 }
455 else
456 {
457 setupMenuItemIconData.width = 0;
458 setupMenuItemIconData.height = 0;
459 setupMenuItemIconData.dst = NULL;
460 setupMenuItemIconData.selfExplanatory = FALSE;
461 }
462 #endif
463
464 for (i=0; i < data->list_menu_data.ListLength; i++) /* Fill Menu List */
465 {
466 mnuInitDataItem(&data->list_menu_data.List[i]);
467
468 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462
469 #ifdef FF_MMI_SAT_ICON
470 if(data->sat_command->c.menu.itemIconQual != 0xFF)
471 {
472 /* Populate the Icon attributes.
473 We assume that we have the same icon for all elements in the item list. */
474 data->list_menu_data.List[i].icon = (MfwIcnAttr *)ALLOC_MEMORY (sizeof (MfwIcnAttr));
475
476 data->list_menu_data.List[i].icon->icons = setupMenuItemIconData.dst;
477 data->list_menu_data.List[i].icon->nIcons = 1;
478 data->list_menu_data.List[i].icon->icnType = BMP_FORMAT_256_COLOUR;
479 data->list_menu_data.List[i].icon->area.px = 1;
480 data->list_menu_data.List[i].icon->area.py = menuHeight + 1;
481 data->list_menu_data.List[i].icon->area.sx = setupMenuItemIconData.width;
482 data->list_menu_data.List[i].icon->area.sy = setupMenuItemIconData.height;
483 data->list_menu_data.List[i].icon->selfExplanatory = setupMenuItemIconData.selfExplanatory;
484
485 menuHeight += fontHeight;
486 }
487
488 /* get the correct entry in list of setup_menuList */
489 data->list_menu_data.List[i].str = sat_create_ITEM_ASCIIZ (&menu->items[i]);
490 if (data->list_menu_data.List[i].str[0] == (char)0x80)/*MC, SPR 940/2 check for unicode tag*/
491 Unicode_menu = TRUE;
492 #else
493 /* get the correct entry in list of setup_menuList */
494 data->list_menu_data.List[i].str = sat_create_ITEM_ASCIIZ (&menu->items[i]);
495 if (data->list_menu_data.List[i].str[0] == 0x80)/*MC, SPR 940/2 check for unicode tag*/
496 Unicode_menu = TRUE;
497 #endif
498 data->list_menu_data.List[i].flagFunc = (FlagFunc)item_flag_none;
499 }
500 }
501 data->list_menu_data.autoDestroy = TRUE;
502
503 TRACE_EVENT_P1("menu->header.len %d", menu->header.len);
504
505 /* SPR#2492 - DS - Setup menu header */
506 if (menu->header.len > 0 && menu->header.len != 0xFF)
507 {
508 if (menuHdr) /* Free previously allocated header */
509 {
510 TRACE_EVENT_P2("Destroy menuHdr %d with size %d", menuHdr, *(menuHdr -(U16)sizeof(U16)) );
511
512 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462
513 #ifdef FF_MMI_SAT_ICON
514 /* Free the memory allocated for Header icon data. */
515 if(setupMenuHeaderIconData.dst != NULL)
516 {
517 FREE_MEMORY((U8 *)setupMenuHeaderIconData.dst, setupMenuHeaderIconData.width *
518 setupMenuHeaderIconData.height);
519 setupMenuHeaderIconData.dst = NULL;
520 }
521 #endif
522 sat_destroy_TEXT_ASCIIZ(menuHdr);
523 menuHdr = NULL; /* dsm 01/12/03 - Added to explicitly set menuHdr to NULL */
524 }
525
526 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462
527 #ifdef FF_MMI_SAT_ICON
528 if(data->sat_command->c.menu.header.icon.qual != 0xFF)
529 {
530 /* We have icon to be displayed*/
531 /* Copy the icon data to the editor attributes*/
532 setupMenuHeaderIconData.width = data->sat_command->c.menu.header.iconInfo.width;
533 setupMenuHeaderIconData.height = data->sat_command->c.menu.header.iconInfo.height;
534
535 icon_length = data->sat_command->c.menu.header.iconInfo.width * data->sat_command->c.menu.header.iconInfo.height;
536
537 setupMenuHeaderIconData.dst = (char *)ALLOC_MEMORY (icon_length);
538
539 memcpy(setupMenuHeaderIconData.dst, data->sat_command->c.menu.header.iconInfo.dst, icon_length);
540
541 /* Icon is self-explanatory. No need to display text for this case.*/
542 if(data->sat_command->c.menu.header.icon.qual == 0x00)
543 {
544 /* Icon is self-explanatory. Do not display the text*/
545 setupMenuHeaderIconData.selfExplanatory = TRUE;
546 }
547 else
548 setupMenuHeaderIconData.selfExplanatory = FALSE;
549
550 /* Free the memory of icon data that we got through the SATK command*/
551 mfwFree((U8 *)data->sat_command->c.menu.header.iconInfo.dst, icon_length);
552 data->sat_command->c.menu.header.iconInfo.dst = NULL;
553 }
554 else
555 {
556 setupMenuHeaderIconData.width = 0;
557 setupMenuHeaderIconData.height = 0;
558 setupMenuHeaderIconData.dst = NULL;
559 setupMenuHeaderIconData.selfExplanatory = FALSE;
560 }
561 #endif
562
563 menuHdr = sat_create_TEXT_ASCIIZ(&menu->header);
564 TRACE_EVENT_P1("SAT menu header: %s", menuHdr);
565
566 /* SPR#2492 - DS - Display menu header if one exists */
567 if (menuHdr)
568 {
569 data->list_menu_data.Attr->hdrId = (int)menuHdr;
570
571 TRACE_EVENT_P1("mode map before: %04x", data->list_menu_data.Attr->mode);
572
573 /* SPR#2492 - DS - Use strings rather than text Ids */
574 data->list_menu_data.Attr->mode |= MNU_HDRFORMAT_STR;
575
576 TRACE_EVENT_P1("mode map after: %04x", data->list_menu_data.Attr->mode);
577
578 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462
579 #ifdef FF_MMI_SAT_ICON
580 /* We allow the Header text to be created. We send the icon data with self-explanatory status.*/
581 if(setupMenuHeaderIconData.dst != NULL)
582 {
583 data->list_menu_data.Attr->icon = (MfwIcnAttr *)ALLOC_MEMORY (sizeof (MfwIcnAttr));
584
585 data->list_menu_data.Attr->icon->icons = setupMenuHeaderIconData.dst;
586 data->list_menu_data.Attr->icon->nIcons = 1;
587 data->list_menu_data.Attr->icon->icnType = BMP_FORMAT_256_COLOUR;
588 data->list_menu_data.Attr->icon->area.px = 1;
589 data->list_menu_data.Attr->icon->area.py = 1;
590 data->list_menu_data.Attr->icon->area.sx = setupMenuHeaderIconData.width;
591 data->list_menu_data.Attr->icon->area.sy = setupMenuHeaderIconData.height;
592 data->list_menu_data.Attr->icon->selfExplanatory = setupMenuHeaderIconData.selfExplanatory;
593 }
594 #endif
595 }
596 }
597
598 retVal = listDisplayListMenu(data->win, &data->list_menu_data, (ListCbFunc)sat_setup_menu_listmnu_cb,Unicode_menu/*MC*/);
599 // xrashmic 5 Oct, 2005 MMI-SPR-29356, MMI-SPR-29357
600 // Displaying '?' to indicate to the user that help is available for a menu
601 if(data->sat_command->qual & SAT_M_SELECT_HELP_AVAIL)
602 {
603 displayHelpSymbol();
604 }
605 if (retVal != LISTS_FAIL)
606 sat_set_setup_menu_listmnu_win(data->list_menu_data.win);
607 else
608 sat_set_setup_menu_listmnu_win(NULL);
609
610 return retVal;
611 }
612
613 static void sat_setup_menu_exec (T_MFW_HND win, USHORT event, SHORT value, T_SAT_CMD * sat_command)
614 /* callback handler for events sent from parents or childs to to trigger some execution */
615 {
616 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
617 T_sat_setup_menu * data = (T_sat_setup_menu *)win_data->user;
618 T_SAT_RES sat_res;
619
620
621
622 TRACE_FUNCTION ("sat_setup_menu_exec()");
623
624 switch (event)
625 {
626 case SAT_SETUP_MENU:
627
628 TRACE_EVENT("sat_setup_menu_exec() SAT_SETUP_MENU");
629
630 /* initialization of administrative data */
631
632 data->sat_command = sat_command; /* save a pointer to the parameter for later use in callbacks */
633
634 /* initialization of the dialog data */
635
636 data->list_menu_data.ListPosition = 1;/* True cursor position in list menu. */
637 data->list_menu_data.Font = 0;
638 data->list_menu_data.LeftSoftKey = TxtSoftSelect;
639 data->list_menu_data.RightSoftKey = TxtSoftBack;
640 // xrashmic 5 Oct, 2005 MMI-SPR-29356, MMI-SPR-29357
641 //Adding the support for MenuSelect in this list view
642 data->list_menu_data.KeyEvents = KEY_CLEAR | KEY_RIGHT | KEY_LEFT | KEY_MNUSELECT| KEY_MNULEFT| KEY_MNUUP | KEY_MNUDOWN |KEY_HUP;
643 data->list_menu_data.Reason = 0;
644 data->list_menu_data.Strings = TRUE;
645 data->list_menu_data.Attr = &sat_setup_menuAttrib;
646 data->list_menu_data.List = NULL; /* c030 rsa mark as first time creation */
647 data->list_menu_data.autoDestroy = TRUE;
648
649 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462
650 #ifdef FF_MMI_SAT_ICON
651 /*Initialize the data members of Icon attributes */
652 setupMenuItemIconData.width = 0;
653 setupMenuItemIconData.height = 0;
654 setupMenuItemIconData.dst = NULL;
655 setupMenuItemIconData.selfExplanatory = FALSE;
656 setupMenuHeaderIconData.width = 0;
657 setupMenuHeaderIconData.height = 0;
658 setupMenuHeaderIconData.dst = NULL;
659 setupMenuHeaderIconData.selfExplanatory = FALSE;
660 #endif
661
662 // c030 rsa
663 /* NOBREAK */
664 case SAT_RETURN:
665
666 if (event == SAT_RETURN)
667 TRACE_EVENT("sat_setup_menu_exec() SAT_RETURN");
668
669 // end c030 rsa
670 if (sat_get_setup_menu_listmnu_win() == NULL)
671 {
672 /* (re)create the dialog handler */
673 if (sat_setup_menu_recreate(data) == LISTS_FAIL)
674 {
675 sat_res[SAT_ERR_INDEX] = SAT_RES_IMPOSSIBLE;
676 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
677 sat_done (sat_command, sat_res);
678 sat_setup_menu_destroy (data->win);
679 }
680 }
681 break;
682
683 /* sbh - all window types are being provided with this event to destroy the window */
684 case SAT_DESTROY_WINDOW:
685 /* ...sbh */
686
687 case SAT_EXIT:
688 sat_setup_menu_destroy (data->win);
689 break;
690
691 default:
692 TRACE_EVENT ("sat_setup_menu_exec() unexpected event");
693 break;
694 }
695 }
696
697 static void sat_setup_menu_listmnu_cb (T_MFW_HND win, ListMenuData_t * ListData)
698 /* sat_setup_menu menu event handler */
699 {
700 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
701 T_sat_setup_menu * data = (T_sat_setup_menu *)win_data->user;
702 SatItem * item;
703 int index;
704 // T_SAT_RES sat_res; // RAVI
705
706 TRACE_FUNCTION ("sat_setup_menu_listmnu_cb()");
707
708 if ((win EQ NULL) || (win_data EQ NULL) || (data EQ NULL))
709 return;
710
711 switch (ListData->Reason)
712 {
713 case E_MNU_SELECT:
714 case LISTS_REASON_SELECT:
715
716 index = ListData->ListPosition; /* index of selected item */
717 item = &data->sat_command->c.menu.items[index]; /* selected item */
718 // xrashmic 5 Oct, 2005 MMI-SPR-29356, MMI-SPR-29357
719 // Using the MenuSelect Key for requesting the help info in STK menu.
720 if(ListData->selectKey && ((data->sat_command->qual & SAT_M_SELECT_HELP_AVAIL) != 0))
721 {
722 satMenuItem(item->id, 1);
723 ListData->selectKey = FALSE;
724 }
725 else
726 satMenuItem(item->id, 0); /* issue the answering envelope */
727
728 /*
729 ** The SAT Menu is automatically destroyed when an item is selected
730 */
731 sat_set_setup_menu_listmnu_win(NULL);
732
733 /* sat_setup_menu_destroy(data->win); c030 rsa do not destroy in order to keep the menu on top */
734 break;
735 case LISTS_REASON_TIMEOUT: // c015 rsa
736 case LISTS_REASON_BACK: /* back to previous menu */
737 case LISTS_REASON_HANGUP: // sbh - added so hangup key exits
738 case LISTS_REASON_CLEAR:
739
740 /*
741 * we don't need to signal <SAT_RES_USER_BACK> here, since the session itself
742 * has been finished immediately after sat_setup_menu_proc().
743 * Furthermore the entering of the menu has not been signalled to the SIM...
744 */
745
746 /*
747 ** The SAT Menu is automatically destroyed and recreated when we move.
748 */
749 sat_set_setup_menu_listmnu_win(NULL);
750
751 sat_setup_menu_destroy(data->win);
752 break;
753 default:
754 return;
755 }
756 return;
757 }
758
759 /*********************************************************************
760 **********************************************************************
761
762 select_item DYNAMIC MENU WINDOW. DECLARATION
763
764 *********************************************************************
765 **********************************************************************/
766 typedef struct
767 {
768 /* administrative data */
769
770 T_MMI_CONTROL mmi_control;
771 T_MFW_HND win;
772
773 /* associated handlers */
774
775 T_MFW_HND kbd; /* sbh - keyboard handler, so window can be destroyed by user */
776
777 /* internal data */
778 T_SAT_CMD *sat_command; /* pointer to sat_command in parent */
779 ListMenuData_t list_menu_data;
780 T_MFW_HND sat_timer; // May 24, 2005 REF: CRR 29358 x0021334
781 ULONG sat_timeout; // May 24, 2005 REF: CRR 29358 x0021334
782 } T_sat_select_item;
783
784 static void sat_select_item_destroy (T_MFW_HND window);
785 static void sat_select_item_exec (T_MFW_HND win, USHORT event, SHORT value, T_SAT_CMD * sat_command);
786 static void sat_select_item_listmnu_cb (T_MFW_HND win, ListMenuData_t * ListData);
787 static T_MFW sat_select_item_recreate(T_sat_select_item *data);
788
789 /*********************************************************************
790 **********************************************************************
791
792 select_item DYNAMIC MENU WINDOW. IMPLEMENTATION
793
794 *********************************************************************
795 **********************************************************************/
796
797 T_MFW_HND sat_select_item_create(MfwHnd parent_window)
798 {
799 T_sat_select_item * data = (T_sat_select_item *)ALLOC_MEMORY (sizeof (T_sat_select_item));
800 T_MFW_WIN * win;
801
802 TRACE_FUNCTION ("sat_select_item_create()");
803
804 /*
805 * Create window handler
806 */
807
808 data->win = win_create (parent_window, 0, E_WIN_VISIBLE, (T_MFW_CB)sat_win_cb);
809 if (data->win EQ NULL)
810 {
811 return NULL;
812 }
813
814 /*
815 * connect the dialog data to the MFW-window
816 */
817
818 data->mmi_control.dialog = (T_DIALOG_FUNC)sat_select_item_exec;
819 data->mmi_control.data = data;
820 win = ((T_MFW_HDR *)data->win)->data;
821 win->user = (MfwUserDataPtr)data;
822
823 data->kbd = kbdCreate( data->win, KEY_ALL, (T_MFW_CB) sat_kbd_cb); /* sbh - add keyboard handler */
824
825 /*
826 * return window handle
827 */
828
829
830 win_show(data->win);
831 return data->win;
832 }
833
834 static void sat_select_item_destroy(MfwHnd own_window)
835 {
836 T_MFW_WIN * win_data;
837 T_sat_select_item * data;
838 int i;
839
840 TRACE_FUNCTION ("sat_select_item_destroy()");
841
842 if (own_window)
843 {
844 win_data = ((T_MFW_HDR *)own_window)->data;
845 data = (T_sat_select_item *)win_data->user;
846
847 if (data)
848 {
849 /*
850 * Delete WIN handler
851 */
852 win_delete (data->win);
853
854 /*
855 * Free Memory
856 */
857
858 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462
859 #ifdef FF_MMI_SAT_ICON
860 /* Free the memory allocated for Item icon data. */
861 if(selectItemIconData.dst != NULL)
862 {
863 FREE_MEMORY((U8 *)selectItemIconData.dst, selectItemIconData.width *
864 selectItemIconData.height);
865 selectItemIconData.dst = NULL;
866 }
867
868 /* Free the memory allocated for Header icon data. */
869 if(selectItemHeaderIconData.dst != NULL)
870 {
871 FREE_MEMORY((U8 *)selectItemHeaderIconData.dst, selectItemHeaderIconData.width *
872 selectItemHeaderIconData.height);
873 selectItemHeaderIconData.dst = NULL;
874
875 // Apr 24, 2006 REF: DRT OMAPS00075832 x0039928
876 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462
877 if(data->list_menu_data.Attr->icon != NULL)
878 {
879 FREE_MEMORY((U8 *)data->list_menu_data.Attr->icon, sizeof (MfwIcnAttr));
880 data->list_menu_data.Attr->icon = NULL;
881 }
882
883 }
884 #endif
885
886 for (i=0; i < data->list_menu_data.ListLength; i++)
887 {
888 sat_destroy_ITEM_ASCIIZ (data->list_menu_data.List[i].str);
889
890 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462
891 #ifdef FF_MMI_SAT_ICON
892 if(data->list_menu_data.List[i].icon != NULL)
893 {
894 FREE_MEMORY((U8 *)data->list_menu_data.List[i].icon, sizeof (MfwIcnAttr));
895 data->list_menu_data.List[i].icon = NULL;
896 }
897 #endif
898 }
899 FREE_MEMORY ((U8 *)data->list_menu_data.List,
900 (data->list_menu_data.ListLength * sizeof (MfwMnuItem)));
901 data->list_menu_data.List = NULL;
902 FREE_MEMORY ((U8 *)data, sizeof (T_sat_select_item));
903
904 /* SPR#2492 - DS - Free SAT menu header if it exists */
905 if (menuHdr)
906 {
907 TRACE_EVENT_P2("Destroy menuHdr %d with size %d", menuHdr, *(menuHdr -(U16)sizeof(U16)) );
908 sat_destroy_TEXT_ASCIIZ(menuHdr);
909 menuHdr = NULL; /* dsm 01/12/03 - Added to explicitly set menuHdr to NULL */
910
911 }
912 }
913 else
914 {
915 TRACE_EVENT ("sat_select_item_destroy() called twice");
916 }
917 }
918 }
919
920 static T_MFW sat_select_item_recreate(T_sat_select_item *data)
921 {
922 int i;
923 int Unicode_menu = FALSE; /*MC, SPR 940/2 flag to lay-out as Unicode*/
924 //May 24, 2005 REF: CRR 29358 x0021334
925 // Added this variable to store return value from listDisplayListMenu
926 T_MFW sat_select_item_status;
927
928 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462
929 #ifdef FF_MMI_SAT_ICON
930 USHORT icon_length;
931 USHORT fontHeight = 0, menuHeight = 0, titleHeight;
932 #endif
933
934 SatMenu * menu = &data->sat_command->c.menu;
935 TRACE_FUNCTION ("sat_select_item_recreate()");
936
937 #ifdef __COMPLETE_LIST_SUPPORT__ /* ??? rsa for future extension */
938 if ((&data->sat_command.qual & SAT_M_SELECT_HELP_AVAIL) NEQ 0)
939 {
940 data->list_menu_data.AlternateLeftSoftKey = TxtHelp; /* help available */
941 }
942 else
943 {
944 data->list_menu_data.AlternateLeftSoftKey = TxtNull; /* no help available */
945 }
946 #endif
947
948 /* allocate sufficient memory to hold the list of menu items */
949 data->list_menu_data.ListLength = menu->nItems; /* actual number of entries in list menu. */
950 data->list_menu_data.List = (MfwMnuItem *)ALLOC_MEMORY (data->list_menu_data.ListLength * sizeof (MfwMnuItem));
951 memset(data->list_menu_data.List, 0x00, data->list_menu_data.ListLength * sizeof (MfwMnuItem));
952
953 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462
954 #ifdef FF_MMI_SAT_ICON
955 if(menu->itemIconQual != 0xFF)
956 {
957 /* We have icon to be displayed*/
958 /* Copy the icon data to the editor attributes*/
959 selectItemIconData.width = menu->items[0].iconInfo.width;
960 selectItemIconData.height = menu->items[0].iconInfo.height;
961
962 icon_length = menu->items[0].iconInfo.width * menu->items[0].iconInfo.height;
963
964 selectItemIconData.dst = (char *)ALLOC_MEMORY (icon_length);
965
966 memcpy(selectItemIconData.dst, menu->items[0].iconInfo.dst, icon_length);
967
968 /* Icon is self-explanatory. No need to display text for this case.*/
969 if(menu->itemIconQual == 0x00)
970 {
971 /* Icon is self-explanatory. Do not display the text*/
972 selectItemIconData.selfExplanatory = TRUE;
973 }
974 else
975 selectItemIconData.selfExplanatory = FALSE;
976
977 /* Get the height of Title & Line. This will be used to calculate the icon co-ordinates. */
978 fontHeight = dspl_GetFontHeight();
979 titleHeight = res_getTitleHeight();
980
981 /* Set the initial menu height to the title height*/
982 menuHeight = titleHeight + ((fontHeight - 2) / 2) - (selectItemIconData.height / 2);
983
984 /* Free the memory of icon data that we got through the SATK command*/
985 mfwFree((U8 *)menu->items[0].iconInfo.dst, icon_length);
986 menu->items[0].iconInfo.dst = NULL;
987 }
988 else
989 {
990 selectItemIconData.width = 0;
991 selectItemIconData.height = 0;
992 selectItemIconData.dst = NULL;
993 selectItemIconData.selfExplanatory = FALSE;
994 }
995 #endif
996
997 for (i=0; i < data->list_menu_data.ListLength; i++) /* Fill Menu List */
998 {
999 mnuInitDataItem(&data->list_menu_data.List[i]);
1000
1001 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462
1002 #ifdef FF_MMI_SAT_ICON
1003 if(data->sat_command->c.menu.itemIconQual != 0xFF)
1004 {
1005 /* Populate the Icon attributes.
1006 We assume that we have the same icon for all elements in the item list. */
1007 data->list_menu_data.List[i].icon = (MfwIcnAttr *)ALLOC_MEMORY (sizeof (MfwIcnAttr));
1008
1009 data->list_menu_data.List[i].icon->icons = selectItemIconData.dst;
1010 data->list_menu_data.List[i].icon->nIcons = 1;
1011 data->list_menu_data.List[i].icon->icnType = BMP_FORMAT_256_COLOUR;
1012 data->list_menu_data.List[i].icon->area.px = 1;
1013 data->list_menu_data.List[i].icon->area.py = menuHeight + 1;
1014 data->list_menu_data.List[i].icon->area.sx = selectItemIconData.width;
1015 data->list_menu_data.List[i].icon->area.sy = selectItemIconData.height;
1016 data->list_menu_data.List[i].icon->selfExplanatory = selectItemIconData.selfExplanatory;
1017
1018 menuHeight += fontHeight;
1019 }
1020 /* get the correct entry in list of select_itemList */
1021 data->list_menu_data.List[i].str = sat_create_ITEM_ASCIIZ (&menu->items[i]);
1022 if (data->list_menu_data.List[i].str[0] == (char)0x80)/*MC, SPR 940/2 check for unicode tag*/
1023 Unicode_menu = TRUE;
1024 #else
1025 /* get the correct entry in list of select_itemList */
1026 data->list_menu_data.List[i].str = sat_create_ITEM_ASCIIZ (&menu->items[i]);
1027 if (data->list_menu_data.List[i].str[0] == 0x80)/*MC, SPR 940/2 check for unicode tag*/
1028 Unicode_menu = TRUE;
1029 #endif
1030
1031 data->list_menu_data.List[i].flagFunc = (FlagFunc)item_flag_none;
1032
1033 /* xreddymn OMAPS00080543 Jun-05-2006
1034 * A flag bit in item.action is set to TRUE for default item in decDefItem.
1035 */
1036 if(menu->items[i].action & 0x40)
1037 data->list_menu_data.ListPosition = i + 1;
1038
1039 }
1040
1041 data->list_menu_data.autoDestroy = TRUE;
1042
1043 TRACE_EVENT_P1("menu->header.len %d", menu->header.len);
1044
1045 /* SPR#2492 - DS - Setup menu header */
1046 if (menu->header.len > 0 && menu->header.len != 0xFF)
1047 {
1048 if (menuHdr) /* Free previously allocated header */
1049 {
1050 TRACE_EVENT_P2("Destroy menuHdr %d with size %d", menuHdr, *(menuHdr -(U16)sizeof(U16)) );
1051 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462
1052 #ifdef FF_MMI_SAT_ICON
1053 /* Free the memory allocated for Header icon data. */
1054 if(selectItemHeaderIconData.dst != NULL)
1055 {
1056 FREE_MEMORY((U8 *)selectItemHeaderIconData.dst, selectItemHeaderIconData.width *
1057 selectItemHeaderIconData.height);
1058 selectItemHeaderIconData.dst = NULL;
1059 }
1060 #endif
1061 sat_destroy_TEXT_ASCIIZ(menuHdr);
1062 menuHdr = NULL; /* dsm 01/12/03 - Added to explicitly set menuHdr to NULL */
1063 }
1064
1065 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462
1066 #ifdef FF_MMI_SAT_ICON
1067 if(data->sat_command->c.menu.header.icon.qual != 0xFF)
1068 {
1069 /* We have icon to be displayed*/
1070 /* Copy the icon data to the editor attributes*/
1071 selectItemHeaderIconData.width = data->sat_command->c.menu.header.iconInfo.width;
1072 selectItemHeaderIconData.height = data->sat_command->c.menu.header.iconInfo.height;
1073
1074 icon_length = data->sat_command->c.menu.header.iconInfo.width * data->sat_command->c.menu.header.iconInfo.height;
1075
1076 selectItemHeaderIconData.dst = (char *)ALLOC_MEMORY (icon_length);
1077
1078 memcpy(selectItemHeaderIconData.dst, data->sat_command->c.menu.header.iconInfo.dst, icon_length);
1079
1080 /* Icon is self-explanatory. No need to display text for this case.*/
1081 if(data->sat_command->c.menu.header.icon.qual == 0x00)
1082 {
1083 /* Icon is self-explanatory. Do not display the text*/
1084 selectItemHeaderIconData.selfExplanatory = TRUE;
1085 }
1086 else
1087 selectItemHeaderIconData.selfExplanatory = FALSE;
1088
1089 /* Free the memory of icon data that we got through the SATK command*/
1090 mfwFree((U8 *)data->sat_command->c.menu.header.iconInfo.dst, icon_length);
1091 data->sat_command->c.menu.header.iconInfo.dst = NULL;
1092 }
1093 else
1094 {
1095 selectItemHeaderIconData.width = 0;
1096 selectItemHeaderIconData.height = 0;
1097 selectItemHeaderIconData.dst = NULL;
1098 selectItemHeaderIconData.selfExplanatory = FALSE;
1099 }
1100 #endif
1101
1102
1103 menuHdr = sat_create_TEXT_ASCIIZ(&menu->header);
1104 TRACE_EVENT_P1("SAT menu header: %s", menuHdr);
1105
1106 /* SPR#2492 - DS - Display menu header if one exists */
1107 if (menuHdr)
1108 {
1109 data->list_menu_data.Attr->hdrId = (int)menuHdr;
1110
1111 TRACE_EVENT_P1("mode map before: %04x", data->list_menu_data.Attr->mode);
1112
1113 /* SPR#2492 - DS - Use strings rather than text Ids */
1114 data->list_menu_data.Attr->mode |= MNU_HDRFORMAT_STR;
1115
1116 TRACE_EVENT_P1("mode map after: %04x", data->list_menu_data.Attr->mode);
1117
1118 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462
1119 #ifdef FF_MMI_SAT_ICON
1120 /* We allow the Header text to be created. We send the icon data with self-explanatory status.*/
1121 if(selectItemHeaderIconData.dst != NULL)
1122 {
1123 data->list_menu_data.Attr->icon = (MfwIcnAttr *)ALLOC_MEMORY (sizeof (MfwIcnAttr));
1124
1125 data->list_menu_data.Attr->icon->icons = selectItemHeaderIconData.dst;
1126 data->list_menu_data.Attr->icon->nIcons = 1;
1127 data->list_menu_data.Attr->icon->icnType = BMP_FORMAT_256_COLOUR;
1128 data->list_menu_data.Attr->icon->area.px = 1;
1129 data->list_menu_data.Attr->icon->area.py = 1;
1130 data->list_menu_data.Attr->icon->area.sx = selectItemHeaderIconData.width;
1131 data->list_menu_data.Attr->icon->area.sy = selectItemHeaderIconData.height;
1132 data->list_menu_data.Attr->icon->selfExplanatory = selectItemHeaderIconData.selfExplanatory;
1133 }
1134 #endif
1135 }
1136 }
1137
1138 // May 24, 2005 REF: CRR 29358 x0021334
1139 // Description: CT_PTCRB 27.22.4.9.8 fails: wrong terminal response
1140 // Now the list will be displayed, so start the timer.
1141 sat_select_item_status = listDisplayListMenu(data->win, &data->list_menu_data, (ListCbFunc)sat_select_item_listmnu_cb,Unicode_menu/*MC*/);
1142 // xrashmic 5 Oct, 2005 MMI-SPR-29356, MMI-SPR-29357
1143 // Displaying '?' to indicate to the user that help is available for a menu
1144 if(data->sat_command->qual & SAT_M_SELECT_HELP_AVAIL)
1145 {
1146 displayHelpSymbol();
1147 }
1148 tim_start(data->sat_timer);
1149 return sat_select_item_status;
1150 }
1151
1152 static void sat_select_item_exec (T_MFW_HND win, USHORT event, SHORT value, T_SAT_CMD * sat_command)
1153 /* callback handler for events sent from parents or childs to to trigger some execution */
1154 {
1155 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
1156 T_sat_select_item * data = (T_sat_select_item *)win_data->user;
1157 T_SAT_RES sat_res;
1158
1159 TRACE_FUNCTION ("sat_select_item_exec()");
1160
1161 switch (event)
1162 {
1163 case SAT_SELECT_ITEM:
1164 /* initialization of administrative data */
1165
1166 data->sat_command = sat_command; /* save a pointer to the parameter for later use in callbacks */
1167
1168 /* initialization of the dialog data */
1169 data->list_menu_data.ListPosition = 1;/* True cursor position in list menu. */
1170 data->list_menu_data.Font = 0;
1171 data->list_menu_data.LeftSoftKey = TxtSoftSelect;
1172 data->list_menu_data.RightSoftKey = TxtSoftBack;
1173 // xrashmic 5 Oct, 2005 MMI-SPR-29356, MMI-SPR-29357
1174 //Adding the support for MenuSelect in this list view
1175 data->list_menu_data.KeyEvents = KEY_CLEAR | KEY_RIGHT | KEY_LEFT | KEY_MNUSELECT| KEY_MNULEFT| KEY_MNUUP | KEY_MNUDOWN|KEY_HUP;
1176 data->list_menu_data.Reason = 0;
1177 data->list_menu_data.Strings = TRUE;
1178 data->list_menu_data.Attr = &sat_select_menuAttrib;
1179 data->list_menu_data.autoDestroy = TRUE;
1180
1181 // May 24, 2005 REF: CRR 29358 x0021334
1182 // Description: CT_PTCRB 27.22.4.9.8 fails: wrong terminal response
1183 // Fix: Set Timeout period to 20 seconds and create the timer.
1184 data->sat_timeout = TWENTY_SECS;
1185 data->sat_timer = tim_create(data->win, data->sat_timeout, (T_MFW_CB)sat_select_TimerCb);
1186 g_sat_scroll_status = TRUE;
1187
1188 // Shashi Shekar B.S., a0876501, Feb 4, 2006, DR: OMAPS00061462
1189 #ifdef FF_MMI_SAT_ICON
1190 /*Initialize the data members of Icon attributes */
1191 selectItemIconData.width = 0;
1192 selectItemIconData.height = 0;
1193 selectItemIconData.dst = NULL;
1194 selectItemIconData.selfExplanatory = FALSE;
1195 selectItemHeaderIconData.width = 0;
1196 selectItemHeaderIconData.height = 0;
1197 selectItemHeaderIconData.dst = NULL;
1198 selectItemHeaderIconData.selfExplanatory = FALSE;
1199 #endif
1200
1201 /* (re)create the dialog handler */
1202 if (sat_select_item_recreate(data) == LISTS_FAIL)
1203 {
1204 sat_res[SAT_ERR_INDEX] = SAT_RES_IMPOSSIBLE;
1205 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
1206 sat_done (sat_command, sat_res);
1207 // May 24, 2005 REF: CRR 29358 x0021334
1208 // Delete the timer and set g_sat_scroll_status to FALSE.
1209 tim_delete (data->sat_timer);
1210 g_sat_scroll_status = FALSE;
1211 sat_select_item_destroy (data->win);
1212 }
1213 break;
1214
1215 /* sbh - all window types are being provided with this event to destroy the window */
1216 case SAT_DESTROY_WINDOW:
1217 // May 24, 2005 REF: CRR 29358 x0021334
1218 // Delete the timer and set g_sat_scroll_status to FALSE.
1219 tim_delete (data->sat_timer);
1220 g_sat_scroll_status = FALSE;
1221 sat_select_item_destroy (data->win);
1222 break;
1223 /* ...sbh */
1224
1225 // May 24, 2005 REF: CRR 29358 x0021334
1226 // Description: CT_PTCRB 27.22.4.9.8 fails: wrong terminal response
1227 // Fix: Timeout has occured. Used existing LISTS_REASON_TIMEOUT event for the same
1228 case LISTS_REASON_TIMEOUT:
1229 sat_res[SAT_ERR_INDEX] = SAT_RES_USER_NO_RESP; // set no response from user
1230 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
1231 sat_done (data->sat_command, sat_res);
1232 tim_stop(data->sat_timer); // stop the timer
1233 tim_delete(data->sat_timer); // delete the timer
1234 g_sat_scroll_status = FALSE; // set scrolling status to FALSE
1235 sat_select_item_destroy(data->win);
1236 break;
1237
1238 // May 24, 2005 REF: CRR 29358 x0021334
1239 // Description: CT_PTCRB 27.22.4.9.8 fails: wrong terminal response
1240 // Fix: User has scrolled up/down. Used existing LISTS_REASON_SCROLL event for the same
1241 case LISTS_REASON_SCROLL:
1242 tim_stop(data->sat_timer); // stop the timer
1243 tim_start(data->sat_timer); // start the timer again for 20 seconds
1244 break;
1245 default:
1246 TRACE_EVENT ("sim_select_item_exec() unexpected event");
1247 break;
1248 }
1249 }
1250
1251 static void sat_select_item_listmnu_cb (T_MFW_HND win, ListMenuData_t * ListData)
1252 /* sat_select_item menu event handler */
1253 {
1254 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
1255 T_sat_select_item * data = (T_sat_select_item *)win_data->user;
1256 SatItem * item;
1257 int index;
1258 T_SAT_RES sat_res;
1259
1260 if ((win EQ NULL) || (win_data EQ NULL) || (data EQ NULL))
1261 return;
1262
1263 TRACE_FUNCTION ("sat_select_item_listmnu_cb()");
1264
1265 switch (ListData->Reason)
1266 {
1267 case E_MNU_SELECT:
1268 case LISTS_REASON_SELECT:
1269 index = ListData->ListPosition; /* index of selected item */
1270 item = &data->sat_command->c.menu.items[index]; /* selected item */
1271 /* CQ 16307 - Start */
1272 if (data->sat_command->c.menu.itemIconQual == 0xFF)
1273 sat_res[SAT_ERR_INDEX] = SatResSuccess;
1274 else
1275 {
1276 // Shashi Shekar B.S., a0876501, Jan 16, 2006, DR: OMAPS00061460
1277 #ifdef FF_MMI_SAT_ICON
1278 sat_res[SAT_ERR_INDEX] = SatResSuccess;
1279 #else
1280 sat_res[SAT_ERR_INDEX] = SatResNoIcon;
1281 /* CQ 16307 - End */
1282 #endif
1283 }
1284
1285
1286 // xrashmic 5 Oct, 2005 MMI-SPR-29356, MMI-SPR-29357
1287 // Using the MenuSelect Key for requesting the help info in STK menu.
1288 if(ListData->selectKey && ((data->sat_command->qual & SAT_M_SELECT_HELP_AVAIL) != 0))
1289 {
1290 sat_res[SAT_ERR_INDEX] = SatResUserHelp;
1291 ListData->selectKey = FALSE;
1292 }
1293 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
1294 satItem (data->sat_command, item->id, sat_res, sizeof(T_SAT_RES)); /* issue the answering envelope */
1295
1296
1297 // May 24, 2005 REF: CRR 29358 x0021334
1298 // Stop and delete the timer. Also, set scrolling status to FALSE
1299 tim_stop(data->sat_timer);
1300 tim_delete(data->sat_timer);
1301 g_sat_scroll_status = FALSE;
1302 sat_select_item_destroy(data->win);
1303 break;
1304 // c015 rsa
1305 case LISTS_REASON_TIMEOUT:
1306 sat_res[SAT_ERR_INDEX] = SAT_RES_USER_NO_RESP;
1307 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
1308 sat_done (data->sat_command, sat_res);
1309 sat_select_item_destroy(data->win);
1310 break;
1311 // end c015 rsa
1312 case LISTS_REASON_CLEAR: /* abort */
1313 case LISTS_REASON_HANGUP: /* abort */
1314 sat_res[SAT_ERR_INDEX] = SAT_RES_USER_ABORT;
1315 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
1316 sat_done (data->sat_command, sat_res);
1317 sat_select_item_destroy(data->win);
1318 break;
1319 case LISTS_REASON_BACK: /* back to previous menu */
1320 sat_res[SAT_ERR_INDEX] = SAT_RES_USER_BACK;
1321 sat_res[SAT_AI_INDEX] = SatResAiNoCause;
1322 sat_done (data->sat_command, sat_res);
1323
1324 // May 24, 2005 REF: CRR 29358 x0021334
1325 // Stop and delete the timer. Also, set scrolling status to FALSE
1326 tim_stop(data->sat_timer);
1327 tim_delete(data->sat_timer);
1328 g_sat_scroll_status = FALSE;
1329 sat_select_item_destroy(data->win);
1330 break;
1331 default:
1332 return;
1333 }
1334 return;
1335 }
1336 // end c016 rsa
1337
1338 // May 24, 2005 REF: CRR 29358 x0021334
1339 // Description: CT_PTCRB 27.22.4.9.8 fails: wrong terminal response
1340 // Fix: This is the call back function for sat timer
1341 static int sat_select_TimerCb (T_MFW_EVENT event, T_MFW_TIM *timer)
1342 {
1343 T_MFW_HND win = mfw_parent (mfw_header());
1344 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
1345 T_sat_select_item *data = (T_sat_select_item *)win_data->user;
1346
1347 TRACE_FUNCTION("sat_select_TimerCb()");
1348
1349 // Destroy the list before going back to the sat menu
1350 listsDestroy(data->list_menu_data.win);
1351 // Send timeout event.
1352 SEND_EVENT (data->win, LISTS_REASON_TIMEOUT, NULL, NULL);
1353 return MFW_EVENT_CONSUMED;
1354 }
1355
1356 // May 24, 2005 REF: CRR 29358 x0021334
1357 // Description: CT_PTCRB 27.22.4.9.8 fails: wrong terminal response
1358 // Fix: This function returns the status of scrolling, which is used for restarting the timer
1359 BOOL getScrollStatus()
1360 {
1361 return g_sat_scroll_status;
1362 }