comparison src/aci2/bmi/MmiEditor.c @ 3:93999a60b835

src/aci2, src/condat2: import of g23m/condat source pieces from TCS211
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 26 Sep 2016 00:29:36 +0000
parents
children
comparison
equal deleted inserted replaced
2:c41a534f33c6 3:93999a60b835
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: MMI
15 $File: MmiEditor.c
16 $Revision: 1.0
17
18 $Author: Condat(UK)
19 $Date: 22/02/01
20
21 ********************************************************************************
22
23 Description:
24
25
26
27 ********************************************************************************
28
29 $History: MmiMain.c
30 Nov 24, 2005 DR: OMAPS00045909 - Shashi Shekar B.S.
31 Description: Improve IMEI control mechanism
32 Solution : When MMI calls sAT_PLUSCFUN, if an IMEI invalid error is returned,
33 we will block on that screen & will not allow the user to browse menus further,
34 since the PS will not be booted at all!!!
35
36 May 02, 2005 REF : LOCOSTO-ENH-30818 - xpradipg
37 Description: IMEI retreival by posting a call to ACI sAT_xx API
38 Solution: The direct call to cl_get_imeisv() is replaced with the
39 call to the callNUmber() which inturn calls sAT_Dn() and
40 retrieves the IMEI info
41 Aug 16, 2004 REF: CRR 24323 Deepa M.D
42 Bug:Clenup of sprintf used for tracing
43 Fix:Replace the char buf[]; sprintf (buf, "...", ...); TRACE_EVENT (buf); statements by TRACE_EVENT_PX
44
45 25/10/00 Original Condat(UK) BMI version.
46 $End
47
48 *******************************************************************************/
49
50 #define ENTITY_MFW
51
52 /* includes */
53 #include <string.h>
54 #include <stdio.h>
55 #include <stdlib.h>
56
57 #if defined (NEW_FRAME)
58
59 #include "typedefs.h"
60 #include "vsi.h"
61 #include "pei.h"
62 #include "custom.h"
63 #include "gsm.h"
64
65 #else
66
67 #include "STDDEFS.H"
68 #include "custom.h"
69 #include "gsm.h"
70 #include "vsi.h"
71
72 #endif
73 #include "mfw_mfw.h"
74 #include "mfw_win.h"
75 #include "mfw_kbd.h"
76 #include "mfw_edt.h"
77 #include "mfw_tim.h"
78 #include "mfw_phb.h"
79 #include "mfw_sms.h"
80 #include "mfw_ss.h"
81 #include "mfw_icn.h"
82 #include "mfw_mnu.h"
83 #include "mfw_lng.h"
84 #include "mfw_sat.h"
85 #include "mfw_kbd.h"
86 #include "mfw_nm.h"
87 #include "mfw_cm.h"
88
89 #include "dspl.h"
90
91 #include "ksd.h"
92 #include "psa.h"
93
94 #include "MmiMain.h"
95 #include "MmiDummy.h"
96 #include "MmiMmi.h"
97
98 #include "MmiDialogs.h"
99 #include "MmiLists.h"
100 #include "MmiMenu.h"
101 #include "MmiSoftKeys.h"
102
103 #include "MmiIdle.h"
104 #include "MmiEditor.h"
105 #include "MmiEditor_i.h"
106
107 #include "cus_aci.h"
108
109 #ifndef PCM_2_FFS
110 #include "pcm.h"
111 #endif
112
113 #include "Mmiicons.h"
114 #include "MmiBookShared.h"
115 #include "mmiSmsMenu.h"
116 #include "mfw_ffs.h"
117 #ifdef EASY_TEXT_ENABLED
118 #include "MmiLatinPredText.h"
119 #include "MmiDictionary.h"
120 #endif /* EASY_TEXT_ENABLED */
121
122 #include "mmiColours.h"
123
124 #ifndef MFW_EVENT_PASSED
125 #define MFW_EVENT_PASSED 0
126 #endif
127
128 /*********************************************************************
129 **********************************************************************
130
131 DYNAMIC EDITOR WINDOW. DECLARATION
132
133 *********************************************************************
134 **********************************************************************/
135 /*
136 * Internal events
137 */
138
139
140
141 static T_MFW_HND editor_create (T_MFW_HND parent);
142 //SH - static void editor_destroy (T_MFW_HND window);
143 static void editor_exec_cb (T_MFW_HND win,USHORT event, SHORT value, T_EDITOR_DATA * editor_data);
144 static int editor_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);
145 static int editor_kbd_cb (T_MFW_EVENT event, T_MFW_KBD * keyboard);
146 static int editor_tim_cb (T_MFW_EVENT event, T_MFW_TIM *tc);
147
148
149 static char SymbolPrompt[40] = "123456789";
150 static int DoNextLongPress = FALSE;
151
152 static UBYTE UPPER_CASE = FALSE;
153 extern int upCase;
154 static UBYTE over_length_label = FALSE;
155
156 static UBYTE AllowPredText = FALSE;
157 extern int SymbolChar;
158 static const unsigned char TextIconeZiTextSmall[] =
159 {
160 0x03,
161 0x03,
162 0x18,
163 0x7c,
164 0xcc,
165 0x08,
166 0x10,
167 0x0c
168 };
169
170 /* internal used functions: */
171 static void editor_hideInit(T_EDITOR_INFO *data);
172 static void editor_hideInsert(T_EDITOR_INFO *data, U8 key);
173 static void editor_hideClear(T_EDITOR_INFO *data);
174 static void editor_hideClearAll(T_EDITOR_INFO *data);
175 static void editor_hideTerminate(T_EDITOR_INFO *data);
176
177
178 /*********************************************************************
179 **********************************************************************
180
181 DYNAMIC EDITOR WINDOW. IMPLEMENTATION
182
183 *********************************************************************
184 **********************************************************************/
185
186 void editor_data_init( T_EDITOR_DATA* editor_info, T_EDIT_CB callback,USHORT lsk, USHORT rsk, USHORT txtId, USHORT min_num_char, UBYTE mode, ULONG timeout)
187 {
188
189 editor_info->LeftSoftKey = lsk;
190 editor_info->RightSoftKey = rsk;
191 editor_info->TextId = txtId;
192 editor_info->mode = mode;
193 editor_info->Callback = callback;
194 editor_info->min_enter = min_num_char;
195 editor_info->timeout = timeout;
196
197 //Set-up default values
198 editor_info->AlternateLeftSoftKey = TxtNull;
199 editor_info->Identifier = 0; /* optional */
200
201 editor_info->FormatString = NULL;
202 editor_info->formatIndex = 0;
203 editor_info->fieldIndex = 0;
204
205 //Set-up default values - the defaults may change depending on what other editors do
206 editor_info->hide = FALSE;
207 editor_info->TextString = NULL;
208 editor_info->destroyEditor = TRUE;
209
210 }
211
212 /*******************************************************************************
213
214 $Function: calculateWindow
215
216 $Description: initialises the size of the editor based on the screen size and the 'zone_id'
217 which controls what part of the screen the editor should be in.
218
219 $Returns: An updated 'attr' with values for the editor window position and size
220
221 $Arguments: zone_id - bitmapped word which defines the editor size and position
222 The definitions are in MMIEditor.h
223 The most common sizes are
224 full screen
225 full screen with softkkeys
226 full screen with title and softkeys
227 but the macros also support part screens (with/without icons/titles/softkeys) eg.
228 left screen :- middle width screen right screen
229 xxxx---- --xxxx-- ----xxxx
230 xxxx---- --xxxx-- ----xxxx
231 xxxx---- --xxxx-- ----xxxx
232 xxxx---- --xxxx-- ----xxxx
233 top screen :- middle ht screen bottom screen
234 xxxxxxxx -------- ---------
235 xxxxxxxx xxxxxxxx ---------
236 -------- xxxxxxxx xxxxxxxxx
237 -------- -------- xxxxxxxxx
238 or any combination of width/height.
239 An Id of 0 is assumed to be undefined and is treated as full screen plus softkeys.
240 *******************************************************************************/
241 #ifndef LSCREEN
242 //Sizes defined for CSAMPLE editore
243 #define BOOKDETAILS_EDITOR_SIZE 0, 0, SCREEN_SIZE_X-4, Mmi_layout_line(LAST_LINE_TOP)
244 #define NUMBER_EDITOR_SIZE 0, 12, SCREEN_SIZE_X , MNU3LINE
245 #define PHONEBOOK_DLG_EDITOR_SIZE 4, Mmi_layout_line(3)+2, SCREEN_SIZE_X-4, SCREEN_SIZE_Y-(Mmi_layout_line(3)+2)
246 #define BOOKSDN_EDITOR_SIZE 34, Mmi_layout_line(3)+2, 50, Mmi_layout_line(1)+2
247
248 //MMICall
249 #define CALL_EDITOR_SIZE 4,28,SCREEN_SIZE_X-4, 20
250 #define CALLSCRATCHPAD_EDITOR_SIZE 6, Mmi_layout_line(2),SCREEN_SIZE_X-6, 16
251
252 //MMIServices
253 #define SERVICE_CREATE_EDITOR_SIZE 4,Mmi_layout_line(1)+2,SCREEN_SIZE_X-4, MNU3LINE
254 #define PASSWORD_EDITOR_SIZE 0, 12, SCREEN_SIZE_X , 13
255
256 //From MMIIdle
257 //GW Changed window height from 30 (27?) to 24.
258 #define WIN_DIALLING_SIZE 0,Mmi_layout_line_icons(2), SCREEN_SIZE_X,24
259 #define WIN_DIALLING_C_SIZE 0,Mmi_layout_line_icons(1),SCREEN_SIZE_X,32
260
261 //Positions for editor windows in mmismssend
262 #define PHNO_EDITOR_SIZE 0, (Mmi_layout_line(1)+2), SCREEN_SIZE_X, 20
263
264 //NB defines below used twice, second time START/SIZE_Y was same as START/SIZE_Y above
265 #define CENTRE_EDITOR_SIZE 0, Mmi_layout_line(1), SCREEN_SIZE_X, MNU3LINE+3
266
267 //And for MMIServices - moved here from mmiservices.c
268 #define SAT_EDITOR_SIZE 6,30,SCREEN_SIZE_X-6, 20
269
270 #define RPWD_EDITOR_SIZE 0,12,SCREEN_SIZE_X,13
271
272 //MMIBookCallDetails
273 #define PHB_EDITOR_SIZE 4,0,SCREEN_SIZE_X-4, ALLBUT2LINE
274
275 //MMIPins
276 #define PIN_EDIT_RESET_SIZE 12,20,84-12,16
277
278 //MMITimeDate
279 #define TIMEDATE_EDITOR_AREA_SIZE 0,10,70,10
280 #endif
281 void setSize(MfwRect *win, int px, int py, int sx, int sy)
282 {
283 win->px = px; win->py = py;
284 win->sx = sx; win->sy = sy;
285 }
286
287 void getSpecificWindowSize(MfwEdtAttr* attr, int zone_id )
288 {
289 switch (zone_id)
290 {
291 case ZONE_SMALL_EDITOR:
292 attr->win.px = 6;
293 attr->win.py = Mmi_layout_IconHeight()*2;
294 attr->win.sx = SCREEN_SIZE_X-attr->win.px;
295 attr->win.sy = Mmi_layout_line_height()*2+4;
296 break;
297 case ZONE_BOTTOM_LINE:
298 attr->win.px = 0;
299 attr->win.py = SCREEN_SIZE_Y - Mmi_layout_line_height() - Mmi_layout_softkeyHeight();
300 attr->win.sx = SCREEN_SIZE_X-attr->win.px;
301 attr->win.sy = Mmi_layout_line_height();
302 break;
303 case ZONE_BOTTOM_LINE_FIND: //used for phonebook search
304 attr->win.px = dspl_GetTextExtent(MmiRsrcGetText(TxtFind),0);
305 attr->win.py = SCREEN_SIZE_Y - Mmi_layout_line_height() - Mmi_layout_softkeyHeight();
306 attr->win.sx = SCREEN_SIZE_X-attr->win.px;
307 attr->win.sy = Mmi_layout_line_height();
308 break;
309
310 #ifndef LSCREEN
311 case BOOKDETAILS_EDITOR: setSize(&attr->win,BOOKDETAILS_EDITOR_SIZE); break;
312 case NUMBER_EDITOR: setSize(&attr->win,NUMBER_EDITOR_SIZE); break;
313 case PHONEBOOK_DLG_EDITOR: setSize(&attr->win,PHONEBOOK_DLG_EDITOR_SIZE); break;
314 case BOOKSDN_EDITOR: setSize(&attr->win,BOOKSDN_EDITOR_SIZE); break;
315 case CALL_EDITOR: setSize(&attr->win,CALL_EDITOR_SIZE); break;
316 case CALLSCRATCHPAD_EDITOR: setSize(&attr->win,CALLSCRATCHPAD_EDITOR_SIZE); break;
317 case SERVICE_CREATE_EDITOR: setSize(&attr->win,SERVICE_CREATE_EDITOR_SIZE); break;
318 case PASSWORD_EDITOR: setSize(&attr->win,PASSWORD_EDITOR_SIZE); break;
319
320 case WIN_DIALLING:
321 case WIN_DIALLING_CB:
322 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)
323 setSize(&attr->win,WIN_DIALLING_C_SIZE);
324 else
325 setSize(&attr->win,WIN_DIALLING_SIZE);
326 break;
327 case WIN_DIALLING_SMS:
328 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)
329 {
330 setSize(&attr->win,0,Mmi_layout_line_icons(1),84,24);
331 }
332 else
333 setSize(&attr->win,WIN_DIALLING_SIZE);
334 break;
335 case WIN_DIALLING_SAT:
336 if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)
337 setSize(&attr->win,WIN_DIALLING_C_SIZE);
338 else
339 setSize(&attr->win,WIN_DIALLING_SIZE);
340 break;
341
342 case PHNO_EDITOR: setSize(&attr->win,PHNO_EDITOR_SIZE); break;
343 case CENTRE_EDITOR: setSize(&attr->win,CENTRE_EDITOR_SIZE); break;
344 case SAT_EDITOR : setSize(&attr->win,SAT_EDITOR_SIZE); break;
345 case RPWD_EDITOR: setSize(&attr->win,RPWD_EDITOR_SIZE); break;
346 case PHB_EDITOR: setSize(&attr->win,PHB_EDITOR_SIZE); break;
347 case PIN_EDIT_RESET: setSize(&attr->win,PIN_EDIT_RESET_SIZE); break;
348 case TIMEDATE_EDITOR_AREA: setSize(&attr->win,TIMEDATE_EDITOR_AREA_SIZE); break;
349 #endif
350 default:
351 break;
352 }
353 }
354
355 void calculateWindow(MfwEdtAttr* attr, int zone_id )
356 {
357 attr->win.px = 0;
358 attr->win.py = 0;
359 attr->win.sx = SCREEN_SIZE_X;
360 attr->win.sy = SCREEN_SIZE_Y;
361 if (zone_id == ZONE_BORDER_EDITOR)
362 { //Leave border on left/right of screen.
363 attr->win.px = 4;
364 attr->win.sx = attr->win.sx - 2*attr->win.px;
365 zone_id = ZONE_FULLSOFTKEYS;
366 }
367 else if ((zone_id != 0x0000) && ((zone_id &0xF000)==0xF000))
368 {
369 getSpecificWindowSize(attr,zone_id);
370 return;
371 }
372 else if (zone_id == 0)
373 zone_id = ZONE_FULLSOFTKEYS;
374
375 if (zone_id & ZONE_ICONS)
376 attr->win.py = attr->win.py + Mmi_layout_IconHeight();
377
378 if (zone_id & ZONE_SOFTKEYS)
379 attr->win.sy = attr->win.sy - Mmi_layout_softkeyHeight();
380
381 if (zone_id & ZONE_TITLE)
382 attr->win.py = attr->win.py + Mmi_layout_TitleHeight();
383
384 if (zone_id & ZONE_CASE_ABC)
385 attr->win.sy = attr->win.sy - Mmi_layout_line_height();
386
387 attr->win.sy = attr->win.sy - attr->win.py;
388
389 if ((zone_id & ZONE_FULLSCREEN) == ZONE_FULLSCREEN)
390 return;
391
392 //Else window is not entire screen
393 switch (zone_id & ZONE_FULL_HEIGHT)
394 {
395 case ZONE_FULL_HEIGHT:
396 break;
397 case ZONE_TOPHALF_HEIGHT:
398 attr->win.sy = attr->win.sy/2;
399 break;
400 case ZONE_MIDDLE_HEIGHT:
401 attr->win.sy = attr->win.sy/2;
402 attr->win.py = attr->win.py+attr->win.sy/2;
403 break;
404 case ZONE_BOTTOMHALF_HEIGHT:
405 attr->win.sy = attr->win.sy/2;
406 attr->win.py = attr->win.py+attr->win.sy;
407 break;
408 default:
409 //No action
410 break;
411 }
412 switch (zone_id & ZONE_FULL_WIDTH)
413 {
414 case ZONE_FULL_WIDTH:
415 break;
416 case ZONE_LEFTHALF_WIDTH:
417 attr->win.sx = attr->win.sx/2;
418 break;
419 case ZONE_MIDDLE_WIDTH :
420 attr->win.sx = attr->win.sx/2;
421 attr->win.px = attr->win.px+attr->win.sx/2;
422 break;
423 case ZONE_RIGHTHALF_WIDTH:
424 attr->win.sx = attr->win.sx/2;
425 attr->win.px = attr->win.px+attr->win.sx;
426 break;
427 default:
428 //No action
429 break;
430 }
431 }
432
433 void getTitlePosition(MfwEdtAttr* attr, int zone_id )
434 {
435 if (zone_id & 0xFFFF0000)
436 {
437 //title is on top line/LHS
438
439 }
440 }
441 #define EDITOR_FONT 0
442 #define EDITOR_CONTROLS 0
443 /*******************************************************************************
444
445 $Function: editor_attr_init
446
447 $Description: initialize parameters in the edit buffer
448
449 $Returns: None.
450
451 $Arguments: None.
452
453 *******************************************************************************/
454 void editor_attr_init(MfwEdtAttr* attr, int zone_id, U8 mode, U8 *controls, char *text, U16 size, int colour )
455 {
456 calculateWindow(attr, zone_id);
457 getTitlePosition(attr, zone_id);
458 attr->edtCol = colour;
459 attr->font = EDITOR_FONT;
460 attr->mode = mode;
461 attr->controls = controls;
462 attr->text = text;
463 attr->size = size;
464 AllowPredText = FALSE;
465 }
466 #ifdef EASY_TEXT_ENABLED
467 /*******************************************************************************
468
469 $Function: editor_attr_init_pred
470
471 $Description: initialize parameters in the predictive text editor buffer
472
473 $Returns: None.
474
475 $Arguments: None.
476
477 *******************************************************************************/
478 void editor_attr_init_pred(MfwEdtAttr* attr, int zone_id, U8 mode, U8 *controls, char *text, U16 size, int colour)
479 {
480 calculateWindow(attr, zone_id);
481 attr->edtCol = colour;
482 attr->font = EDITOR_FONT;
483 attr->mode = mode;
484 attr->controls = controls;
485 attr->text = text;
486 attr->size = size;
487 AllowPredText = TRUE;
488 }
489
490 //returns true if next word after cursor ought to be capitalised
491 UBYTE capitalise_word(T_MFW_HND editor_handle)
492 { char LastChar;
493 char CharBefore;
494
495 LastChar = getCursorChar(editor_handle, -1);
496 CharBefore = getCursorChar(editor_handle, -2);
497
498 if (LastChar == '.' || LastChar == '!' || LastChar == '?' || LastChar == 0)
499 return TRUE;
500 if (LastChar == ' ')
501 if(CharBefore == '.' || CharBefore == '!' || CharBefore == '?' )
502 return TRUE;
503 return FALSE;
504 }
505
506
507 #endif
508
509
510 /*******************************************************************************
511
512 $Function: editor_start
513
514 $Description: Common editor.
515
516 $Returns: None.
517
518 $Arguments: None.
519
520 *******************************************************************************/
521 T_MFW_HND editor_start (T_MFW_HND parent, T_EDITOR_DATA * editor_data)
522 {
523 T_MFW_HND win;
524
525 TRACE_FUNCTION ("editor_start()");
526
527 win = editor_create (parent);
528
529 if (win NEQ NULL)
530 {
531 SEND_EVENT (win, E_EDITOR_INIT, 0, editor_data);
532 }
533 return win;
534 }
535
536 /*******************************************************************************
537
538 $Function: editor_create
539
540 $Description: Creation of an editor.
541
542 $Returns: None.
543
544 $Arguments: None.
545
546 *******************************************************************************/
547 static T_MFW_HND editor_create (T_MFW_HND parent)
548 {
549 T_EDITOR_INFO * data = (T_EDITOR_INFO *)ALLOC_MEMORY (sizeof (T_EDITOR_INFO));
550 T_MFW_WIN * win;
551
552 TRACE_FUNCTION ("editor_create()");
553
554 /*
555 * Create window handler
556 */
557
558 data->edt_win = win_create (parent, 0, E_WIN_VISIBLE, (T_MFW_CB)editor_win_cb);
559
560 if (data->edt_win EQ NULL)
561 {
562 return NULL;
563 }
564
565 /*
566 * connect the dialog data to the MFW-window
567 */
568
569
570 data->mmi_control.dialog = (T_DIALOG_FUNC)editor_exec_cb;
571 data->mmi_control.data = data;
572 data->parent = parent;
573 win = ((T_MFW_HDR *)data->edt_win)->data;
574 win->user = (void *)data;
575
576
577 /*
578 * return window handle
579 */
580
581 return data->edt_win;
582 }
583 /*******************************************************************************
584
585 $Function: editor_destroy
586
587 $Description: Destroy the editor.
588
589 $Returns: None.
590
591 $Arguments: None.
592
593 *******************************************************************************/
594 void editor_destroy (T_MFW_HND window)
595 {
596 T_MFW_WIN * win = ((T_MFW_HDR *)window)->data;
597 T_EDITOR_INFO * data = (T_EDITOR_INFO *)win->user;
598
599 TRACE_FUNCTION ("editor_destroy()");
600
601 if (window == NULL)
602 {
603 TRACE_EVENT ("Error : Called with NULL Pointer");
604 return;
605 }
606
607 if (data)
608 {
609 AllowPredText = FALSE; //prevent any problems with new editors
610 /* end KGT */
611
612 /*
613 * Delete WIN Handler
614 */
615 editDeactivate();
616 win_delete (data->edt_win);
617 /*
618 * Free Memory
619 */
620 FREE_MEMORY ((void *)data, sizeof (T_EDITOR_INFO));
621 }
622 else
623 {
624 TRACE_FUNCTION ("editor_destroy() called twice");
625 return ;
626 }
627 }
628
629 /*******************************************************************************
630
631 $Function: editor_exec_cb
632
633 $Description: Dialog function for editor.
634
635 $Returns: None.
636
637 $Arguments: None.
638
639 *******************************************************************************/
640 static void editor_exec_cb (T_MFW_HND win, USHORT event, SHORT value, T_EDITOR_DATA * editor_data)
641 {
642 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
643 T_EDITOR_INFO * data = (T_EDITOR_INFO *)win_data->user;
644
645 T_MFW_HND parent_win = data->parent;
646 USHORT Identifier = data->editor_data.Identifier;
647 T_EDIT_CB Callback = data->editor_data.Callback;
648
649 T_EDITOR_DATA editor_label;
650
651 TRACE_EVENT ("editor_exec_cb()");
652
653
654 switch (event)
655 {
656 case E_EDITOR_INIT:
657 /*
658 * Store data
659 */
660 data->editor_data = *editor_data;
661 if (data->editor_data.TextString NEQ NULL)
662 {
663 memcpy (data->LabelText, data->editor_data.TextString, sizeof(data->LabelText));
664 }
665 /* Note that we do not copy the edited buffer here */
666 data->editor_data.editor_attr.predText[0] = '\0';
667 /*
668 * Create the handler
669 */
670 data->edt_kbd = kbd_create (data->edt_win, KEY_ALL, (T_MFW_CB)editor_kbd_cb);
671 data->edt_kbd_long = kbd_create (data->edt_win, KEY_ALL|KEY_LONG,(T_MFW_CB)editor_kbd_cb);
672 data->edt_edt = edtCreate (data->edt_win, &data->editor_data.editor_attr,MfwEdtVisible,0);
673
674 /*
675 * Set the mode for the editor
676 */
677 data->destroyEditor = editor_data->destroyEditor;
678 editActivate(data->edt_edt,data->editor_data.mode);
679
680 // SH - format mode with *M or *m is just alpha mode with case preference
681
682 if (data->editor_data.mode == FORMAT_MODE)
683 {
684 if (strcmp(data->editor_data.FormatString, "*M")==0)
685 {
686 upCase = TRUE;
687 UPPER_CASE = FALSE;
688 }
689 if (strcmp(data->editor_data.FormatString, "*m")==0)
690 {
691 upCase = FALSE;
692 UPPER_CASE = TRUE;
693 }
694 }
695
696 // SH - end of format mode modification
697
698 switch (data->editor_data.mode)
699 {
700 case READ_ONLY_MODE:
701 data->editor_data.hide = FALSE; /* don't allow hide for other modes than DIGITS_MODE. */
702 data->edt_mode = E_NORMAL_MODE; /* if editor is not called in T9 mode, set the normal */
703 data->editor_data.editor_attr.mode = 0; // sbh - read only mode has no cursor
704 win_show(data->edt_win);
705 edtChar(data->edt_edt,ecTop); /* in read-only mode set cursor to begin */
706 break; /* editor mode */
707
708 case ALPHA_MODE:
709
710 #ifdef EASY_TEXT_ENABLED
711 FFS_flashData.PredTextAvailable = TRUE;
712 Initialize_Dict(Mmi_getCurrentLanguage()/*MC, SPR 1319*/, 0);
713 ResetDictSearch();
714 #endif
715
716 if ( data->editor_data.hide ) /* if hide is set, show '*' instead of numbers. */
717 {
718 editor_hideInit(data); /* initialize editor for hide */
719 editHiddenActivate(data->tmpBuf); /* initialise multi-tap for hide */
720 data->editor_data.editor_attr.mode |= edtModOverWr; // Must be overwrite mode
721 }
722 data->edt_mode = E_NORMAL_MODE; /* if editor is not called in T9 mode, set the normal */
723 win_show(data->edt_win);
724 edtChar(data->edt_edt,ecBottom); /* in read-only mode set cursor to begin */
725 break; /* editor mode */
726 case DIGITS_MODE:
727 if ( data->editor_data.hide ) /* if hide is set, show '*' instead of numbers. */
728 editor_hideInit(data); /* initialize editor for hide */
729 data->edt_mode = E_NORMAL_MODE; /* if editor is not called in T9 mode, set the normal */
730 win_show(data->edt_win);
731 edtChar(data->edt_edt,ecBottom); /* in read-only mode set cursor to begin */
732 break; /* editor mode */
733 case CALC_MODE:
734 data->editor_data.hide = FALSE; /* don't allow hide for other modes than DIGITS_MODE. */
735 data->edt_mode = E_NORMAL_MODE; /* if editor is not called in T9 mode, set the normal */
736 win_show(data->edt_win);
737 edtChar(data->edt_edt,ecBottom);
738 break;
739 case PIN_SECURITY:
740 if ( data->editor_data.hide ) /* if hide is set, show '*' instead of numbers. */
741 editor_hideInit(data); /* initialize editor for hide */
742 data->edt_mode = E_PIN_SECURITY; /* spec. handling for PIN entering */
743 data->emergency_call = FALSE;
744 data->ss_string = FALSE;
745 win_show(data->edt_win);
746 edtChar(data->edt_edt,ecBottom);
747 break;
748 case FORMAT_MODE:
749 if ( data->editor_data.hide ) /* if hide is set, show '*' instead of numbers. */
750 {
751 editor_hideInit(data); /* initialize editor for hide */
752 editHiddenActivate(data->tmpBuf); /* initialise multi-tap for hide */
753 }
754 data->editor_data.editor_attr.mode |= edtModOverWr; // Must be overwrite mode
755 data->edt_mode = E_NORMAL_MODE;
756 win_show(data->edt_win);
757 edtChar(data->edt_edt,ecTop); // Cursor is at start of string
758 data->editor_data.formatIndex = -1; // Current format character. -1; increased to 0 in editCharFindNext below.
759 data->editor_data.fieldIndex = 0;
760
761 // Skip over any fixed characters that may be at start
762 setFormatPointers (data->editor_data.FormatString, &(data->editor_data.formatIndex), &(data->editor_data.fieldIndex));
763 TRACE_EVENT("Starting format mode");
764 editCharFindNext(NULL);
765 break;
766 }
767 // end KGT
768
769 // c015 rsa
770 /* create the timer handler */
771 if ( data->editor_data.timeout && (data->editor_data.timeout NEQ FOREVER))
772 {
773 data->edt_tim = tim_create (data->edt_win, data->editor_data.timeout, (T_MFW_CB)editor_tim_cb);
774 tim_start (data->edt_tim);
775 }
776 else
777 {
778 data->edt_tim = NULL;
779 }
780
781 //GW-SPR#1035-Added SAT changes from 33x build.
782 /*NM, 090702
783 why ? : for SAT application
784 this checks does the label fit on the first screen line ( <14chars) ;
785 if not so open a second editor and show up the whole
786 label (in Read_only_mode).
787 Pressing any key returns back to the main editor
788 */
789 if ( strlen(data->LabelText) >= MAX_LINE )
790 {
791 /* need this flag later in the callback of key_handler */
792 over_length_label = TRUE;
793
794 editor_attr_init(&editor_label.editor_attr, NULL, edtCurBar1, 0, (char *)data->LabelText, strlen(data->LabelText), COLOUR_EDITOR);
795 editor_data_init(&editor_label, NULL, TxtNull, TxtNull, 0, 1, READ_ONLY_MODE, FOREVER);
796
797 editor_start(win,&editor_label); /* start the editor */
798 }
799 /*NM, 090702 END */
800
801 break;
802
803 case E_EDITOR_DEINIT:
804 /* on DEINIT => selfdestroy; sendevent <value> */
805
806 if (Callback)
807 (Callback) (parent_win, Identifier, value);
808
809 over_length_label = FALSE; //GW-SPR#1035
810
811 // MZ Destroy the text edit window after creating the number editor.
812 if(data->destroyEditor == TRUE)
813 editor_destroy (data->edt_win);
814 break;
815
816 #ifdef EASY_TEXT_ENABLED
817 case E_EDITOR_UPDATE:
818 if (SymbolChar != '\0')
819 {
820 edtShow(data->edt_edt);
821 edtChar(data->edt_edt, SymbolChar);
822 if ((SymbolChar == '.') ||(SymbolChar == '!') || (SymbolChar == '?'))
823 {
824 edtChar(data->edt_edt, ' ');
825 }
826
827 win_show(data->edt_win);
828 }
829 break;
830 #endif
831 /*SPR 1392, move cursor to end of editor string*/
832 case E_EDITOR_CURSOR_END:
833 edtChar(data->edt_edt, ecBottom);
834 break;
835 default:
836 break;
837 }
838 }
839 /*******************************************************************************
840
841 $Function: editor_win_cb
842
843 $Description: Editor window event handler.
844
845 $Returns: None.
846
847 $Arguments: None.
848
849 *******************************************************************************/
850 static int editor_win_cb (T_MFW_EVENT event, T_MFW_WIN * win)
851 {
852 T_EDITOR_INFO * data = (T_EDITOR_INFO *)win->user;
853 int xPos,yPos;
854 {
855 /***************************Go-lite Optimization changes Start***********************/
856
857 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
858 TRACE_EVENT_P1 ("editor_win_cb()-event=%d",event);
859 /***************************Go-lite Optimization changes end***********************/
860
861 }
862
863
864 if (data->edt_edt!=activeEditor())
865 editActivate(data->edt_edt,data->editor_data.mode);
866
867 // SH - hidden mode
868 if (data->editor_data.hide)
869 editHiddenActivate(data->tmpBuf);
870 // end hidden mode
871
872 if (data EQ 0)
873 {
874 TRACE_FUNCTION ("editor_win_cb()-no data");
875 return MFW_EVENT_CONSUMED;
876 }
877 switch (event)
878 {
879 case E_WIN_VISIBLE: /* window is visible */
880 if (win->flags & E_WIN_VISIBLE)
881 {
882 /*
883 * Clear Screen
884 */
885 dspl_ClearAll();
886
887 /*
888 * Print the information
889 */
890 #ifdef EASY_TEXT_ENABLED
891 if(AllowPredText == TRUE && FFS_flashData.PredTextSelected == TRUE)
892 {
893 dspl_BitBlt(SCREEN_SIZE_X-9,0,8,8,0,(char*)TextIconeZiTextSmall,0);
894 }
895 #endif
896
897 edtShow(data->edt_edt);
898 /*
899 * Print the label
900 */
901 //GW Removed T9 reference
902 //GW Actually remove T9 ref, not code executed when T9 not enabled.
903 if (data->editor_data.editor_attr.win.px > 0)
904 xPos = data->editor_data.editor_attr.win.px;
905 else
906 xPos = editor_menuArea.px;
907 if (data->editor_data.editor_attr.win.py > Mmi_layout_TitleHeight())
908 yPos = data->editor_data.editor_attr.win.py-Mmi_layout_TitleHeight();
909 else
910 yPos = editor_menuArea.py;
911
912 if (data->editor_data.TextId NEQ 0)
913 {
914 dspl_TextOut(xPos,yPos,DSPL_TXTATTR_CURRENT_MODE, (char*)MmiRsrcGetText(data->editor_data.TextId));
915 }
916 else if (data->editor_data.TextString NEQ NULL)
917 {
918 dspl_TextOut(xPos,yPos,0,data->LabelText);
919 }
920 /*
921 * Print the softkeys
922 */
923 if (data->edt_mode != E_PIN_SECURITY)
924 {
925 #ifdef EASY_TEXT_ENABLED
926 if (data->editor_data.editor_attr.predText[0] != '\0' && FFS_flashData.PredTextSelected == TRUE)
927 softKeys_displayId(TxtSoftOK, TxtDelete,0,COLOUR_EDITOR_XX);
928 else
929 #endif
930 {
931 if (strlen(data->editor_data.editor_attr.text) < data->editor_data.min_enter)
932 {
933 /* entered less than the required number of chars: Alternate Softkey appears */
934 softKeys_displayId(data->editor_data.AlternateLeftSoftKey, data->editor_data.RightSoftKey,0,COLOUR_EDITOR_XX);
935 }
936 else
937 {
938 /* entered sufficient number of chars: Normal Softkey appears */
939 softKeys_displayId(data->editor_data.LeftSoftKey, data->editor_data.RightSoftKey,0,COLOUR_EDITOR_XX);
940 }
941 }
942 }
943 else
944 {
945 if (data->emergency_call EQ TRUE)
946 {
947 softKeys_displayId(TxtSoftCall, data->editor_data.RightSoftKey,0,COLOUR_EDITOR_XX);
948 TRACE_EVENT ("softkeys , call, delete");
949 }
950 else
951 {
952 //no emergency_call
953 if (strlen(data->editor_data.editor_attr.text) < data->editor_data.min_enter)
954 {
955
956
957 if (strlen(data->editor_data.editor_attr.text) EQ 0)
958 softKeys_displayId(data->editor_data.AlternateLeftSoftKey, TxtNull,0,COLOUR_EDITOR_XX);
959 else
960 softKeys_displayId(data->editor_data.AlternateLeftSoftKey, data->editor_data.RightSoftKey,0,COLOUR_EDITOR_XX);
961
962 TRACE_EVENT ("softkeys , altern, delete");
963 }
964 else
965 {
966 if (strlen(data->editor_data.editor_attr.text) EQ 0)
967 softKeys_displayId(data->editor_data.AlternateLeftSoftKey, TxtNull,0,COLOUR_EDITOR_XX);
968 else
969 softKeys_displayId(data->editor_data.LeftSoftKey, data->editor_data.RightSoftKey,0,COLOUR_EDITOR_XX);
970
971 TRACE_EVENT ("softkeys , ok, delete");
972 }
973 }
974 }
975
976 }
977 break;
978 default:
979 return MFW_EVENT_PASSED;
980 }
981 return MFW_EVENT_CONSUMED;
982 }
983
984 /*******************************************************************************
985
986 $Function: editor_kbd_cb
987
988 $Description: Editor keyboard event handler
989
990 $Returns: None.
991
992 $Arguments: None.
993
994 *******************************************************************************/
995 static int editor_kbd_cb (T_MFW_EVENT event, T_MFW_KBD *keyboard)
996 {
997 T_MFW_HND win = mfw_parent (mfw_header());
998 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
999 T_EDITOR_INFO * data = (T_EDITOR_INFO *)win_data->user;
1000 char* PredText = data->editor_data.editor_attr.predText;
1001 unsigned int editMode;
1002 char temp[80];
1003 int sim_status;
1004
1005 TRACE_FUNCTION("editor_kbd_cb");
1006
1007 // Nov 24, 2005, a0876501, DR: OMAPS00045909
1008 sim_status = sim_status_check();
1009
1010
1011 /* subpress unwanted longpresses (mfw throws more than one long press event for one long press on a key)*/
1012 if ( !( event & KEY_LONG ))
1013 DoNextLongPress = TRUE; /* next Key_long event is correct */
1014 else if ( DoNextLongPress )
1015 DoNextLongPress = FALSE; /* mark Key_long event as consumed but do current long press */
1016 else if ( !DoNextLongPress )
1017 return MFW_EVENT_CONSUMED; /* don't do current long press */
1018
1019
1020 // c015 rsa
1021 if (data->edt_tim NEQ NULL)
1022 {
1023 /* restart the timer for no response */
1024 tim_stop (data->edt_tim);
1025 tim_start (data->edt_tim);
1026 }
1027 // end c015 rsa
1028
1029 editMode = data->edt_mode;
1030
1031 sprintf(temp, "Editor mode: %d", editMode);
1032 TRACE_EVENT(temp);
1033
1034 #ifdef EASY_TEXT_ENABLED
1035 if (FFS_flashData.PredTextSelected == FALSE || data->editor_data.mode != ALPHA_MODE)
1036 #else
1037 if (1)
1038 #endif
1039 { TRACE_EVENT("Not in predictive mode");
1040 /***************************Go-lite Optimization changes Start***********************/
1041
1042 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
1043 TRACE_EVENT_P1("Key: %d", keyboard->code);
1044 /***************************Go-lite Optimization changes end***********************/
1045
1046 switch (editMode)
1047 {
1048
1049 case E_NORMAL_MODE:
1050
1051
1052
1053 if (event & KEY_LONG)
1054 {
1055 TRACE_EVENT("event and long key");
1056
1057 switch (keyboard->code)
1058 {
1059 case KCD_CALL:
1060 SEND_EVENT (win, E_EDITOR_DEINIT, INFO_KCD_CALL, NULL);
1061 break;
1062 case KCD_LEFT:
1063 break;
1064 case KCD_MNURIGHT:
1065 case KCD_MNUUP:
1066 if (data->editor_data.mode NEQ READ_ONLY_MODE &&
1067 !data->editor_data.hide )
1068 break;
1069 case KCD_RIGHT:
1070 TRACE_EVENT("KCD_RIGHT");
1071 // SH - special clear all for format mode
1072
1073 if (data->editor_data.mode EQ FORMAT_MODE)
1074 {
1075 editClear();
1076 }
1077
1078 // SH - End of format mode modification
1079
1080 else if(data->editor_data.editor_attr.text[0] NEQ '\0')
1081 {
1082 /* clear the whole buffer */
1083 if ( data->editor_data.hide )
1084 editor_hideClearAll(data);
1085 else
1086 {
1087 data->editor_data.editor_attr.text[0] = '\0';
1088 edtChar(data->edt_edt, ecTop);
1089 if (data->editor_data.min_enter > 0)
1090 {
1091 win_show(data->edt_win); /* in order to update the Softkeys */
1092 }
1093 else
1094 {
1095 edtShow(data->edt_edt);
1096 }
1097 }
1098 }
1099 else
1100 {
1101 /* leave editor if buffer already empty */
1102 SEND_EVENT (win, E_EDITOR_DEINIT, INFO_KCD_RIGHT, NULL);
1103 }
1104 break;
1105
1106 case KCD_0: /* '+' key */
1107 if (data->editor_data.mode NEQ READ_ONLY_MODE) /* ignore normal keys if in read-only mode */
1108 {
1109 if (data->editor_data.hide)
1110 {
1111 /* in hidden mode do not allow entering of '+' */
1112 editor_hideClear(data); /* remove the '0' */
1113 }
1114 else
1115 {
1116 edtChar(data->edt_edt,ecBack); /* remove the '0' */
1117 edtChar(data->edt_edt,'+'); /* insert the '+' */
1118 if (data->editor_data.min_enter > 0)
1119 {
1120 win_show(data->edt_win); /* in order to update the Softkeys */
1121 }
1122 else
1123 {
1124 edtShow(data->edt_edt);
1125 }
1126 }
1127 }
1128 break;
1129
1130 default:
1131 {
1132 // change the Lowercase to Uppercase and visa-versa
1133 //only possible in Alpha mode (SH - or format mode)
1134 if (data->editor_data.mode EQ ALPHA_MODE || data->editor_data.mode EQ FORMAT_MODE)
1135 {
1136 if (UPPER_CASE EQ FALSE)
1137 {
1138 TRACE_EVENT("UPPER_CASE EQ FALSE");
1139 UPPER_CASE = TRUE;
1140 upCase = FALSE;
1141 displaySoftKeys_edition (TxtLowercase ,TxtNull,TxtNull);
1142 }
1143 else
1144 {
1145 TRACE_EVENT("UPPER_CASE EQ TRUE");
1146 UPPER_CASE = FALSE;
1147 upCase = TRUE;
1148 displaySoftKeys_edition (TxtUppercase ,TxtNull,TxtNull);
1149 }
1150 if (data->editor_data.mode NEQ FORMAT_MODE) // SH - for format mode, don't erase the character
1151 edtChar(data->edt_edt,ecBack);
1152 }
1153
1154
1155 }
1156 return MFW_EVENT_CONSUMED; /* we don't handle other long presses here */
1157
1158
1159 }
1160 }
1161 else
1162 {
1163 switch (keyboard->code)
1164 {
1165 case KCD_CALL:
1166 SEND_EVENT (win, E_EDITOR_DEINIT, INFO_KCD_CALL, NULL);
1167 break;
1168 case KCD_MNURIGHT:
1169 case KCD_MNUUP:
1170 if (data->editor_data.mode EQ READ_ONLY_MODE)
1171 edtChar(data->edt_edt,ecUp);
1172 else if (!data->editor_data.hide) // SH - key not available in hide mode
1173 {
1174
1175 /* SH - format mode, skip over fixed characters */
1176
1177 if (data->editor_data.mode EQ FORMAT_MODE) // formatted input
1178 {
1179 TRACE_EVENT("MNUUP");
1180 editCharFindNext(ecRight); // Insert character & move cursor forward once
1181 }
1182
1183 /* end of format mode modification */
1184
1185 else
1186 {
1187 edtChar(data->edt_edt,ecRight);
1188 }
1189 }
1190
1191 edtShow(data->edt_edt);
1192 break;
1193 case KCD_MNULEFT:
1194 case KCD_MNUDOWN:
1195 if (data->editor_data.mode EQ READ_ONLY_MODE)
1196 edtChar(data->edt_edt,ecDown);
1197 else if (!data->editor_data.hide) // SH - key not available in hide mode
1198 {
1199 /* SH - format mode, skip over fixed characters */
1200 if (data->editor_data.mode EQ FORMAT_MODE) // formatted input
1201 editFindPrev(); // find previous non-fixed character
1202
1203 /* end of format mode modification */
1204 else
1205 {
1206 edtChar(data->edt_edt,ecLeft);
1207 }
1208 }
1209 edtShow(data->edt_edt);
1210 break;
1211
1212 case KCD_MNUSELECT:
1213 case KCD_LEFT:
1214 if (strlen(data->editor_data.editor_attr.text) < data->editor_data.min_enter)
1215 {
1216 /* entered less than the required number of chars */
1217 if (data->editor_data.AlternateLeftSoftKey NEQ TxtNull)
1218 {
1219 /* an alternate softkey were defined: execute it*/
1220 SEND_EVENT (win, E_EDITOR_DEINIT, INFO_KCD_ALTERNATELEFT, NULL);
1221 }
1222 }
1223 else if (data->editor_data.LeftSoftKey NEQ TxtNull)
1224 {
1225 /* left Softkey is enabled (and entered sufficient number of chars): execute it */
1226 //KGT
1227 /* get the orginal text back into the editor instead of the
1228 hide buffer ( only filled with '*') */
1229 if (data->editor_data.hide)
1230 editor_hideTerminate(data);
1231 //end KGT
1232 SEND_EVENT (win, E_EDITOR_DEINIT, INFO_KCD_LEFT, NULL);
1233 }
1234 else
1235 {
1236 //GW-SPR#1035-Added SAT changes from 33x build.
1237 /*NM, 090702
1238 in case of long labels (>14chars; when it doesnt fit on the first line)
1239 so we open a second editor and return by any keypress
1240 */
1241 if (over_length_label EQ TRUE)
1242 {
1243 SEND_EVENT (win, E_EDITOR_DEINIT, INFO_KCD_RIGHT, NULL);
1244 }
1245 }
1246 break;
1247
1248 case KCD_HUP:
1249 if (data->editor_data.RightSoftKey NEQ TxtNull)
1250 {
1251 /* Right softkey is enabled: execute it */
1252 SEND_EVENT (win, E_EDITOR_DEINIT, INFO_KCD_HUP, NULL);
1253 }
1254 break;
1255
1256 case KCD_RIGHT:
1257 if (data->editor_data.mode NEQ READ_ONLY_MODE) /* ignore clear key if in read-only mode */
1258 {
1259 if(data->editor_data.editor_attr.text[0] NEQ '\0')
1260 {
1261 /* buffer is not empty, delete the char before the cursor */
1262 //KGT
1263 if ( data->editor_data.hide )
1264 editor_hideClear(data);
1265 else
1266 //end KGT
1267 {
1268
1269 /* SH - format mode, skip over fixed characters */
1270
1271 if (data->editor_data.mode EQ FORMAT_MODE) // SH - formatted input
1272 {
1273 switch (editFindPrev()) // Skip over fixed characters
1274 {
1275 case 1:
1276 edtChar(data->edt_edt,' '); // overwrite with space
1277 edtChar(data->edt_edt,ecLeft); // Move cursor left again
1278 break;
1279 case 2:
1280 SEND_EVENT (win, E_EDITOR_DEINIT, INFO_KCD_RIGHT, NULL); // Exit editor
1281 break;
1282 case 3:
1283 edtChar(data->edt_edt,ecRight); // Last character - shorten string
1284 edtChar(data->edt_edt,ecBack);
1285 break;
1286 }
1287
1288 }
1289
1290 /* end of format mode modification */
1291
1292 else
1293 {
1294 edtChar(data->edt_edt,ecBack);
1295 }
1296 if (data->editor_data.min_enter > 0)
1297 {
1298 win_show(data->edt_win); /* in order to update the Softkeys */
1299 }
1300 else
1301 {
1302 edtShow(data->edt_edt);
1303 }
1304 }
1305 }
1306 else
1307 {
1308 /* leave editor if buffer already empty */
1309 SEND_EVENT (win, E_EDITOR_DEINIT, INFO_KCD_RIGHT, NULL);
1310 }
1311 }
1312 else
1313 SEND_EVENT (win, E_EDITOR_DEINIT, INFO_KCD_RIGHT, NULL);
1314
1315 break;
1316 #ifdef EASY_TEXT_ENABLED
1317 case (KCD_HASH):
1318 { if (AllowPredText == TRUE)
1319 if (FFS_flashData.PredTextAvailable == TRUE)
1320 {
1321 FFS_flashData.PredTextSelected = TRUE;
1322 win_show(data->edt_win);
1323 break;
1324 }
1325
1326 {
1327 editEventKey(event,keyboard);
1328 if (data->editor_data.min_enter > 0)
1329 {
1330 win_show(data->edt_win); /* in order to update the Softkeys */
1331 }
1332 else
1333 {
1334 edtShow(data->edt_edt);
1335 }
1336 }
1337 }
1338 break;
1339 #endif
1340 default: /* any key */
1341 if (data->editor_data.mode NEQ READ_ONLY_MODE) /* ignore normal keys if in read-only mode */
1342 {
1343 {
1344 /* SH - format mode, setup pointers to format string & index */
1345
1346 if (data->editor_data.mode EQ FORMAT_MODE)
1347 {
1348 setFormatPointers (data->editor_data.FormatString, &(data->editor_data.formatIndex),
1349 &(data->editor_data.fieldIndex));
1350 }
1351
1352 /* End of format mode modification */
1353
1354 editEventKey(event,keyboard);
1355
1356 if (data->editor_data.min_enter > 0)
1357 {
1358 win_show(data->edt_win); /* in order to update the Softkeys */
1359 }
1360 else
1361 {
1362 edtShow(data->edt_edt);
1363 }
1364 }
1365 }
1366 /*NM, 090702
1367 in case of long labels (>14chars; when it doesnt fit on the first line)
1368 so we open a second editor and return by any keypress
1369 */
1370 else
1371 {
1372 if (over_length_label EQ TRUE)
1373 {
1374 SEND_EVENT (win, E_EDITOR_DEINIT, INFO_KCD_RIGHT, NULL);
1375 }
1376 }
1377 break;
1378 }
1379 }
1380
1381 break;
1382 //GW Removed T9 code.
1383
1384 /* E_PIN_SECURITY entering
1385 *
1386 */
1387
1388 case E_PIN_SECURITY:
1389
1390 switch (keyboard->code)
1391 {
1392 case KCD_MNUUP:
1393 break;
1394
1395 case KCD_MNUDOWN:
1396 break;
1397
1398 case KCD_STAR:
1399
1400 //only possible when the first digit is a '*'
1401 if (strlen(data->editor_data.editor_attr.text) EQ 0 && data->editor_data.hide)
1402 {
1403 data->ss_string = TRUE;
1404 //the string should be visible on screen
1405 data->editor_data.hide = FALSE;
1406
1407 editEventKey(event,keyboard);
1408 }
1409
1410
1411 break;
1412
1413 case KCD_HASH:
1414
1415 if(data->ss_string)
1416 {
1417 T_MFW_SS_RETURN ssRes;
1418
1419 editEventKey(event,keyboard);
1420
1421 ssRes = ss_check_ss_string((UBYTE*)data->editor_data.editor_attr.text);
1422 switch (ssRes)
1423 {
1424 case MFW_SS_MMI:
1425 // May 02, 2005 REF : LOCOSTO-ENH-30818 - xpradipg
1426 // replace the call to get_imei() with callNumber() -> sAT_Dn()
1427 #ifdef FF_MMI_ATC_MIGRATION
1428 mmi_imei_retrieve();
1429 #else
1430 get_imei((char*)data->imei);
1431 showIMEI(win,(char*)data->imei);
1432 #endif
1433 editor_hideClearAll(data);
1434
1435 //set back to the default
1436 data->ss_string = FALSE;
1437
1438 // go back in the hide mode
1439 data->editor_data.hide = TRUE;
1440
1441 return MFW_EVENT_CONSUMED;
1442 }
1443
1444 }
1445 else if (strlen(data->editor_data.editor_attr.text) >= data->editor_data.min_enter)
1446 {
1447 if (data->editor_data.hide)
1448 editor_hideTerminate(data);
1449
1450
1451 TRACE_EVENT("press hash");
1452 SEND_EVENT (win, E_EDITOR_DEINIT, INFO_KCD_LEFT, NULL);
1453 }
1454
1455
1456 break;
1457 case KCD_LEFT:
1458 if ( data->emergency_call EQ TRUE )
1459 {
1460 TRACE_EVENT("press left < min");
1461
1462 /* get the orginal text back into the editor instead of the
1463 hide buffer ( only filled with '*') */
1464 if (data->editor_data.hide)
1465 editor_hideTerminate(data);
1466
1467 SEND_EVENT (win, E_EDITOR_DEINIT, INFO_EMERGENCY, NULL);
1468
1469 }
1470 else if (strlen(data->editor_data.editor_attr.text) >= data->editor_data.min_enter)
1471 {
1472 /* left Softkey is enabled (and entered sufficient number of chars): execute it */
1473 //KGT
1474 /* get the orginal text back into the editor instead of the
1475 hide buffer ( only filled with '*') */
1476 if (data->editor_data.hide)
1477 editor_hideTerminate(data);
1478 //end KGT
1479
1480 TRACE_EVENT("press left");
1481 SEND_EVENT (win, E_EDITOR_DEINIT, INFO_KCD_LEFT, NULL);
1482 }
1483 else
1484 {
1485 /* NOP */
1486 TRACE_EVENT("NOP");
1487 }
1488 break;
1489
1490 case KCD_HUP:
1491 /* API - 15/10/02 - 1162 - Update the Editor TextId after Deleting a value
1492 from the text editor.
1493 */
1494 if(cm_check_emergency((U8*)data->tmpBuf))
1495 {
1496 data->editor_data.TextId = '\0';
1497 data->editor_data.TextId = TxtEmergency;
1498 data->emergency_call = TRUE;
1499 }
1500 else
1501 {
1502 if (sim_status == SIM_NOT_ACTIVE)
1503 {
1504 data->editor_data.TextId = '\0';
1505 data->editor_data.TextId = TxtNoCard;
1506 }
1507 // Nov 24, 2005, a0876501, DR: OMAPS00045909
1508 else if (sim_status == IMEI_NOT_VALID)
1509 {
1510 data->editor_data.TextId = '\0';
1511 data->editor_data.TextId = TxtInvalidIMEI;
1512 }
1513 else
1514 {
1515 data->editor_data.TextId = '\0';
1516 data->editor_data.TextId = TxtEnterPin1;
1517 }
1518 data->emergency_call = FALSE;
1519 }
1520 break;
1521
1522 case KCD_CALL:
1523 SEND_EVENT (win, E_EDITOR_DEINIT, INFO_KCD_CALL, NULL);
1524 break;
1525
1526 if ( data->emergency_call EQ TRUE ) {
1527 TRACE_EVENT("press left < min");
1528
1529 /* get the orginal text back into the editor instead of the
1530 hide buffer ( only filled with '*') */
1531 if (data->editor_data.hide)
1532 editor_hideTerminate(data);
1533
1534 SEND_EVENT (win, E_EDITOR_DEINIT, INFO_EMERGENCY, NULL);
1535 }
1536 break;
1537
1538 case KCD_RIGHT:
1539 /* API - 15/10/02 - 1162 - Update the Editor TextId after Deleting a value
1540 from the text editor.
1541 */
1542 TRACE_EVENT("Delete key pressed!");
1543 if(cm_check_emergency((U8*)data->tmpBuf))
1544 {
1545 data->editor_data.TextId = '\0';
1546 data->editor_data.TextId = TxtEmergency;
1547 data->emergency_call = TRUE;
1548
1549 }
1550 else
1551 {
1552 if (sim_status == SIM_NOT_ACTIVE)
1553 {
1554 data->editor_data.TextId = '\0';
1555 data->editor_data.TextId = TxtNoCard;
1556 }
1557 // Nov 24, 2005, a0876501, DR: OMAPS00045909
1558 else if (sim_status == IMEI_NOT_VALID)
1559 {
1560 data->editor_data.TextId = '\0';
1561 data->editor_data.TextId = TxtInvalidIMEI;
1562 }
1563 else
1564 {
1565 data->editor_data.TextId = '\0';
1566 data->editor_data.TextId = TxtEnterPin1;
1567 }
1568 data->emergency_call = FALSE;
1569 }
1570
1571 if(data->editor_data.editor_attr.text[0] NEQ '\0')
1572 {
1573 /* buffer is not empty, delete the char before the cursor */
1574 //KGT
1575 if ( data->editor_data.hide )
1576 {
1577 U8 uMode;
1578
1579 editor_hideClear(data);
1580 /* API - 15/10/02 - 1162 - Update the Editor TextId after Deleting a value
1581 from the text editor.
1582 */
1583 if(cm_check_emergency((U8*)data->tmpBuf))
1584 {
1585 data->editor_data.TextId = '\0';
1586 data->editor_data.TextId = TxtEmergency;
1587 data->emergency_call = TRUE;
1588 }
1589 else
1590 {
1591 if (sim_status == SIM_NOT_ACTIVE)
1592 {
1593 data->editor_data.TextId = '\0';
1594 data->editor_data.TextId = TxtNoCard;
1595 }
1596 // Nov 24, 2005, a0876501, DR: OMAPS00045909
1597 else if (sim_status == IMEI_NOT_VALID)
1598 {
1599 data->editor_data.TextId = '\0';
1600 data->editor_data.TextId = TxtInvalidIMEI;
1601 }
1602 else
1603 {
1604 data->editor_data.TextId = '\0';
1605 data->editor_data.TextId = TxtEnterPin1;
1606 }
1607 data->emergency_call = FALSE;
1608 }
1609
1610 if (data->editor_data.min_enter > 0 || data->emergency_call)
1611 {
1612 win_show(data->edt_win); /* in order to update the Softkeys */
1613 }
1614 else
1615 {
1616 edtShow(data->edt_edt);
1617 }
1618
1619
1620 }
1621 else
1622 //end KGT
1623 {
1624 edtChar(data->edt_edt,ecBack);
1625
1626 // this is for the ss_string
1627 if (strlen(data->editor_data.editor_attr.text) EQ 0 && data->ss_string)
1628 {
1629 data->ss_string = FALSE;
1630 //the string should be visible on screen
1631 data->editor_data.hide = TRUE;
1632
1633 }
1634 /* is it a emergency call number ?!*/
1635 /* API - 15/10/02 - 1162 - Update the Editor TextId after Deleting a value
1636 from the text editor.
1637 */
1638 if(cm_check_emergency((U8*)data->tmpBuf))
1639 {
1640 data->editor_data.TextId = '\0';
1641 data->editor_data.TextId = TxtEmergency;
1642 data->emergency_call = TRUE;
1643 }
1644 else
1645 {
1646 if (sim_status == SIM_NOT_ACTIVE)
1647 {
1648 data->editor_data.TextId = '\0';
1649 data->editor_data.TextId = TxtNoCard;
1650 }
1651 // Nov 24, 2005, a0876501, DR: OMAPS00045909
1652 else if (sim_status == IMEI_NOT_VALID)
1653 {
1654 data->editor_data.TextId = '\0';
1655 data->editor_data.TextId = TxtInvalidIMEI;
1656 }
1657 else
1658 {
1659 data->editor_data.TextId = '\0';
1660 data->editor_data.TextId = TxtEnterPin1;
1661 }
1662 data->emergency_call = FALSE;
1663 }
1664
1665 if (data->editor_data.min_enter > 0 )
1666 {
1667 win_show(data->edt_win); /* in order to update the Softkeys */
1668 }
1669 else
1670 {
1671 edtShow(data->edt_edt);
1672 }
1673 }
1674 }
1675 break;
1676
1677 default: /* any key */
1678 if (data->editor_data.mode NEQ READ_ONLY_MODE) /* ignore normal keys if in read-only mode */
1679 {
1680 if ( data->editor_data.hide )
1681 {
1682 U8 uMode;
1683 TRACE_EVENT(" hide mode");
1684
1685 editor_hideInsert(data,keyboard->code);
1686 /* API - 15/10/02 - 1162 - Check to see if the inputed value into the PIN editor is
1687 an emergency number.
1688 */
1689 if((strlen((char*)data->tmpBuf) > 1) && (strlen((char*)data->tmpBuf) < 4))
1690 {
1691 if(cm_check_emergency((UBYTE*)data->tmpBuf))
1692 {
1693 TRACE_EVENT(" it is a emergency number !");
1694 data->emergency_call = TRUE;
1695 //Clear the TextId string before adding
1696 data->editor_data.TextId = '\0';
1697 //Change the TextId to display Emergency ?
1698 data->editor_data.TextId = TxtEmergency;
1699 displaySoftKeys(TxtSoftCall, data->editor_data.RightSoftKey);
1700 }
1701 else
1702 {
1703 TRACE_EVENT("data->emergency_call = FALSE");
1704 if (sim_status == SIM_NOT_ACTIVE)
1705 {
1706 data->editor_data.TextId = '\0';
1707 data->editor_data.TextId = TxtNoCard;
1708 }
1709 // Nov 24, 2005, a0876501, DR: OMAPS00045909
1710 else if (sim_status == IMEI_NOT_VALID)
1711 {
1712 data->editor_data.TextId = '\0';
1713 data->editor_data.TextId = TxtInvalidIMEI;
1714 }
1715 else
1716 {
1717 data->editor_data.TextId = '\0';
1718 data->editor_data.TextId = TxtEnterPin1;
1719 }
1720 data->emergency_call = FALSE;
1721 }
1722 }
1723 else
1724 {
1725 TRACE_EVENT("data->emergency_call = FALSE");
1726 if (sim_status == SIM_NOT_ACTIVE)
1727 {
1728 data->editor_data.TextId = '\0';
1729 data->editor_data.TextId = TxtNoCard;
1730 }
1731 // Nov 24, 2005, a0876501, DR: OMAPS00045909
1732 else if (sim_status == IMEI_NOT_VALID)
1733 {
1734 data->editor_data.TextId = '\0';
1735 data->editor_data.TextId = TxtInvalidIMEI;
1736 }
1737 else
1738 {
1739 data->editor_data.TextId = '\0';
1740 data->editor_data.TextId = TxtEnterPin1;
1741 }
1742 data->emergency_call = FALSE;
1743 }
1744
1745 if (data->editor_data.min_enter > 0 || data->emergency_call)
1746 {
1747 win_show(data->edt_win); /* in order to update the Softkeys */
1748 }
1749 else
1750 {
1751 edtShow(data->edt_edt);
1752 TRACE_EVENT(" edtShow");
1753 }
1754
1755
1756 }
1757 else
1758 {
1759 TRACE_EVENT(" unhide mode");
1760 editEventKey(event,keyboard);
1761
1762 /* API - 15/10/02 - 1162 - Check to see if the inputed value into the PIN editor is
1763 an emergency number.
1764 */
1765 if((strlen((char*)data->editor_data.editor_attr.text) > 1) && (strlen((char*)data->editor_data.editor_attr.text) < 4))
1766 {
1767 TRACE_EVENT("EMERGENCY CHECK POINT!");
1768 if(cm_check_emergency((U8*)data->editor_data.editor_attr.text))
1769 {
1770 TRACE_EVENT(" it is a emergency number !");
1771 data->emergency_call = TRUE;
1772 //Clear the TextId string before adding
1773 data->editor_data.TextId = '\0';
1774 //Change the TextId to display Emergency ?
1775 data->editor_data.TextId = TxtEmergency;
1776 }
1777 else
1778 {
1779 TRACE_EVENT("data->emergency_call = FALSE");
1780 if (sim_status == SIM_NOT_ACTIVE)
1781 {
1782 data->editor_data.TextId = '\0';
1783 data->editor_data.TextId = TxtNoCard;
1784 }
1785 // Nov 24, 2005, a0876501, DR: OMAPS00045909
1786 else if (sim_status == IMEI_NOT_VALID)
1787 {
1788 data->editor_data.TextId = '\0';
1789 data->editor_data.TextId = TxtInvalidIMEI;
1790 }
1791 else
1792 {
1793 data->editor_data.TextId = '\0';
1794 data->editor_data.TextId = TxtEnterPin1;
1795 }
1796 data->emergency_call = FALSE;
1797 }
1798 }
1799 else
1800 {
1801 TRACE_EVENT("data->emergency_call = FALSE");
1802 data->emergency_call = FALSE;
1803 }
1804
1805 if (data->editor_data.min_enter > 0)
1806 {
1807 win_show(data->edt_win); /* in order to update the Softkeys */
1808 }
1809 else
1810 {
1811 edtShow(data->edt_edt);
1812 }
1813 }
1814 }
1815 break;
1816 }
1817 break;
1818 }
1819 }
1820 #ifdef EASY_TEXT_ENABLED
1821 else
1822 if(FFS_flashData.PredTextAvailable == TRUE)
1823 {TRACE_EVENT("In predictive mode");
1824 /***************************Go-lite Optimization changes Start***********************/
1825
1826 //Aug 16, 2004 REF: CRR 24323 Deepa M.D
1827 TRACE_EVENT_P1("Key: %d", keyboard->code);
1828 /***************************Go-lite Optimization changes end***********************/
1829
1830 if (event & KEY_LONG)
1831 {
1832 switch (keyboard->code)
1833 {
1834 case KCD_CALL:
1835 SEND_EVENT (win, E_EDITOR_DEINIT, INFO_KCD_CALL, NULL);
1836 break;
1837 case KCD_RIGHT: //empty predictive text string
1838 if(PredText[0] NEQ '\0')
1839 {
1840 PredText[0]= '\0';
1841 ResetDictSearch();
1842
1843 }
1844 else //empty whole editor
1845 {
1846 if(data->editor_data.editor_attr.text[0] NEQ '\0')
1847 {
1848 data->editor_data.editor_attr.text[0] = '\0';
1849 if (data->editor_data.min_enter > 0)
1850 {
1851 win_show(data->edt_win); /* in order to update the Softkeys */
1852 }
1853 else
1854 {
1855 edtShow(data->edt_edt);
1856 }
1857
1858 }
1859 else
1860 {
1861 /* leave editor if buffer already empty */
1862 SEND_EVENT (win, E_EDITOR_DEINIT, INFO_KCD_RIGHT, NULL);
1863 }
1864 }
1865 break;
1866
1867 case KCD_0: /* '+' key */
1868 if(PredText[0] == '\0')
1869 {
1870
1871
1872 if (data->editor_data.min_enter > 0)
1873 {
1874 win_show(data->edt_win); /* in order to update the Softkeys */
1875 }
1876 else
1877 {
1878 edtShow(data->edt_edt);
1879 }
1880 }
1881
1882 break;
1883
1884 case(KCD_STAR):
1885 { char symbol;
1886 SymbolScreenstart (data->edt_win, &symbol);
1887 }
1888 break;
1889
1890 default: //change case
1891 { if(PredText[0] == '\0')
1892 {
1893 // change the Lowercase to Uppercase and visa-versa
1894 //only possible in Alpha mode
1895 if (data->editor_data.mode EQ ALPHA_MODE)
1896 {
1897 if (UPPER_CASE EQ FALSE)
1898 {
1899 TRACE_EVENT("UPPER_CASE EQ FALSE");
1900 UPPER_CASE = TRUE;
1901 upCase = FALSE;
1902 displaySoftKeys_edition (TxtLowercase ,TxtNull,TxtNull);
1903 }
1904 else
1905 {
1906 TRACE_EVENT("UPPER_CASE EQ TRUE");
1907 UPPER_CASE = FALSE;
1908 upCase = TRUE;
1909 displaySoftKeys_edition (TxtUppercase ,TxtNull,TxtNull);
1910 }
1911 }
1912 }
1913 }
1914 return MFW_EVENT_CONSUMED; /* we don't handle other long presses here */
1915
1916
1917 }
1918 }
1919 else
1920 {
1921 switch (keyboard->code)
1922 {
1923 case KCD_CALL:
1924 SEND_EVENT (win, E_EDITOR_DEINIT, INFO_KCD_CALL, NULL);
1925 break;
1926 case KCD_MNURIGHT:
1927 case KCD_MNUUP:
1928 if(PredText[0] == '\0')
1929 {
1930 edtChar(data->edt_edt,ecRight);
1931 edtShow(data->edt_edt);
1932 }
1933 break;
1934 case KCD_MNULEFT:
1935 case KCD_MNUDOWN:
1936 if(PredText[0] == '\0')
1937 {
1938
1939 edtChar(data->edt_edt,ecLeft);
1940 edtShow(data->edt_edt);
1941 }
1942 break;
1943
1944 case KCD_LEFT:
1945 if(PredText[0] == '\0')
1946 {
1947
1948 if (data->editor_data.LeftSoftKey NEQ TxtNull)
1949 {
1950
1951 SEND_EVENT (win, E_EDITOR_DEINIT, INFO_KCD_LEFT, NULL);
1952 }
1953 }
1954 else
1955 { char TempString[16];
1956 char LastChar;
1957
1958 if ((strlen(data->editor_data.editor_attr.text) + strlen(PredText)) < MAX_MSG_LEN)
1959 if (PredText[0] != '*')
1960 { if (capitalise_word(data->edt_edt) == TRUE|| (strlen(PredText)== 1 && PredText[0] == 'i'))
1961 { PredText[0] -= 0x20;
1962 }
1963 LastChar = getCursorChar(data->edt_edt, -1);
1964 if ( LastChar != ' ' && LastChar != 0)
1965 {
1966 sprintf(TempString, " %s", PredText);
1967 edtInsertString(data->edt_edt, TempString);
1968 }
1969 else
1970 edtInsertString(data->edt_edt,PredText);
1971 }
1972 PredText[0] = '\0';
1973 ResetDictSearch();
1974 win_show(data->edt_win);
1975 }
1976
1977 break;
1978
1979 case KCD_HUP:
1980 if (data->editor_data.RightSoftKey NEQ TxtNull)
1981 {
1982 /* Right softkey is enabled: execute it */
1983 SEND_EVENT (win, E_EDITOR_DEINIT, INFO_KCD_HUP, NULL);
1984 }
1985 break;
1986
1987 case KCD_RIGHT:
1988 if(PredText[0] == '\0')
1989 {
1990 if(data->editor_data.editor_attr.text[0] NEQ '\0')
1991 {
1992
1993 {
1994 edtChar(data->edt_edt,ecBack);
1995 if (data->editor_data.min_enter > 0)
1996 {
1997 win_show(data->edt_win); /* in order to update the Softkeys */
1998 }
1999 else
2000 {
2001 edtShow(data->edt_edt);
2002 }
2003 }
2004 }
2005 else
2006 {
2007 /* leave editor if buffer already empty */
2008 SEND_EVENT (win, E_EDITOR_DEINIT, INFO_KCD_RIGHT, NULL);
2009 }
2010 }
2011 else
2012 {
2013 if (strlen(PredText) == 1)
2014 {
2015 DictBackSpace(data->editor_data.editor_attr.predText);
2016 PredText[0] = '\0';
2017 }
2018 else
2019 DictBackSpace(data->editor_data.editor_attr.predText);
2020
2021 win_show(data->edt_win);
2022 }
2023
2024 break;
2025 case (KCD_2):
2026 case (KCD_3):
2027 case (KCD_4):
2028 case (KCD_5):
2029 case (KCD_6):
2030 case (KCD_7):
2031 case (KCD_8):
2032 case (KCD_9):
2033 {
2034 DictAlphaKeyPress(keyboard->code,PredText);
2035 win_show(data->edt_win);
2036 }
2037 break;
2038
2039 case (KCD_HASH):
2040 { FFS_flashData.PredTextSelected = FALSE;
2041 PredText[0] = '\0';
2042 win_show(data->edt_win);
2043 }
2044 break;
2045
2046 case (KCD_STAR):
2047 if (PredText[0] == '\0')
2048 { char symbol;
2049 SymbolScreenstart (data->edt_win, &symbol);
2050 }
2051 else
2052 { int i;
2053 MoreCandidates(PredText, &i);
2054 win_show(data->edt_win);
2055 }
2056 break;
2057
2058 case KCD_0:
2059 case KCD_1:
2060 if (PredText[0] != '\0')
2061 { char TempString[16];
2062 char LastChar;
2063
2064 if ((strlen(data->editor_data.editor_attr.text) + strlen(PredText)) < MAX_MSG_LEN)
2065 {
2066 //if char b4 cursor full stop/question/exclamation
2067 //(or last char space and char b4 full stop)
2068 if (capitalise_word(data->edt_edt) == TRUE || (strlen(PredText)== 1 && PredText[0] == 'i'))
2069 { PredText[0] -= 0x20;
2070
2071 }
2072 //capitalise first letter of char
2073 //if char b4 cursor not space
2074 //insert spac
2075 LastChar = getCursorChar(data->edt_edt, -1);
2076
2077 if (PredText[0] != '*')
2078 { if (keyboard->code == KCD_1)
2079 { if ( LastChar != ' ' && LastChar != 0)
2080 sprintf(TempString, " %s ", PredText);
2081 else
2082 sprintf(TempString, "%s ", PredText);
2083 }
2084 else
2085 { if ( LastChar != ' ' && LastChar != 0)
2086 sprintf(TempString, " %s. ", PredText);
2087 else
2088 sprintf(TempString, "%s. ", PredText);
2089 }
2090 edtInsertString(data->edt_edt, TempString);
2091 }
2092 }
2093 PredText[0] = '\0';
2094 ResetDictSearch();
2095 win_show(data->edt_win);
2096 break;
2097 }
2098
2099 default:
2100 /* any key */
2101 if (data->editor_data.mode NEQ READ_ONLY_MODE) /* ignore normal keys if in read-only mode */
2102 {
2103 {
2104 editEventKey(event,keyboard);
2105 if (data->editor_data.min_enter > 0)
2106 {
2107 win_show(data->edt_win); /* in order to update the Softkeys */
2108 }
2109 else
2110 {
2111 edtShow(data->edt_edt);
2112 }
2113 }
2114 }
2115 break;
2116 }
2117 }
2118 }
2119 #endif
2120 return MFW_EVENT_CONSUMED;
2121 }
2122
2123 /*******************************************************************************
2124
2125 $Function: editor_tim_cb
2126
2127 $Description: Callback function for the editor info timer.
2128
2129 $Returns: None.
2130
2131 $Arguments: None.
2132
2133 *******************************************************************************/
2134 static int editor_tim_cb (T_MFW_EVENT event, T_MFW_TIM *tc)
2135 {
2136 T_MFW_HND win = mfw_parent (mfw_header());
2137 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
2138 T_EDITOR_INFO * data = (T_EDITOR_INFO *)win_data->user;
2139
2140 T_MFW_HND parent_win = data->parent;
2141 USHORT Identifier = data->editor_data.Identifier;
2142 T_EDIT_CB Callback = data->editor_data.Callback;
2143
2144 /* timer elapsed => selfdestroy; sendevent INFO_TIMEOUT */
2145 editor_destroy (data->edt_win);
2146
2147 if (Callback)
2148 (Callback) (parent_win, Identifier, INFO_TIMEOUT);
2149
2150 return MFW_EVENT_CONSUMED;
2151 }
2152
2153 T_MFW_HND editor_start_common(T_MFW_HND win, char * buffer, U16 len, T_EDITOR_DATA * editor_info, T_EDIT_CB editor_cb)
2154 {
2155 editor_attr_init( &editor_info->editor_attr, ZONE_BORDER_EDITOR, edtCurBar1, EDITOR_CONTROLS, buffer, len, COLOUR_EDITOR);
2156 editor_info->hide = FALSE;
2157 editor_info->destroyEditor = TRUE;
2158 editor_info->Callback = editor_cb;
2159
2160 /* create the dialog handler */
2161 return editor_start(win, editor_info); /* start the common editor */
2162 }
2163
2164 /*******************************************************************************
2165
2166 $Function: editor_hideInit
2167
2168 $Description: the editor hides letters and numbers behind '*'.
2169 Initialize editor for hide.
2170
2171 $Returns: None.
2172
2173 $Arguments: None.
2174
2175 *******************************************************************************/
2176 static void editor_hideInit(T_EDITOR_INFO *data)
2177 {
2178 USHORT len = strlen(data->editor_data.editor_attr.text);
2179
2180 TRACE_FUNCTION("MmiEditor.editor_hideInit");
2181
2182 /* get memory for the tempory buffer */
2183 data->tmpBuf = (char *) ALLOC_MEMORY(data->editor_data.editor_attr.size);
2184
2185 /* copy text to the tempory buffer */
2186 strcpy(data->tmpBuf, data->editor_data.editor_attr.text);
2187
2188 /* overwrite the string in the editor buffer with stars */
2189 memset(data->editor_data.editor_attr.text,'\0',sizeof(data->editor_data.editor_attr.text));
2190 edtReset(data->edt_edt);
2191
2192 while ( strlen(data->editor_data.editor_attr.text) < len )
2193 edtChar(data->edt_edt,'*');
2194
2195 /* show editor with hide buffer */
2196 if (data->editor_data.min_enter > 0)
2197 win_show(data->edt_win); /* in order to update the Softkeys */
2198 else
2199 edtShow(data->edt_edt);
2200
2201 return;
2202 }
2203
2204 /*******************************************************************************
2205
2206 $Function: editor_hideInsert
2207
2208 $Description: Insert the typed letter/number with editEventKey into the
2209 original editor buffer and insert a '*' into the hide buffer
2210
2211 $Returns: None.
2212
2213 $Arguments: None.
2214
2215 *******************************************************************************/
2216 static void editor_hideInsert(T_EDITOR_INFO *data, U8 key)
2217 {
2218 USHORT i;
2219 MfwEdt *edt = ((T_MFW_HDR *)(data->edt_edt))->data;
2220
2221 TRACE_FUNCTION("MmiEditor.editor_hideInsert");
2222
2223 /* check if no more space in buffer */
2224 if ((int) strlen(data->editor_data.editor_attr.text) >=
2225 data->editor_data.editor_attr.size - 1)
2226 return;
2227
2228 /* do insert on original editor buffer without cursor move: */
2229 if (!data->editor_data.editor_attr.mode)
2230 return;
2231 else
2232 /* if not in overwrite mode, move text behind cursor position 1 position
2233 to the right */
2234 if (!(data->editor_data.editor_attr.mode & edtModOverWr))
2235
2236 for (i = strlen(data->tmpBuf); i > edt->cp; i--)
2237 data->tmpBuf[i] = data->tmpBuf[i-1];
2238
2239 /* insert the character */
2240 data->tmpBuf[edt->cp] = (char) (key + '0');
2241
2242 /* do insert on hide buffer with cursor move */
2243 edtChar(data->edt_edt,'*');
2244
2245 /* show editor with hide buffer */
2246 if (data->editor_data.min_enter > 0)
2247 win_show(data->edt_win); /* in order to update the Softkeys */
2248 else
2249 edtShow(data->edt_edt);
2250
2251 return;
2252 }
2253
2254 /*******************************************************************************
2255
2256 $Function: editor_hideClear
2257
2258 $Description: clears a character at the cursor position inthe original editor
2259 buffer and the hide buffer
2260
2261 $Returns: None.
2262
2263 $Arguments: None.
2264
2265 *******************************************************************************/
2266 static void editor_hideClear(T_EDITOR_INFO *data)
2267 {
2268 MfwEdt *edt = ((T_MFW_HDR *)(data->edt_edt))->data;
2269
2270 TRACE_FUNCTION("MmiEditor.editor_hideClear");
2271
2272 /* check if at beginning of buffer */
2273 if (edt->cp == 0)
2274 return;
2275
2276 /* do delete on original editor buffer without cursor move */
2277 strcpy(data->tmpBuf + edt->cp - 1, data->tmpBuf + edt->cp);
2278
2279 /* do delete on hide buffer with cursor move */
2280 edtChar(data->edt_edt,ecBack);
2281
2282 /* show editor with hide buffer */
2283 if (data->editor_data.min_enter > 0)
2284 win_show(data->edt_win); /* in order to update the Softkeys */
2285 else
2286 edtShow(data->edt_edt);
2287
2288 return;
2289 }
2290
2291 /*******************************************************************************
2292
2293 $Function: editor_hideClearAll
2294
2295 $Description: clears hole original editor buffer and hole hide buffer
2296
2297 $Returns: None.
2298
2299 $Arguments: None.
2300
2301 *******************************************************************************/
2302 static void editor_hideClearAll(T_EDITOR_INFO *data)
2303 {
2304 TRACE_FUNCTION("MmiEditor.editor_hideClearAll");
2305
2306 /* clear the original editor buffer and the hide buffer */
2307 memset(data->tmpBuf,'\0',sizeof(data->tmpBuf));
2308 memset(data->editor_data.editor_attr.text,'\0',sizeof(data->editor_data.editor_attr.text));
2309 edtReset(data->edt_edt);
2310
2311 /* show editor with hide buffer */
2312 if (data->editor_data.min_enter > 0)
2313 win_show(data->edt_win); /* in order to update the Softkeys */
2314 else
2315 edtShow(data->edt_edt);
2316
2317 return;
2318 }
2319
2320 /*******************************************************************************
2321
2322 $Function: editor_hideTerminate
2323
2324 $Description: switchs the normal editor buffer with the tempory buffer in
2325 T_EDITOR_INFO
2326
2327 $Returns: None.
2328
2329 $Arguments: None.
2330
2331 *******************************************************************************/
2332 static void editor_hideTerminate(T_EDITOR_INFO *data)
2333 {
2334 TRACE_FUNCTION("MmiEditor.editor_hideTerminate");
2335
2336 /* overwrite the stars with the original typed text */
2337 strcpy(data->editor_data.editor_attr.text, data->tmpBuf);
2338
2339 /* free the memory for the tempory buffer */
2340 FREE_MEMORY ((void *)data->tmpBuf, data->editor_data.editor_attr.size);
2341
2342 return;
2343 }