FreeCalypso > hg > fc-tourmaline
comparison src/ui/bmi/mmiTimeDate.c @ 92:c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 08 Nov 2020 06:39:16 +0000 |
parents | 67bfe9f274f6 |
children | d0a2eaf41733 |
comparison
equal
deleted
inserted
replaced
91:c3d28a37caad | 92:c0052fe355d3 |
---|---|
1 /******************************************************************************* | 1 /******************************************************************************* |
2 | 2 |
3 CONDAT (UK) | 3 CONDAT (UK) |
4 | 4 |
5 ******************************************************************************** | 5 ******************************************************************************** |
6 | 6 |
7 This software product is the property of Condat (UK) Ltd and may not be | 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. | 8 disclosed to any third party without the express permission of the owner. |
9 | 9 |
10 ******************************************************************************** | 10 ******************************************************************************** |
11 | 11 |
12 $Project name: Basic MMI | 12 $Project name: Basic MMI |
13 $Project code: BMI (6349) | 13 $Project code: BMI (6349) |
14 $Module: MMI | 14 $Module: MMI |
15 $File: MmiTimeDate.c | 15 $File: MmiTimeDate.c |
16 $Revision: 1.0 | 16 $Revision: 1.0 |
17 | 17 |
18 $Author: Condat(UK) | 18 $Author: Condat(UK) |
19 $Date: 22/02/01 | 19 $Date: 22/02/01 |
20 | 20 |
21 ******************************************************************************** | 21 ******************************************************************************** |
22 | 22 |
23 Description: | 23 Description: |
24 | 24 |
25 | 25 |
26 | 26 |
27 ******************************************************************************** | 27 ******************************************************************************** |
28 | 28 |
29 $History: MmiTimeDate.c | 29 $History: MmiTimeDate.c |
30 | 30 |
31 Apr 03, 2007 REF: OMAPS00123995 x0039928 | 31 Apr 03, 2007 REF: OMAPS00123995 x0039928 |
32 Description: Alarm is playing midi or imelody files only once. | 32 Description: Alarm is playing midi or imelody files only once. |
33 Solution: Loop parameter is changed from FALSE to TRUE | 33 Solution: Loop parameter is changed from FALSE to TRUE |
34 | 34 |
35 Aug 10, 2006 REF: OMAPS00076372 x0039928 | 35 Aug 10, 2006 REF: OMAPS00076372 x0039928 |
36 Description: Incoming Alram with midi ringer during voice call | 36 Description: Incoming Alram with midi ringer during voice call |
37 Solution: Beep tone is played when alarm expires during the call | 37 Solution: Beep tone is played when alarm expires during the call |
38 | 38 |
39 Apr 18, 2006 REF:OMAPS00075303 Prabakar R (a0393213) | 39 Apr 18, 2006 REF:OMAPS00075303 Prabakar R (a0393213) |
40 Description: The valid date field is 01/01/2000 to 31/12/2099, when input invalid date it will indicate "saved" but | 40 Description: The valid date field is 01/01/2000 to 31/12/2099, when input invalid date it will indicate "saved" but |
41 return to Idle screen, the date is not the input date. (for example: input the date "01/01/2110" then saved, | 41 return to Idle screen, the date is not the input date. (for example: input the date "01/01/2110" then saved, |
42 it will indicate "saved", but the date in Idle is "01/01/2010" instead.) | 42 it will indicate "saved", but the date in Idle is "01/01/2010" instead.) |
43 Solution : Validation for the date was wrong. Upperbound was not included. It is included. | 43 Solution : Validation for the date was wrong. Upperbound was not included. It is included. |
44 | 44 |
45 Apr 04, 2006 REF:OMAPS00073057 Prabakar R (a0393213) | 45 Apr 04, 2006 REF:OMAPS00073057 Prabakar R (a0393213) |
46 Description: When the time format is 12hr, user can not set current time to be 12 hour. | 46 Description: When the time format is 12hr, user can not set current time to be 12 hour. |
47 After user set the current time to be 12 hour and return the idle screen, the current time isn't 12 hour | 47 After user set the current time to be 12 hour and return the idle screen, the current time isn't 12 hour |
48 Solution : Validation for 12 hours format was wrong. It is corrected. | 48 Solution : Validation for 12 hours format was wrong. It is corrected. |
49 | 49 |
50 Nov 02, 2005 REF:ER OMAPS00039044 xdeepadh | 50 Nov 02, 2005 REF:ER OMAPS00039044 xdeepadh |
51 Description: Mp3 Ringer Implementation | 51 Description: Mp3 Ringer Implementation |
52 Solution: The Midi Ringer application has been enhanced to support mp3 as ringer. | 52 Solution: The Midi Ringer application has been enhanced to support mp3 as ringer. |
53 The interface function names have been modified. | 53 The interface function names have been modified. |
54 | 54 |
55 Apr 05, 2005 REF: ENH 29994 xdeepadh | 55 Apr 05, 2005 REF: ENH 29994 xdeepadh |
56 Description: Implementation of Generic Midi Ringer and Modification of existing Midi Test Application | 56 Description: Implementation of Generic Midi Ringer and Modification of existing Midi Test Application |
57 Solution: Generic Midi Ringer and Midi Test Application were implemented. | 57 Solution: Generic Midi Ringer and Midi Test Application were implemented. |
58 | 58 |
59 Jan 06,2004 REF: CRR 27859 xkundadu | 59 Jan 06,2004 REF: CRR 27859 xkundadu |
60 Description: Clock: Alarm does not go off even if timer times out. | 60 Description: Clock: Alarm does not go off even if timer times out. |
61 Solution: If the mfw_td_set_alarm() function fails, display the | 61 Solution: If the mfw_td_set_alarm() function fails, display the |
62 'Write Failed" message. | 62 'Write Failed" message. |
63 | 63 |
64 Oct 14, 2004 REF: CRR 25756 xnkulkar | 64 Oct 14, 2004 REF: CRR 25756 xnkulkar |
65 Description: Alarm setting not allowed | 65 Description: Alarm setting not allowed |
66 Solution: We are checking the time format (12/24 Hour) and accordingly setting the | 66 Solution: We are checking the time format (12/24 Hour) and accordingly setting the |
67 format flag. Also the conversion of time from 24 to 12 or 12 to 24 hour format is done | 67 format flag. Also the conversion of time from 24 to 12 or 12 to 24 hour format is done |
68 before displaying it on the alarm editor screen. | 68 before displaying it on the alarm editor screen. |
69 | 69 |
70 25/10/00 Original Condat(UK) BMI version. | 70 25/10/00 Original Condat(UK) BMI version. |
71 | 71 |
72 $End | 72 $End |
73 | 73 |
74 *******************************************************************************/ | 74 *******************************************************************************/ |
75 | 75 |
76 | 76 |
130 #include "mfw_sat.h" | 130 #include "mfw_sat.h" |
131 #include "Mfw_td.h"/*SPR 2639*/ | 131 #include "Mfw_td.h"/*SPR 2639*/ |
132 | 132 |
133 //x0pleela 22 May, 2007 DR: OMAPS00127483 | 133 //x0pleela 22 May, 2007 DR: OMAPS00127483 |
134 #ifdef FF_PHONE_LOCK | 134 #ifdef FF_PHONE_LOCK |
135 #ifdef FF_MIDI_RINGER | 135 #ifdef FF_MIDI_RINGER |
136 #include "mfw_midi.h" | 136 #include "mfw_midi.h" |
137 #endif //FF_MIDI_RINGER | 137 #endif //FF_MIDI_RINGER |
138 #endif /* FF_PHONE_LOCK */ | 138 #endif /* FF_PHONE_LOCK */ |
139 | 139 |
140 #include "dspl.h" | 140 #include "dspl.h" |
141 | 141 |
142 | 142 |
164 #else | 164 #else |
165 #include "MmiEditor.h" | 165 #include "MmiEditor.h" |
166 #endif | 166 #endif |
167 | 167 |
168 // Apr 05, 2005 REF: ENH 29994 xdeepadh | 168 // Apr 05, 2005 REF: ENH 29994 xdeepadh |
169 #ifdef FF_MIDI_RINGER | 169 #ifdef FF_MIDI_RINGER |
170 #include "mmiCall.h" | 170 #include "mmiCall.h" |
171 #include "mfw_midi.h" | 171 #include "mfw_midi.h" |
172 extern T_call call_data; | 172 extern T_call call_data; |
173 #endif | 173 #endif |
174 | 174 |
176 #ifdef FF_PHONE_LOCK | 176 #ifdef FF_PHONE_LOCK |
177 #include "mfw_sim.h" | 177 #include "mfw_sim.h" |
178 | 178 |
179 //x0pleela 22 May, 2007 DR: OMAPS00127483 | 179 //x0pleela 22 May, 2007 DR: OMAPS00127483 |
180 #include "MmiSounds.h" | 180 #include "MmiSounds.h" |
181 extern int phlock_alarm; /* flag to check whether alarm event has occured or not */ | 181 extern int phlock_alarm; /* flag to check whether alarm event has occured or not */ |
182 | 182 |
183 //x0pleela 22 May, 2007 DR: OMAPS00127483 | 183 //x0pleela 22 May, 2007 DR: OMAPS00127483 |
184 extern T_MFW_HND phlock_win_handle; /* to hold the win handle of phone unlock editor window */ | 184 extern T_MFW_HND phlock_win_handle; /* to hold the win handle of phone unlock editor window */ |
185 #ifdef FF_MMI_AUDIO_PROFILE | 185 #ifdef FF_MMI_AUDIO_PROFILE |
186 extern UBYTE mfwAudPlay;//flag for audio | 186 extern UBYTE mfwAudPlay;//flag for audio |
187 #endif | 187 #endif |
188 | 188 |
189 #endif //FF_PHONE_LOCK | 189 #endif //FF_PHONE_LOCK |
190 | 190 |
191 void alarm_screen(void); // RAVI | 191 void alarm_screen(void); // RAVI |
197 //#endif | 197 //#endif |
198 | 198 |
199 /* SPR#1428 - SH - New Editor changes. | 199 /* SPR#1428 - SH - New Editor changes. |
200 * Time and date module pretty much rewritten to use new formatted input of editor. | 200 * Time and date module pretty much rewritten to use new formatted input of editor. |
201 */ | 201 */ |
202 | 202 |
203 #ifdef NEW_EDITOR | 203 #ifdef NEW_EDITOR |
204 | 204 |
205 /* LOCAL FUNCTION PROTOTYPES */ | 205 /* LOCAL FUNCTION PROTOTYPES */ |
206 T_MFW_HND tida_create(T_MFW_HND parent_win); | 206 T_MFW_HND tida_create(T_MFW_HND parent_win); |
207 static int tida_win_cb (T_MFW_EVENT event, T_MFW_WIN * win); | 207 static int tida_win_cb (T_MFW_EVENT event, T_MFW_WIN * win); |
308 $Description: initialises time and date | 308 $Description: initialises time and date |
309 | 309 |
310 $Returns: none. | 310 $Returns: none. |
311 | 311 |
312 $Arguments: none | 312 $Arguments: none |
313 | 313 |
314 *******************************************************************************/ | 314 *******************************************************************************/ |
315 void time_date_init() | 315 void time_date_init() |
316 { mfw_td_init(); | 316 { mfw_td_init(); |
317 | 317 |
318 td_handle = mfw_td_create(NULL, MFW_TD_ALARM, time_date_cb); | 318 td_handle = mfw_td_create(NULL, MFW_TD_ALARM, time_date_cb); |
319 } | 319 } |
320 /******************************************************************************* | 320 /******************************************************************************* |
321 | 321 |
322 $Function: time_date_init | 322 $Function: time_date_init |
323 | 323 |
324 $Description: deletes mfw td | 324 $Description: deletes mfw td |
325 | 325 |
326 $Returns: none. | 326 $Returns: none. |
327 | 327 |
328 $Arguments: none | 328 $Arguments: none |
329 | 329 |
330 *******************************************************************************/ | 330 *******************************************************************************/ |
331 void time_date_delete() | 331 void time_date_delete() |
332 { | 332 { |
333 mfw_td_delete(td_handle); | 333 mfw_td_delete(td_handle); |
334 mfw_td_exit(); | 334 mfw_td_exit(); |
340 $Description: handles alarm event from MFW | 340 $Description: handles alarm event from MFW |
341 | 341 |
342 $Returns: none. | 342 $Returns: none. |
343 | 343 |
344 $Arguments: none | 344 $Arguments: none |
345 | 345 |
346 *******************************************************************************/ | 346 *******************************************************************************/ |
347 int time_date_cb(T_MFW_EVENT event,void* para) | 347 int time_date_cb(T_MFW_EVENT event,void* para) |
348 { TRACE_EVENT_P1("time_date_cb():%d",event); | 348 { TRACE_EVENT_P1("time_date_cb():%d",event); |
349 alarm_screen(); | 349 alarm_screen(); |
350 | 350 |
359 $Description: Handles alarm screen keypresses | 359 $Description: Handles alarm screen keypresses |
360 | 360 |
361 $Returns: none. | 361 $Returns: none. |
362 | 362 |
363 $Arguments: window handle, identifier, reason(key pressed) | 363 $Arguments: window handle, identifier, reason(key pressed) |
364 | 364 |
365 *******************************************************************************/ | 365 *******************************************************************************/ |
366 void alarm_screen_cb(T_MFW_HND win, USHORT identifier, UBYTE reason) | 366 void alarm_screen_cb(T_MFW_HND win, USHORT identifier, UBYTE reason) |
367 { | 367 { |
368 TRACE_FUNCTION("alarm_screen_cb()"); | 368 TRACE_FUNCTION("alarm_screen_cb()"); |
369 // Apr 05, 2005 REF: ENH 29994 xdeepadh | 369 // Apr 05, 2005 REF: ENH 29994 xdeepadh |
370 //Nov 02, 2005 REF:ER OMAPS00039044 xdeepadh | 370 //Nov 02, 2005 REF:ER OMAPS00039044 xdeepadh |
371 /*get current alarm id*/ | 371 /*get current alarm id*/ |
372 | 372 |
373 //x0pleela 22 May, 2007 DR: OMAPS00127483 | 373 //x0pleela 22 May, 2007 DR: OMAPS00127483 |
374 //Stopping the alarm ringer based on the MfwAudPlay flag | 374 //Stopping the alarm ringer based on the MfwAudPlay flag |
375 #ifdef FF_PHONE_LOCK | 375 #ifdef FF_PHONE_LOCK |
376 #ifdef FF_MMI_AUDIO_PROFILE | 376 #ifdef FF_MMI_AUDIO_PROFILE |
377 if( mfwAudPlay) | 377 if( mfwAudPlay) |
378 #endif | 378 #endif |
379 { | 379 { |
380 #endif // FF_PHONE_LOCK | 380 #endif // FF_PHONE_LOCK |
381 /*stop alarm*/ | 381 /*stop alarm*/ |
382 #ifdef FF_MIDI_RINGER | 382 #ifdef FF_MIDI_RINGER |
383 mfw_ringer_stop(sounds_midi_ringer_stop_cb); | 383 mfw_ringer_stop(sounds_midi_ringer_stop_cb); |
384 #else | 384 #else |
385 #ifdef FF_MMI_RINGTONE /*MSL Stop */ | 385 #ifdef FF_MMI_RINGTONE /*MSL Stop */ |
386 audio_StopSoundbyID( AUDIO_BUZZER, ALARMTONE_SELECT); | 386 audio_StopSoundbyID( AUDIO_BUZZER, ALARMTONE_SELECT); |
387 #else | 387 #else |
388 { | 388 { |
389 UBYTE currentAlarm; | 389 UBYTE currentAlarm; |
390 currentAlarm=getcurrentAlarmTone(); | 390 currentAlarm=getcurrentAlarmTone(); |
391 audio_StopSoundbyID(AUDIO_BUZZER, currentAlarm); | 391 audio_StopSoundbyID(AUDIO_BUZZER, currentAlarm); |
392 } | 392 } |
393 #endif | 393 #endif |
394 #endif | 394 #endif |
395 //x0pleela 22 May, 2007 DR: OMAPS00127483 | 395 //x0pleela 22 May, 2007 DR: OMAPS00127483 |
396 #ifdef FF_PHONE_LOCK | 396 #ifdef FF_PHONE_LOCK |
397 } | 397 } |
398 #endif // FF_PHONE_LOCK | 398 #endif // FF_PHONE_LOCK |
399 //x0pleela 05 Apr, 2007 ER: OMAPS00122561 | 399 //x0pleela 05 Apr, 2007 ER: OMAPS00122561 |
400 #ifdef FF_PHONE_LOCK | 400 #ifdef FF_PHONE_LOCK |
401 if( phlock_alarm) | 401 if( phlock_alarm) |
402 phlock_alarm = FALSE; | 402 phlock_alarm = FALSE; |
403 #endif //FF_PHONE_LOCK | 403 #endif //FF_PHONE_LOCK |
404 | 404 |
405 } | 405 } |
406 | 406 |
407 | 407 |
408 /******************************************************************************* | 408 /******************************************************************************* |
409 | 409 |
412 $Description: displays alarm screen | 412 $Description: displays alarm screen |
413 | 413 |
414 $Returns: none. | 414 $Returns: none. |
415 | 415 |
416 $Arguments: none | 416 $Arguments: none |
417 | 417 |
418 *******************************************************************************/ | 418 *******************************************************************************/ |
419 void alarm_screen(void) | 419 void alarm_screen(void) |
420 { | 420 { |
421 T_MFW_HND idle_win = idle_get_window(); | 421 T_MFW_HND idle_win = idle_get_window(); |
422 T_DISPLAY_DATA display_info; | 422 T_DISPLAY_DATA display_info; |
423 T_MFW_TIME* time; | 423 T_MFW_TIME* time; |
424 static char text[25]; | 424 static char text[25]; |
425 | 425 |
426 | 426 |
427 TRACE_FUNCTION("alarm_screen()"); | 427 TRACE_FUNCTION("alarm_screen()"); |
428 | 428 |
429 /*SPR 2639, convert function to use new MFW functions*/ | 429 /*SPR 2639, convert function to use new MFW functions*/ |
430 time = mfw_td_get_time(); | 430 time = mfw_td_get_time(); |
431 | 431 |
432 sprintf(text, "%02d:%02d", time->hour, time->minute); | 432 sprintf(text, "%02d:%02d", time->hour, time->minute); |
433 // Apr 05, 2005 REF: ENH 29994 xdeepadh | 433 // Apr 05, 2005 REF: ENH 29994 xdeepadh |
434 /*SPR 2639 get current alarm id and play it*/ | 434 /*SPR 2639 get current alarm id and play it*/ |
435 //Nov 02, 2005 REF:ER OMAPS00039044 xdeepadh | 435 //Nov 02, 2005 REF:ER OMAPS00039044 xdeepadh |
436 //If Alarm is recieved , while in call screen,dont play the tone. | 436 //If Alarm is recieved , while in call screen,dont play the tone. |
437 #ifdef FF_MIDI_RINGER | 437 #ifdef FF_MIDI_RINGER |
438 if((!(call_data.calls.numCalls))) | 438 if((!(call_data.calls.numCalls))) |
439 { | 439 { |
440 /* Apr 03, 2007 REF: OMAPS00123995 x0039928 */ | 440 /* Apr 03, 2007 REF: OMAPS00123995 x0039928 */ |
441 mfw_ringer_start(AS_RINGER_MODE_ALARM,TRUE,sounds_midi_ringer_start_cb); | 441 mfw_ringer_start(AS_RINGER_MODE_ALARM,TRUE,sounds_midi_ringer_start_cb); |
442 } | 442 } |
456 } | 456 } |
457 #endif | 457 #endif |
458 #endif | 458 #endif |
459 /*SPR 2639 end*/ | 459 /*SPR 2639 end*/ |
460 | 460 |
461 | 461 |
462 dlg_initDisplayData_TextId( &display_info, TxtSoftOK, TxtNull, TxtAlarm, TxtNull , COLOUR_STATUS); | 462 dlg_initDisplayData_TextId( &display_info, TxtSoftOK, TxtNull, TxtAlarm, TxtNull , COLOUR_STATUS); |
463 | 463 |
464 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)alarm_screen_cb, FOREVER, KEY_CLEAR|KEY_LEFT|KEY_RIGHT ); | 464 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)alarm_screen_cb, FOREVER, KEY_CLEAR|KEY_LEFT|KEY_RIGHT ); |
465 display_info.TextString2 = text; | 465 display_info.TextString2 = text; |
466 //x0pleela 05 Apr, 2007 ER: OMAPS00122561 | 466 //x0pleela 05 Apr, 2007 ER: OMAPS00122561 |
467 #ifdef FF_PHONE_LOCK | 467 #ifdef FF_PHONE_LOCK |
468 //x0pleela 22 May, 2007 DR: OMAPS00127483 | 468 //x0pleela 22 May, 2007 DR: OMAPS00127483 |
469 //Instead of querying sec driver for the status of phone lock, we are checking for the phock password entry window | 469 //Instead of querying sec driver for the status of phone lock, we are checking for the phock password entry window |
470 //When ringer for alarm is playing in phone locked state, Audio usues the DMA channels | 470 //When ringer for alarm is playing in phone locked state, Audio usues the DMA channels |
471 //which will be active. The DMA channels will be available only after the audio file is fully played. | 471 //which will be active. The DMA channels will be available only after the audio file is fully played. |
472 //This will cause that process to be blocked until the DMA channel becomes in-active and in turn if we try to | 472 //This will cause that process to be blocked until the DMA channel becomes in-active and in turn if we try to |
473 //query or access secure driver we are blocked until the audio file is completely played. | 473 //query or access secure driver we are blocked until the audio file is completely played. |
474 //Since this is a hardware constraint, we found a workaround for this issue and are stopping the ringer | 474 //Since this is a hardware constraint, we found a workaround for this issue and are stopping the ringer |
475 //for alarm before accessing secure driver for enabling or disbaling the phone lock. | 475 //for alarm before accessing secure driver for enabling or disbaling the phone lock. |
476 if( phlock_win_handle ) | 476 if( phlock_win_handle ) |
477 { | 477 { |
478 phlock_alarm = TRUE; | 478 phlock_alarm = TRUE; |
479 info_dialog( mfwParent(mfwHeader()), &display_info ); | 479 info_dialog( mfwParent(mfwHeader()), &display_info ); |
490 | 490 |
491 | 491 |
492 | 492 |
493 /******************************************************************************* | 493 /******************************************************************************* |
494 | 494 |
495 $Function: clear_alarm | 495 $Function: clear_alarm |
496 | 496 |
497 $Description: handles menu option to cancel any existing alarm setting | 497 $Description: handles menu option to cancel any existing alarm setting |
498 | 498 |
499 $Returns: status int | 499 $Returns: status int |
500 | 500 |
501 $Arguments: menu and item (not used) | 501 $Arguments: menu and item (not used) |
502 | 502 |
503 *******************************************************************************/ | 503 *******************************************************************************/ |
504 int clear_alarm(MfwMnu* m, MfwMnuItem* i) | 504 int clear_alarm(MfwMnu* m, MfwMnuItem* i) |
505 { T_MFW_HND win = mfwParent( mfw_header() ); | 505 { T_MFW_HND win = mfwParent( mfw_header() ); |
506 T_DISPLAY_DATA display_info; | 506 T_DISPLAY_DATA display_info; |
507 | 507 |
508 | 508 |
509 /*SPR 2639, changed to use new MFW functions*/ | 509 /*SPR 2639, changed to use new MFW functions*/ |
510 mfw_td_cancel_alarm(); | 510 mfw_td_cancel_alarm(); |
511 | 511 |
512 dlg_initDisplayData_TextId( &display_info, TxtSoftOK, TxtNull, TxtAlarm, TxtCancelled , COLOUR_STATUS); | 512 dlg_initDisplayData_TextId( &display_info, TxtSoftOK, TxtNull, TxtAlarm, TxtCancelled , COLOUR_STATUS); |
513 dlg_initDisplayData_events( &display_info, NULL, THREE_SECS, KEY_CLEAR|KEY_LEFT|KEY_RIGHT ); | 513 dlg_initDisplayData_events( &display_info, NULL, THREE_SECS, KEY_CLEAR|KEY_LEFT|KEY_RIGHT ); |
514 | 514 |
515 /* Call Info Screen | 515 /* Call Info Screen |
516 */ | 516 */ |
517 info_dialog( win, &display_info ); | 517 info_dialog( win, &display_info ); |
518 | 518 |
519 | 519 |
529 $Description: handles selection of twleve hour clock in menu | 529 $Description: handles selection of twleve hour clock in menu |
530 | 530 |
531 $Returns: status int | 531 $Returns: status int |
532 | 532 |
533 $Arguments: menu and item (not used) | 533 $Arguments: menu and item (not used) |
534 | 534 |
535 *******************************************************************************/ | 535 *******************************************************************************/ |
536 int twelve_hour_clock(MfwMnu* m, MfwMnuItem* i) | 536 int twelve_hour_clock(MfwMnu* m, MfwMnuItem* i) |
537 { T_MFW_HND win = mfwParent( mfw_header() ); | 537 { T_MFW_HND win = mfwParent( mfw_header() ); |
538 T_DISPLAY_DATA display_info; | 538 T_DISPLAY_DATA display_info; |
539 // char text[25]; // RAVI | 539 // char text[25]; // RAVI |
540 | 540 |
541 setClockFormat(MFW_TIME_FORMAT_12HOUR);/*SPR 2639*/ | 541 setClockFormat(MFW_TIME_FORMAT_12HOUR);/*SPR 2639*/ |
542 | 542 |
543 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TxtClockSetTo, TxtTwelveHour, COLOUR_STATUS); | 543 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TxtClockSetTo, TxtTwelveHour, COLOUR_STATUS); |
544 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)NULL, THREE_SECS, KEY_CLEAR|KEY_LEFT|KEY_RIGHT ); | 544 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)NULL, THREE_SECS, KEY_CLEAR|KEY_LEFT|KEY_RIGHT ); |
545 | 545 |
546 /* Call Info Screen | 546 /* Call Info Screen |
547 */ | 547 */ |
562 *******************************************************************************/ | 562 *******************************************************************************/ |
563 int twentyfour_hour_clock(MfwMnu* m, MfwMnuItem* i) | 563 int twentyfour_hour_clock(MfwMnu* m, MfwMnuItem* i) |
564 { T_MFW_HND win = mfwParent( mfw_header() ); | 564 { T_MFW_HND win = mfwParent( mfw_header() ); |
565 T_DISPLAY_DATA display_info; | 565 T_DISPLAY_DATA display_info; |
566 // char text[25]; // RAVI | 566 // char text[25]; // RAVI |
567 | 567 |
568 setClockFormat(MFW_TIME_FORMAT_24HOUR);/*SPR 2639*/ | 568 setClockFormat(MFW_TIME_FORMAT_24HOUR);/*SPR 2639*/ |
569 | 569 |
570 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TxtClockSetTo, TxtTwentyfourHour, COLOUR_STATUS); | 570 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TxtClockSetTo, TxtTwentyfourHour, COLOUR_STATUS); |
571 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)NULL, THREE_SECS, KEY_CLEAR|KEY_LEFT|KEY_RIGHT ); | 571 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)NULL, THREE_SECS, KEY_CLEAR|KEY_LEFT|KEY_RIGHT ); |
572 | 572 |
573 /* Call Info Screen | 573 /* Call Info Screen |
574 */ | 574 */ |
579 } | 579 } |
580 | 580 |
581 | 581 |
582 /******************************************************************************* | 582 /******************************************************************************* |
583 | 583 |
584 $Function: alarmTimeDate | 584 $Function: alarmTimeDate |
585 | 585 |
586 $Description: Called when user selects alarm in menu. Begins editor to enter | 586 $Description: Called when user selects alarm in menu. Begins editor to enter |
587 desired alarm time and date. | 587 desired alarm time and date. |
588 | 588 |
589 $Returns: status int | 589 $Returns: status int |
590 | 590 |
591 $Arguments: menu and item (not used) | 591 $Arguments: menu and item (not used) |
592 | 592 |
593 *******************************************************************************/ | 593 *******************************************************************************/ |
594 int alarmTimeDate(MfwMnu* m, MfwMnuItem* i) | 594 int alarmTimeDate(MfwMnu* m, MfwMnuItem* i) |
595 { | 595 { |
596 /* SPR#1428 - SH - New Editor changes */ | 596 /* SPR#1428 - SH - New Editor changes */ |
597 #ifdef NEW_EDITOR | 597 #ifdef NEW_EDITOR |
600 | 600 |
601 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; | 601 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; |
602 T_tida *data = (T_tida *)win_data->user; | 602 T_tida *data = (T_tida *)win_data->user; |
603 | 603 |
604 TRACE_FUNCTION ("MmiTimeDate:alarmTimeDate()"); | 604 TRACE_FUNCTION ("MmiTimeDate:alarmTimeDate()"); |
605 | 605 |
606 if(data->win) | 606 if(data->win) |
607 { | 607 { |
608 SEND_EVENT(data->win, TIDA_ALARMDATE,0,0); | 608 SEND_EVENT(data->win, TIDA_ALARMDATE,0,0); |
609 | 609 |
610 } | 610 } |
629 return 1; | 629 return 1; |
630 } | 630 } |
631 | 631 |
632 /******************************************************************************* | 632 /******************************************************************************* |
633 | 633 |
634 $Function: settingsTimeDate | 634 $Function: settingsTimeDate |
635 | 635 |
636 $Description: settings date and time menu function | 636 $Description: settings date and time menu function |
637 | 637 |
638 $Returns: none. | 638 $Returns: none. |
639 | 639 |
640 $Arguments: | 640 $Arguments: |
641 | 641 |
642 *******************************************************************************/ | 642 *******************************************************************************/ |
643 int settingsTimeDate(MfwMnu* m, MfwMnuItem* i) | 643 int settingsTimeDate(MfwMnu* m, MfwMnuItem* i) |
644 { | 644 { |
645 /* SPR#1428 - SH - New Editor changes */ | 645 /* SPR#1428 - SH - New Editor changes */ |
646 #ifdef NEW_EDITOR | 646 #ifdef NEW_EDITOR |
649 | 649 |
650 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; | 650 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; |
651 T_tida *data = (T_tida *)win_data->user; | 651 T_tida *data = (T_tida *)win_data->user; |
652 | 652 |
653 TRACE_FUNCTION ("MmiTimeDate:settingsTimeDate()"); | 653 TRACE_FUNCTION ("MmiTimeDate:settingsTimeDate()"); |
654 | 654 |
655 if(data->win) | 655 if(data->win) |
656 { | 656 { |
657 SEND_EVENT(data->win, TIDA_DATE,0,0); | 657 SEND_EVENT(data->win, TIDA_DATE,0,0); |
658 | 658 |
659 } | 659 } |
666 | 666 |
667 TRACE_FUNCTION ("MmiTimeDate:settingsTimeDate()"); | 667 TRACE_FUNCTION ("MmiTimeDate:settingsTimeDate()"); |
668 | 668 |
669 tida_data->state = DATE_ENTRY; | 669 tida_data->state = DATE_ENTRY; |
670 DateTimeEntryMode = SETTING; | 670 DateTimeEntryMode = SETTING; |
671 | 671 |
672 if(tida_data->tida_win) | 672 if(tida_data->tida_win) |
673 { | 673 { |
674 SEND_EVENT(tida_data->tida_win,DATE_ENTRY,0,tida_data); | 674 SEND_EVENT(tida_data->tida_win,DATE_ENTRY,0,tida_data); |
675 | 675 |
676 } | 676 } |
680 } | 680 } |
681 | 681 |
682 | 682 |
683 /* SPR#1428 - SH - New Editor changes | 683 /* SPR#1428 - SH - New Editor changes |
684 * New time/date code below. Uses tida_exec_cb as main "object". */ | 684 * New time/date code below. Uses tida_exec_cb as main "object". */ |
685 | 685 |
686 #ifdef NEW_EDITOR | 686 #ifdef NEW_EDITOR |
687 | 687 |
688 /******************************************************************************* | 688 /******************************************************************************* |
689 | 689 |
690 $Function: tida_create | 690 $Function: tida_create |
691 | 691 |
692 $Description: Create the main time/date window | 692 $Description: Create the main time/date window |
693 | 693 |
694 $Returns: The window handle | 694 $Returns: The window handle |
695 | 695 |
696 $Arguments: parent_win - The parent window | 696 $Arguments: parent_win - The parent window |
697 | 697 |
698 *******************************************************************************/ | 698 *******************************************************************************/ |
699 | 699 |
700 T_MFW_HND tida_create(T_MFW_HND parent_win) | 700 T_MFW_HND tida_create(T_MFW_HND parent_win) |
701 { | 701 { |
702 T_MFW_WIN * win_data; | 702 T_MFW_WIN * win_data; |
734 $Description: Destroy the main time/date window | 734 $Description: Destroy the main time/date window |
735 | 735 |
736 $Returns: None | 736 $Returns: None |
737 | 737 |
738 $Arguments: win - The main time/date window | 738 $Arguments: win - The main time/date window |
739 | 739 |
740 *******************************************************************************/ | 740 *******************************************************************************/ |
741 | 741 |
742 T_MFW_HND tida_destroy(T_MFW_HND win) | 742 T_MFW_HND tida_destroy(T_MFW_HND win) |
743 { | 743 { |
744 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; | 744 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; |
752 | 752 |
753 if (data->win) | 753 if (data->win) |
754 { | 754 { |
755 win_delete(data->win); | 755 win_delete(data->win); |
756 } | 756 } |
757 | 757 |
758 if (data) | 758 if (data) |
759 { | 759 { |
760 FREE_MEMORY((void *)data, sizeof(T_tida)); | 760 FREE_MEMORY((void *)data, sizeof(T_tida)); |
761 } | 761 } |
762 | 762 |
763 return NULL; /*a0393213 warnings removal-NULL is returned*/ | 763 return NULL; /*a0393213 warnings removal-NULL is returned*/ |
764 } | 764 } |
765 | 765 |
766 | 766 |
767 /******************************************************************************* | 767 /******************************************************************************* |
768 | 768 |
769 $Function: tida_win_cb | 769 $Function: tida_win_cb |
770 | 770 |
771 $Description: Window callback function for time and date. This is a non-displaying | 771 $Description: Window callback function for time and date. This is a non-displaying |
772 window, so does nothing! | 772 window, so does nothing! |
773 | 773 |
774 $Returns: None. | 774 $Returns: None. |
775 | 775 |
776 $Arguments: | 776 $Arguments: |
777 | 777 |
778 *******************************************************************************/ | 778 *******************************************************************************/ |
779 | 779 |
780 static int tida_win_cb (T_MFW_EVENT event, T_MFW_WIN * win) | 780 static int tida_win_cb (T_MFW_EVENT event, T_MFW_WIN * win) |
781 { | 781 { |
782 TRACE_FUNCTION ("MmiTimeDate: tida_win_cb"); | 782 TRACE_FUNCTION ("MmiTimeDate: tida_win_cb"); |
785 } | 785 } |
786 | 786 |
787 | 787 |
788 /******************************************************************************* | 788 /******************************************************************************* |
789 | 789 |
790 $Function: tida_exec_cb | 790 $Function: tida_exec_cb |
791 | 791 |
792 $Description: Main dialog function for time and date | 792 $Description: Main dialog function for time and date |
793 | 793 |
794 $Returns: None. | 794 $Returns: None. |
795 | 795 |
796 $Arguments: | 796 $Arguments: |
797 | 797 |
798 *******************************************************************************/ | 798 *******************************************************************************/ |
799 | 799 |
800 static void tida_exec_cb(T_MFW_HND win, USHORT event, SHORT value, void * parameter) | 800 static void tida_exec_cb(T_MFW_HND win, USHORT event, SHORT value, void * parameter) |
801 { | 801 { |
802 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; | 802 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; |
803 T_tida *data = (T_tida *)win_data->user;//tida main data | 803 T_tida *data = (T_tida *)win_data->user;//tida main data |
804 | 804 |
805 T_MFW_TIME* currclock; /*SPR 2639*/ | 805 T_MFW_TIME* currclock; /*SPR 2639*/ |
806 T_MFW_DATE* currdate; | 806 T_MFW_DATE* currdate; |
807 | 807 |
808 TRACE_FUNCTION("MmiTimeDate:tida_main"); | 808 TRACE_FUNCTION("MmiTimeDate:tida_main"); |
809 | 809 |
810 | 810 |
811 | 811 |
812 | 812 |
813 switch(event) | 813 switch(event) |
814 { | 814 { |
815 case TIDA_INIT: | 815 case TIDA_INIT: |
816 break; | 816 break; |
817 | 817 |
818 case TIDA_DATE: | 818 case TIDA_DATE: |
819 /*SPR 2639*/ | 819 /*SPR 2639*/ |
820 currdate = mfw_td_get_date(); | 820 currdate = mfw_td_get_date(); |
821 /* No date is set */ | 821 /* No date is set */ |
822 if (currdate->day == 0) | 822 if (currdate->day == 0) |
826 /* Date is already set */ | 826 /* Date is already set */ |
827 else | 827 else |
828 { | 828 { |
829 sprintf(data->buffer, "%02.02d/%02d/%04d", currdate->day, currdate->month, currdate->year); | 829 sprintf(data->buffer, "%02.02d/%02d/%04d", currdate->day, currdate->month, currdate->year); |
830 } | 830 } |
831 | 831 |
832 data->edit_win = tida_edit_create(win, event, TxtEnterDate, data->buffer, "NN\\/NN\\/NNNN"); | 832 data->edit_win = tida_edit_create(win, event, TxtEnterDate, data->buffer, "NN\\/NN\\/NNNN"); |
833 break; | 833 break; |
834 | 834 |
835 case TIDA_TIME: | 835 case TIDA_TIME: |
836 currclock = mfw_td_get_time();/*SPR 2639*/ | 836 currclock = mfw_td_get_time();/*SPR 2639*/ |
837 // Issue Number : MMI-SPR-12159 on 07/04/04 by Rashmi C N and Deepa M D | 837 // Issue Number : MMI-SPR-12159 on 07/04/04 by Rashmi C N and Deepa M D |
838 // change by Sasken ( Rashmi C N and Deepa M D) on April 07th 2004 | 838 // change by Sasken ( Rashmi C N and Deepa M D) on April 07th 2004 |
839 // Bug : In 12 hour fomrat the AM and PM was not being set | 839 // Bug : In 12 hour fomrat the AM and PM was not being set |
840 // Solution : Displaying the am/pm for editing in the time edit screen. | 840 // Solution : Displaying the am/pm for editing in the time edit screen. |
841 | 841 |
842 if(currclock->format==RTC_TIME_FORMAT_12HOUR) | 842 if(currclock->format==RTC_TIME_FORMAT_12HOUR) |
843 { | 843 { |
844 if(currclock->PM_flag) | 844 if(currclock->PM_flag) |
845 sprintf(data->buffer, "%02d:%02d pm", currclock->hour, currclock->minute); | 845 sprintf(data->buffer, "%02d:%02d pm", currclock->hour, currclock->minute); |
846 else | 846 else |
847 sprintf(data->buffer, "%02d:%02d am", currclock->hour, currclock->minute); | 847 sprintf(data->buffer, "%02d:%02d am", currclock->hour, currclock->minute); |
848 data->edit_win = tida_edit_create(win, event, TxtEnterTime, data->buffer, "NN\\:NN\\aa"); | 848 data->edit_win = tida_edit_create(win, event, TxtEnterTime, data->buffer, "NN\\:NN\\aa"); |
849 } | 849 } |
850 else | 850 else |
851 { | 851 { |
852 sprintf(data->buffer, "%02d:%02d", mfw_td_convert_to_24_hour(currclock), currclock->minute); | 852 sprintf(data->buffer, "%02d:%02d", mfw_td_convert_to_24_hour(currclock), currclock->minute); |
853 data->edit_win = tida_edit_create(win, event, TxtEnterTime, data->buffer, "NN\\:NN"); | 853 data->edit_win = tida_edit_create(win, event, TxtEnterTime, data->buffer, "NN\\:NN"); |
854 } | 854 } |
873 /* Date is already set */ | 873 /* Date is already set */ |
874 else | 874 else |
875 {/*SPR 2639*/ | 875 {/*SPR 2639*/ |
876 sprintf(data->buffer, "%02d/%02d/%04d", alarmDate.day, alarmDate.month, alarmDate.year); | 876 sprintf(data->buffer, "%02d/%02d/%04d", alarmDate.day, alarmDate.month, alarmDate.year); |
877 } | 877 } |
878 | 878 |
879 data->edit_win = tida_edit_create(win, event, TxtEnterDate, data->buffer, "NN\\/NN\\/NNNN"); | 879 data->edit_win = tida_edit_create(win, event, TxtEnterDate, data->buffer, "NN\\/NN\\/NNNN"); |
880 break; | 880 break; |
881 | 881 |
882 case TIDA_ALARMTIME: | 882 case TIDA_ALARMTIME: |
883 /*SPR 2639*/ | 883 /*SPR 2639*/ |
884 //sprintf(data->buffer,"%02d:%02d",alarmTime.hour, alarmTime.minute); | 884 //sprintf(data->buffer,"%02d:%02d",alarmTime.hour, alarmTime.minute); |
885 //data->edit_win = tida_edit_create(win, event, TxtEnterTime, data->buffer, "NN\\:NN"); | 885 //data->edit_win = tida_edit_create(win, event, TxtEnterTime, data->buffer, "NN\\:NN"); |
886 | 886 |
887 // xnkulkar SPR-25756: Alarm setting not allowed | 887 // xnkulkar SPR-25756: Alarm setting not allowed |
888 // Check the time format set and accordingly convert the time before displaying on | 888 // Check the time format set and accordingly convert the time before displaying on |
889 // the editor screen. | 889 // the editor screen. |
890 currclock = mfw_td_get_time(); | 890 currclock = mfw_td_get_time(); |
891 if(alarmTime.format!= currclock->format) | 891 if(alarmTime.format!= currclock->format) |
892 { | 892 { |
893 alarmTime.format = currclock->format; | 893 alarmTime.format = currclock->format; |
896 if (alarmTime.hour < 12) | 896 if (alarmTime.hour < 12) |
897 { | 897 { |
898 alarmTime.PM_flag=0; | 898 alarmTime.PM_flag=0; |
899 } | 899 } |
900 else | 900 else |
901 { //if after noon | 901 { //if after noon |
902 alarmTime.PM_flag=1; | 902 alarmTime.PM_flag=1; |
903 alarmTime.hour = alarmTime.hour-12; | 903 alarmTime.hour = alarmTime.hour-12; |
904 } | 904 } |
905 } | 905 } |
906 else | 906 else |
925 if(alarmTime.PM_flag) | 925 if(alarmTime.PM_flag) |
926 sprintf(data->buffer, "%02d:%02d pm",alarmTime.hour, alarmTime.minute); | 926 sprintf(data->buffer, "%02d:%02d pm",alarmTime.hour, alarmTime.minute); |
927 else | 927 else |
928 sprintf(data->buffer, "%02d:%02d am", alarmTime.hour, alarmTime.minute); | 928 sprintf(data->buffer, "%02d:%02d am", alarmTime.hour, alarmTime.minute); |
929 data->edit_win = tida_edit_create(win, event, TxtEnterTime, data->buffer, "NN\\:NN\\aa"); | 929 data->edit_win = tida_edit_create(win, event, TxtEnterTime, data->buffer, "NN\\:NN\\aa"); |
930 } | 930 } |
931 else | 931 else |
932 { | 932 { |
933 sprintf(data->buffer,"%02d:%02d", mfw_td_convert_to_24_hour(&alarmTime), alarmTime.minute); | 933 sprintf(data->buffer,"%02d:%02d", mfw_td_convert_to_24_hour(&alarmTime), alarmTime.minute); |
934 data->edit_win = tida_edit_create(win, event, TxtEnterTime, data->buffer, "NN\\:NN"); | 934 data->edit_win = tida_edit_create(win, event, TxtEnterTime, data->buffer, "NN\\:NN"); |
935 } | 935 } |
937 | 937 |
938 case TIDA_SAVE: | 938 case TIDA_SAVE: |
939 tida_show_dlg(win, TxtSaved, TxtNull); | 939 tida_show_dlg(win, TxtSaved, TxtNull); |
940 AUI_edit_Destroy(data->edit_win); | 940 AUI_edit_Destroy(data->edit_win); |
941 tida_destroy(data->win); | 941 tida_destroy(data->win); |
942 break; | 942 break; |
943 // Jan 06,2004 REF: CRR 27859 xkundadu | 943 // Jan 06,2004 REF: CRR 27859 xkundadu |
944 // Description: Clock: Alarm does not go off even if timer times out. | 944 // Description: Clock: Alarm does not go off even if timer times out. |
945 // Solution: If the mfw_td_set_alarm() function fails, display the | 945 // Solution: If the mfw_td_set_alarm() function fails, display the |
946 // 'Write Failed" message. | 946 // 'Write Failed" message. |
947 | 947 |
948 //Could not write the alarm details to FFS. | 948 //Could not write the alarm details to FFS. |
949 case TIDA_SAVEFAILED: | 949 case TIDA_SAVEFAILED: |
950 tida_show_dlg(win, TxtWrite, TxtFailed); | 950 tida_show_dlg(win, TxtWrite, TxtFailed); |
956 return; | 956 return; |
957 } | 957 } |
958 | 958 |
959 /******************************************************************************* | 959 /******************************************************************************* |
960 | 960 |
961 $Function: tida_edit_create | 961 $Function: tida_edit_create |
962 | 962 |
963 $Description: Creates an editor with the supplied properties | 963 $Description: Creates an editor with the supplied properties |
964 | 964 |
965 $Returns: The editor window. | 965 $Returns: The editor window. |
966 | 966 |
967 $Arguments: parent - The parent window | 967 $Arguments: parent - The parent window |
968 Identifier - ID used in callback to identify type of editor | 968 Identifier - ID used in callback to identify type of editor |
969 TitleId - The title of the editor | 969 TitleId - The title of the editor |
970 buffer - The text buffer | 970 buffer - The text buffer |
971 formatString - The formatting that governs the input | 971 formatString - The formatting that governs the input |
972 | 972 |
973 *******************************************************************************/ | 973 *******************************************************************************/ |
974 | 974 |
975 T_MFW_HND tida_edit_create(T_MFW_HND parent, USHORT Identifier, USHORT TitleId, char *buffer, char *formatString) | 975 T_MFW_HND tida_edit_create(T_MFW_HND parent, USHORT Identifier, USHORT TitleId, char *buffer, char *formatString) |
976 { | 976 { |
977 T_AUI_EDITOR_DATA editor_data; | 977 T_AUI_EDITOR_DATA editor_data; |
986 } | 986 } |
987 | 987 |
988 | 988 |
989 /******************************************************************************* | 989 /******************************************************************************* |
990 | 990 |
991 $Function: tida_edit_cb | 991 $Function: tida_edit_cb |
992 | 992 |
993 $Description: Callback function for editor | 993 $Description: Callback function for editor |
994 | 994 |
995 $Returns: None | 995 $Returns: None |
996 | 996 |
997 $Arguments: win - The main time/date window | 997 $Arguments: win - The main time/date window |
998 Identifier - ID used in callback to identify type of editor | 998 Identifier - ID used in callback to identify type of editor |
999 value - What prompted the callback | 999 value - What prompted the callback |
1000 | 1000 |
1001 *******************************************************************************/ | 1001 *******************************************************************************/ |
1002 | 1002 |
1003 void tida_edit_cb(T_MFW_HND win, USHORT Identifier, SHORT value) | 1003 void tida_edit_cb(T_MFW_HND win, USHORT Identifier, SHORT value) |
1004 { | 1004 { |
1005 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; | 1005 T_MFW_WIN *win_data = ((T_MFW_HDR *)win)->data; |
1008 T_MFW_TIME_FORMAT current_format; | 1008 T_MFW_TIME_FORMAT current_format; |
1009 char pmFlag = '\0'; /* x0039928 - Lint warning fix */ | 1009 char pmFlag = '\0'; /* x0039928 - Lint warning fix */ |
1010 | 1010 |
1011 T_MFW_TIME* currclock; /*SPR 2639*/ //, *tempclock; // RAVI | 1011 T_MFW_TIME* currclock; /*SPR 2639*/ //, *tempclock; // RAVI |
1012 T_MFW_DATE* currdate; | 1012 T_MFW_DATE* currdate; |
1013 | 1013 |
1014 | 1014 |
1015 | 1015 |
1016 | 1016 |
1017 switch(value) | 1017 switch(value) |
1018 { | 1018 { |
1019 /* Terminate editor */ | 1019 /* Terminate editor */ |
1020 case INFO_KCD_HUP: | 1020 case INFO_KCD_HUP: |
1021 case INFO_KCD_RIGHT: | 1021 case INFO_KCD_RIGHT: |
1075 currclock->second = 0; | 1075 currclock->second = 0; |
1076 // Issue Number : MMI-SPR-12159 on 07/04/04 by Rashmi C N and Deepa M D | 1076 // Issue Number : MMI-SPR-12159 on 07/04/04 by Rashmi C N and Deepa M D |
1077 // change by Sasken ( Rashmi C N and Deepa M D) on April 07th 2004 | 1077 // change by Sasken ( Rashmi C N and Deepa M D) on April 07th 2004 |
1078 // Bug : In 12 hour fomrat the AM and PM was not being set | 1078 // Bug : In 12 hour fomrat the AM and PM was not being set |
1079 // Solution : Setting the PM flag of the rtc. | 1079 // Solution : Setting the PM flag of the rtc. |
1080 | 1080 |
1081 if(pmFlag=='p') | 1081 if(pmFlag=='p') |
1082 { | 1082 { |
1083 currclock->PM_flag=1; | 1083 currclock->PM_flag=1; |
1084 } | 1084 } |
1085 else | 1085 else |
1086 { | 1086 { |
1087 currclock->PM_flag=0; | 1087 currclock->PM_flag=0; |
1088 } | 1088 } |
1089 | 1089 |
1090 // Issue Number : MMI-SPR-12159 on 07/04/04 by Rashmi C N and Deepa M D | 1090 // Issue Number : MMI-SPR-12159 on 07/04/04 by Rashmi C N and Deepa M D |
1091 // change by Sasken ( Rashmi C N and Deepa M D) on April 07th 2004 | 1091 // change by Sasken ( Rashmi C N and Deepa M D) on April 07th 2004 |
1092 // Bug : The AM PM for 12 hour fomrat was not being shown, Also there were some bugs with the 12 hour fomat | 1092 // Bug : The AM PM for 12 hour fomrat was not being shown, Also there were some bugs with the 12 hour fomat |
1093 // Solution : The following line was commented, to take the time format from the rtc instead of | 1093 // Solution : The following line was commented, to take the time format from the rtc instead of |
1094 //setting it to 24 hour format | 1094 //setting it to 24 hour format |
1095 | 1095 |
1096 //currclock->format = MFW_TIME_FORMAT_24HOUR; | 1096 //currclock->format = MFW_TIME_FORMAT_24HOUR; |
1097 mfw_td_set_time(currclock);/*SPR 2639*/ | 1097 mfw_td_set_time(currclock);/*SPR 2639*/ |
1098 mfw_td_set_time_format(current_format); | 1098 mfw_td_set_time_format(current_format); |
1099 SEND_EVENT(data->win, TIDA_SAVE, 0, 0); | 1099 SEND_EVENT(data->win, TIDA_SAVE, 0, 0); |
1100 } | 1100 } |
1111 alarmDate.day = (UBYTE)day; | 1111 alarmDate.day = (UBYTE)day; |
1112 alarmDate.month = (UBYTE) month; | 1112 alarmDate.month = (UBYTE) month; |
1113 alarmDate.year = (USHORT)year; | 1113 alarmDate.year = (USHORT)year; |
1114 AUI_edit_Destroy(data->edit_win); | 1114 AUI_edit_Destroy(data->edit_win); |
1115 SEND_EVENT(data->win, TIDA_ALARMTIME, 0, 0);/*SPR2639*/ | 1115 SEND_EVENT(data->win, TIDA_ALARMTIME, 0, 0);/*SPR2639*/ |
1116 | 1116 |
1117 } | 1117 } |
1118 else | 1118 else |
1119 { | 1119 { |
1120 tida_show_dlg(data->win, TxtNotAllowed, TxtNull); | 1120 tida_show_dlg(data->win, TxtNotAllowed, TxtNull); |
1121 } | 1121 } |
1122 break; | 1122 break; |
1123 | 1123 |
1124 case TIDA_ALARMTIME: | 1124 case TIDA_ALARMTIME: |
1125 if (tida_check_time(data->buffer)) | 1125 if (tida_check_time(data->buffer)) |
1126 { | 1126 { |
1127 // xnkulkar SPR-25756: Alarm setting not allowed | 1127 // xnkulkar SPR-25756: Alarm setting not allowed |
1128 // get the current time and format and set the time format flag acordingly | 1128 // get the current time and format and set the time format flag acordingly |
1129 currclock = mfw_td_get_time(); | 1129 currclock = mfw_td_get_time(); |
1130 current_format = (T_MFW_TIME_FORMAT)currclock->format; | 1130 current_format = (T_MFW_TIME_FORMAT)currclock->format; |
1131 if(current_format==MFW_TIME_FORMAT_12HOUR) | 1131 if(current_format==MFW_TIME_FORMAT_12HOUR) |
1135 | 1135 |
1136 alarmTime.hour = (UBYTE)hour; | 1136 alarmTime.hour = (UBYTE)hour; |
1137 alarmTime.minute = (UBYTE)minute; | 1137 alarmTime.minute = (UBYTE)minute; |
1138 alarmTime.second = 0; | 1138 alarmTime.second = 0; |
1139 alarmTime.format = currclock->format; | 1139 alarmTime.format = currclock->format; |
1140 | 1140 |
1141 // xnkulkar SPR-25756: Alarm setting not allowed | 1141 // xnkulkar SPR-25756: Alarm setting not allowed |
1142 // Depending on the current time format (12/24 Hour), | 1142 // Depending on the current time format (12/24 Hour), |
1143 // set the PM_flag. | 1143 // set the PM_flag. |
1144 if(pmFlag=='p') | 1144 if(pmFlag=='p') |
1145 { | 1145 { |
1146 alarmTime.PM_flag=1; | 1146 alarmTime.PM_flag=1; |
1147 } | 1147 } |
1148 else | 1148 else |
1149 { | 1149 { |
1150 alarmTime.PM_flag=0; | 1150 alarmTime.PM_flag=0; |
1151 } | 1151 } |
1152 // Now that we have the required info, set the alarm | 1152 // Now that we have the required info, set the alarm |
1153 | 1153 |
1154 // Jan 06,2004 REF: CRR 27859 xkundadu | 1154 // Jan 06,2004 REF: CRR 27859 xkundadu |
1155 // Description: Clock: Alarm does not go off even if timer times out. | 1155 // Description: Clock: Alarm does not go off even if timer times out. |
1156 // Solution: If the mfw_td_set_alarm() function fails, display the | 1156 // Solution: If the mfw_td_set_alarm() function fails, display the |
1157 // 'Write Failed" message. | 1157 // 'Write Failed" message. |
1158 | 1158 |
1159 if(mfw_td_set_alarm(&alarmTime, &alarmDate) == MfwResOk) | 1159 if(mfw_td_set_alarm(&alarmTime, &alarmDate) == MfwResOk) |
1160 { | 1160 { |
1161 | 1161 |
1162 TRACE_EVENT("Set Alarm success"); | 1162 TRACE_EVENT("Set Alarm success"); |
1163 SEND_EVENT(data->win, TIDA_SAVE, 0, 0); | 1163 SEND_EVENT(data->win, TIDA_SAVE, 0, 0); |
1218 $Description: Checks a date to see if it's valid | 1218 $Description: Checks a date to see if it's valid |
1219 | 1219 |
1220 $Returns: TRUE if it's valid, FALSE otherwise | 1220 $Returns: TRUE if it's valid, FALSE otherwise |
1221 | 1221 |
1222 $Arguments: datestring - The date string | 1222 $Arguments: datestring - The date string |
1223 | 1223 |
1224 *******************************************************************************/ | 1224 *******************************************************************************/ |
1225 | 1225 |
1226 UBYTE tida_check_date(char *datestring) | 1226 UBYTE tida_check_date(char *datestring) |
1227 { | 1227 { |
1228 int day; | 1228 int day; |
1233 | 1233 |
1234 TRACE_EVENT_P1("String: %s", datestring); | 1234 TRACE_EVENT_P1("String: %s", datestring); |
1235 TRACE_EVENT_P3("Day: %d, Month: %d, Year: %d", day, month, year); | 1235 TRACE_EVENT_P3("Day: %d, Month: %d, Year: %d", day, month, year); |
1236 | 1236 |
1237 /* Check for quick fails... */ | 1237 /* Check for quick fails... */ |
1238 | 1238 |
1239 //Apr 18, 2006 REF:OMAPS00075303 Prabakar R (a0393213) | 1239 //Apr 18, 2006 REF:OMAPS00075303 Prabakar R (a0393213) |
1240 //Description: The valid date field is 01/01/2000 to 31/12/2099, when input invalid date it will indicate "saved" but | 1240 //Description: The valid date field is 01/01/2000 to 31/12/2099, when input invalid date it will indicate "saved" but |
1241 //return to Idle screen, the date is not the input date. (for example: input the date "01/01/2110" then saved, | 1241 //return to Idle screen, the date is not the input date. (for example: input the date "01/01/2110" then saved, |
1242 //it will indicate "saved", but the date in Idle is "01/01/2010" instead.) | 1242 //it will indicate "saved", but the date in Idle is "01/01/2010" instead.) |
1243 //Solution : Validation for the date was wrong. Upperbound was not included. It is included. | 1243 //Solution : Validation for the date was wrong. Upperbound was not included. It is included. |
1244 | 1244 |
1245 if (year<2000 || year>2099 || day<1 || day>31 || month<1 || month>12) | 1245 if (year<2000 || year>2099 || day<1 || day>31 || month<1 || month>12) |
1246 return FALSE; | 1246 return FALSE; |
1247 | 1247 |
1248 /* Check 'day' */ | 1248 /* Check 'day' */ |
1249 | 1249 |
1250 switch(month) | 1250 switch(month) |
1251 { | 1251 { |
1252 case 4: /* Apr */ | 1252 case 4: /* Apr */ |
1253 case 6: /* Jun */ | 1253 case 6: /* Jun */ |
1254 case 9: /* Sep */ | 1254 case 9: /* Sep */ |
1255 case 11: /* Nov */ | 1255 case 11: /* Nov */ |
1256 if (day>30) | 1256 if (day>30) |
1257 return FALSE; | 1257 return FALSE; |
1258 break; | 1258 break; |
1259 | 1259 |
1260 case 2: /* Feb */ | 1260 case 2: /* Feb */ |
1261 /* Leap year... */ | 1261 /* Leap year... */ |
1262 if ((year%4==0) && (year%400!=0)) | 1262 if ((year%4==0) && (year%400!=0)) |
1263 { | 1263 { |
1264 if (day>29) | 1264 if (day>29) |
1269 if (day>28) | 1269 if (day>28) |
1270 return FALSE; | 1270 return FALSE; |
1271 } | 1271 } |
1272 break; | 1272 break; |
1273 } | 1273 } |
1274 | 1274 |
1275 return TRUE; | 1275 return TRUE; |
1276 } | 1276 } |
1277 | 1277 |
1278 | 1278 |
1279 /******************************************************************************* | 1279 /******************************************************************************* |
1280 | 1280 |
1281 $Function: tida_check_time | 1281 $Function: tida_check_time |
1282 | 1282 |
1283 $Description: Checks a time to see if it's valid | 1283 $Description: Checks a time to see if it's valid |
1284 | 1284 |
1285 $Returns: TRUE if it's valid, FALSE otherwise | 1285 $Returns: TRUE if it's valid, FALSE otherwise |
1286 | 1286 |
1287 $Arguments: timestring - The time string | 1287 $Arguments: timestring - The time string |
1288 | 1288 |
1289 *******************************************************************************/ | 1289 *******************************************************************************/ |
1290 | 1290 |
1291 UBYTE tida_check_time(char *timestring) | 1291 UBYTE tida_check_time(char *timestring) |
1292 { | 1292 { |
1293 int hour; | 1293 int hour; |
1306 // Bug : In 12 hour fomrat the AM and PM was not being set | 1306 // Bug : In 12 hour fomrat the AM and PM was not being set |
1307 // Solution : Validation for 12 hour format | 1307 // Solution : Validation for 12 hour format |
1308 | 1308 |
1309 // Issue Number : OMAPS00073057 on 04/04/06 by Prabakar R | 1309 // Issue Number : OMAPS00073057 on 04/04/06 by Prabakar R |
1310 // Bug : When the time format is 12hr, user can not set current time to be 12 hour. | 1310 // Bug : When the time format is 12hr, user can not set current time to be 12 hour. |
1311 // After user set the current time to be 12 hour and return the idle screen, | 1311 // After user set the current time to be 12 hour and return the idle screen, |
1312 // the current time isn't 12 hour | 1312 // the current time isn't 12 hour |
1313 // Solution : Validation for 12 hour format was wrong. Corrected. | 1313 // Solution : Validation for 12 hour format was wrong. Corrected. |
1314 if (((getClockFormat() == MFW_TIME_FORMAT_24HOUR) && (hour<0 || hour>23 || minute<0 || minute>59)) | 1314 if (((getClockFormat() == MFW_TIME_FORMAT_24HOUR) && (hour<0 || hour>23 || minute<0 || minute>59)) |
1315 ||((getClockFormat()== MFW_TIME_FORMAT_12HOUR) && (hour<1 || hour>12 || minute<0 || minute>59 || ( ampmFlag!='p' && ampmFlag!='a'))) | 1315 ||((getClockFormat()== MFW_TIME_FORMAT_12HOUR) && (hour<1 || hour>12 || minute<0 || minute>59 || ( ampmFlag!='p' && ampmFlag!='a'))) |
1316 ) | 1316 ) |
1317 return FALSE; | 1317 return FALSE; |
1318 | 1318 |
1319 return TRUE; | 1319 return TRUE; |
1320 } | 1320 } |
1321 | 1321 |
1322 #else /* NEW_EDITOR */ | 1322 #else /* NEW_EDITOR */ |
1323 | 1323 |
1324 /* OLD VERSION */ | 1324 /* OLD VERSION */ |
1325 | 1325 |
1326 /******************************************************************************* | 1326 /******************************************************************************* |
1327 | 1327 |
1328 $Function: date_time_create | 1328 $Function: date_time_create |
1329 | 1329 |
1330 $Description: create main dialog for time and date (SINGLE_DYNAMIC) | 1330 $Description: create main dialog for time and date (SINGLE_DYNAMIC) |
1331 | 1331 |
1332 $Returns: none. | 1332 $Returns: none. |
1333 | 1333 |
1334 $Arguments: | 1334 $Arguments: |
1335 | 1335 |
1336 *******************************************************************************/ | 1336 *******************************************************************************/ |
1337 T_MFW_HND date_time_create (T_MFW_HND parent_window) | 1337 T_MFW_HND date_time_create (T_MFW_HND parent_window) |
1338 { | 1338 { |
1339 T_MFW_WIN * win; | 1339 T_MFW_WIN * win; |
1340 | 1340 |
1341 T_tida * data = (T_tida *)ALLOC_MEMORY (sizeof (T_tida)); | 1341 T_tida * data = (T_tida *)ALLOC_MEMORY (sizeof (T_tida)); |
1342 data->tida_win = win_create (parent_window, 0, MfwWinVisible, (T_MFW_CB)tida_win_cb); | 1342 data->tida_win = win_create (parent_window, 0, MfwWinVisible, (T_MFW_CB)tida_win_cb); |
1343 | 1343 |
1344 TRACE_FUNCTION("MmiTimeDate:date_time_create"); | 1344 TRACE_FUNCTION("MmiTimeDate:date_time_create"); |
1345 | 1345 |
1346 if (data->tida_win EQ 0) | 1346 if (data->tida_win EQ 0) |
1347 return 0; | 1347 return 0; |
1348 | 1348 |
1352 data->mmi_control.dialog = (T_DIALOG_FUNC)tida_main;/* dialog main function */ | 1352 data->mmi_control.dialog = (T_DIALOG_FUNC)tida_main;/* dialog main function */ |
1353 data->mmi_control.data = data; | 1353 data->mmi_control.data = data; |
1354 data->parent_win = parent_window; | 1354 data->parent_win = parent_window; |
1355 win = ((T_MFW_HDR *)data->tida_win)->data; | 1355 win = ((T_MFW_HDR *)data->tida_win)->data; |
1356 win->user = (void *) data; | 1356 win->user = (void *) data; |
1357 | 1357 |
1358 | 1358 |
1359 /* | 1359 /* |
1360 * return window handle | 1360 * return window handle |
1361 */ | 1361 */ |
1362 | 1362 |
1363 mfwSetSignallingMethod(1); | 1363 mfwSetSignallingMethod(1); |
1364 winShow(data->tida_win); | 1364 winShow(data->tida_win); |
1365 | 1365 |
1366 | 1366 |
1367 return data->tida_win; | 1367 return data->tida_win; |
1368 } | 1368 } |
1369 /******************************************************************************* | 1369 /******************************************************************************* |
1370 | 1370 |
1371 $Function: date_time_destroy | 1371 $Function: date_time_destroy |
1372 | 1372 |
1373 $Description: destroy main dialog for time and date | 1373 $Description: destroy main dialog for time and date |
1374 | 1374 |
1375 $Returns: none. | 1375 $Returns: none. |
1376 | 1376 |
1377 $Arguments: | 1377 $Arguments: |
1378 | 1378 |
1379 *******************************************************************************/ | 1379 *******************************************************************************/ |
1380 void date_time_destroy (T_MFW_HND own_window) | 1380 void date_time_destroy (T_MFW_HND own_window) |
1381 { | 1381 { |
1382 T_tida * data; | 1382 T_tida * data; |
1383 T_MFW_WIN * win; | 1383 T_MFW_WIN * win; |
1395 } | 1395 } |
1396 } | 1396 } |
1397 } | 1397 } |
1398 /******************************************************************************* | 1398 /******************************************************************************* |
1399 | 1399 |
1400 $Function: date_time_edt_create | 1400 $Function: date_time_edt_create |
1401 | 1401 |
1402 $Description: create editor dialog for time and date(SINGLE_DYNAMIC) | 1402 $Description: create editor dialog for time and date(SINGLE_DYNAMIC) |
1403 | 1403 |
1404 $Returns: none. | 1404 $Returns: none. |
1405 | 1405 |
1406 $Arguments: | 1406 $Arguments: |
1407 | 1407 |
1408 *******************************************************************************/ | 1408 *******************************************************************************/ |
1409 T_MFW_HND date_time_edt_create(T_MFW_HND parent_window) | 1409 T_MFW_HND date_time_edt_create(T_MFW_HND parent_window) |
1410 { | 1410 { |
1411 T_tida_edt * data = (T_tida_edt *)ALLOC_MEMORY (sizeof (T_tida_edt)); | 1411 T_tida_edt * data = (T_tida_edt *)ALLOC_MEMORY (sizeof (T_tida_edt)); |
1412 | 1412 |
1441 */ | 1441 */ |
1442 return data->tida_edt_win; | 1442 return data->tida_edt_win; |
1443 } | 1443 } |
1444 /******************************************************************************* | 1444 /******************************************************************************* |
1445 | 1445 |
1446 $Function: date_time_edt_destroy | 1446 $Function: date_time_edt_destroy |
1447 | 1447 |
1448 $Description: destroy editor dialog for time and date | 1448 $Description: destroy editor dialog for time and date |
1449 | 1449 |
1450 $Returns: none. | 1450 $Returns: none. |
1451 | 1451 |
1452 $Arguments: | 1452 $Arguments: |
1453 | 1453 |
1454 *******************************************************************************/ | 1454 *******************************************************************************/ |
1455 void date_time_edt_destroy (T_MFW_HND own_window) | 1455 void date_time_edt_destroy (T_MFW_HND own_window) |
1456 { | 1456 { |
1457 T_tida_edt * data ; | 1457 T_tida_edt * data ; |
1458 T_MFW_WIN * win; | 1458 T_MFW_WIN * win; |
1472 } | 1472 } |
1473 } | 1473 } |
1474 } | 1474 } |
1475 /******************************************************************************* | 1475 /******************************************************************************* |
1476 | 1476 |
1477 $Function: tida_main | 1477 $Function: tida_main |
1478 | 1478 |
1479 $Description: main dialog function for time and date | 1479 $Description: main dialog function for time and date |
1480 | 1480 |
1481 $Returns: none. | 1481 $Returns: none. |
1482 | 1482 |
1483 $Arguments: | 1483 $Arguments: |
1484 | 1484 |
1485 *******************************************************************************/ | 1485 *******************************************************************************/ |
1486 static void tida_main(T_MFW_HND win, USHORT event, SHORT value, void * parameter) | 1486 static void tida_main(T_MFW_HND win, USHORT event, SHORT value, void * parameter) |
1487 { | 1487 { |
1488 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | 1488 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; |
1489 T_tida * tida_data = (T_tida *)win_data->user;//tida main data | 1489 T_tida * tida_data = (T_tida *)win_data->user;//tida main data |
1545 break; | 1545 break; |
1546 } | 1546 } |
1547 } | 1547 } |
1548 /******************************************************************************* | 1548 /******************************************************************************* |
1549 | 1549 |
1550 $Function: tida_info_cb | 1550 $Function: tida_info_cb |
1551 | 1551 |
1552 $Description: callback function from info dialog for time and date | 1552 $Description: callback function from info dialog for time and date |
1553 | 1553 |
1554 $Returns: none. | 1554 $Returns: none. |
1555 | 1555 |
1556 $Arguments: | 1556 $Arguments: |
1557 | 1557 |
1558 *******************************************************************************/ | 1558 *******************************************************************************/ |
1559 void tida_info_cb(T_MFW_HND win, USHORT identifier, UBYTE reasons) | 1559 void tida_info_cb(T_MFW_HND win, USHORT identifier, UBYTE reasons) |
1560 { | 1560 { |
1561 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | 1561 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; |
1562 T_tida * tida_data = (T_tida *)win_data->user; | 1562 T_tida * tida_data = (T_tida *)win_data->user; |
1573 } | 1573 } |
1574 } | 1574 } |
1575 | 1575 |
1576 /******************************************************************************* | 1576 /******************************************************************************* |
1577 | 1577 |
1578 $Function: tida_win_cb | 1578 $Function: tida_win_cb |
1579 | 1579 |
1580 $Description: windows main callback function for time and date | 1580 $Description: windows main callback function for time and date |
1581 | 1581 |
1582 $Returns: none. | 1582 $Returns: none. |
1583 | 1583 |
1584 $Arguments: | 1584 $Arguments: |
1585 | 1585 |
1586 *******************************************************************************/ | 1586 *******************************************************************************/ |
1587 static int tida_win_cb (T_MFW_EVENT event, T_MFW_WIN * win) | 1587 static int tida_win_cb (T_MFW_EVENT event, T_MFW_WIN * win) |
1588 { | 1588 { |
1589 TRACE_FUNCTION ("MmiTimeDate: tida_win_cb"); | 1589 TRACE_FUNCTION ("MmiTimeDate: tida_win_cb"); |
1590 if (event EQ MfwWinVisible) | 1590 if (event EQ MfwWinVisible) |
1597 } | 1597 } |
1598 return 0; | 1598 return 0; |
1599 } | 1599 } |
1600 /******************************************************************************* | 1600 /******************************************************************************* |
1601 | 1601 |
1602 $Function: tida_edt_win_cb | 1602 $Function: tida_edt_win_cb |
1603 | 1603 |
1604 $Description: windows callback function for editor for time and date | 1604 $Description: windows callback function for editor for time and date |
1605 | 1605 |
1606 $Returns: none. | 1606 $Returns: none. |
1607 | 1607 |
1608 $Arguments: | 1608 $Arguments: |
1609 | 1609 |
1610 *******************************************************************************/ | 1610 *******************************************************************************/ |
1611 static int tida_edt_win_cb (T_MFW_EVENT event,T_MFW_WIN * win) | 1611 static int tida_edt_win_cb (T_MFW_EVENT event,T_MFW_WIN * win) |
1612 { | 1612 { |
1613 | 1613 |
1614 | 1614 |
1618 char lin1[MAX_LEN_DATE]; | 1618 char lin1[MAX_LEN_DATE]; |
1619 char lin2[MAX_LEN_TIME]; | 1619 char lin2[MAX_LEN_TIME]; |
1620 T_MFW_TIME* currclock; /*SPR 2639*/ | 1620 T_MFW_TIME* currclock; /*SPR 2639*/ |
1621 T_MFW_DATE* currdate; | 1621 T_MFW_DATE* currdate; |
1622 //T_MFW_TIME alarmTime; /*SPR 2639*/ | 1622 //T_MFW_TIME alarmTime; /*SPR 2639*/ |
1623 | 1623 |
1624 | 1624 |
1625 currclock = mfw_td_get_time(&currclock);/*SPR 2639*/ | 1625 currclock = mfw_td_get_time(&currclock);/*SPR 2639*/ |
1626 currdate = mfw_td_get_date(&currdate); | 1626 currdate = mfw_td_get_date(&currdate); |
1627 | 1627 |
1628 | 1628 |
1629 TRACE_FUNCTION ("MmiTimeDate:tida_edt_win_cb"); | 1629 TRACE_FUNCTION ("MmiTimeDate:tida_edt_win_cb"); |
1630 | 1630 |
1631 if (event EQ MfwWinVisible) | 1631 if (event EQ MfwWinVisible) |
1632 { | 1632 { |
1643 else | 1643 else |
1644 sprintf(lin1,"%02d/%02d/%04d",currdate->day,currdate->month,currdate->year); | 1644 sprintf(lin1,"%02d/%02d/%04d",currdate->day,currdate->month,currdate->year); |
1645 } | 1645 } |
1646 else | 1646 else |
1647 sprintf(lin1,"%02d/%02d/%04d",alarmDate.day,alarmDate.month,alarmDate.year); | 1647 sprintf(lin1,"%02d/%02d/%04d",alarmDate.day,alarmDate.month,alarmDate.year); |
1648 | 1648 |
1649 strncpy(edt_data->edtbuf1,lin1,MAX_LEN_DATE); | 1649 strncpy(edt_data->edtbuf1,lin1,MAX_LEN_DATE); |
1650 edtShow(edt_data->editor_handle); | 1650 edtShow(edt_data->editor_handle); |
1651 } | 1651 } |
1652 else if(tida_data->state EQ DATE_ENTRY) | 1652 else if(tida_data->state EQ DATE_ENTRY) |
1653 { | 1653 { |
1656 sprintf(lin1,"dd/mm/yyyy");//if no date set | 1656 sprintf(lin1,"dd/mm/yyyy");//if no date set |
1657 else | 1657 else |
1658 sprintf(lin1,"%02d/%02d/%04d",currdate->day,currdate->month,currdate->year); | 1658 sprintf(lin1,"%02d/%02d/%04d",currdate->day,currdate->month,currdate->year); |
1659 } | 1659 } |
1660 else | 1660 else |
1661 { | 1661 { |
1662 sprintf(lin1,"%02d/%02d/%04d",alarmDate.day,alarmDate.month,alarmDate.year); | 1662 sprintf(lin1,"%02d/%02d/%04d",alarmDate.day,alarmDate.month,alarmDate.year); |
1663 } | 1663 } |
1664 strncpy(edt_data->edtbuf1,lin1,MAX_LEN_DATE); | 1664 strncpy(edt_data->edtbuf1,lin1,MAX_LEN_DATE); |
1665 edt_data->index = 0; | 1665 edt_data->index = 0; |
1666 edtShow(edt_data->editor_handle); | 1666 edtShow(edt_data->editor_handle); |
1686 edtShow(edt_data->editor_handle); | 1686 edtShow(edt_data->editor_handle); |
1687 } | 1687 } |
1688 return 1; | 1688 return 1; |
1689 } | 1689 } |
1690 return 0; | 1690 return 0; |
1691 | 1691 |
1692 } | 1692 } |
1693 /******************************************************************************* | 1693 /******************************************************************************* |
1694 | 1694 |
1695 $Function: tida_editor | 1695 $Function: tida_editor |
1696 | 1696 |
1697 $Description: dialog function for editor for time and date | 1697 $Description: dialog function for editor for time and date |
1698 | 1698 |
1699 $Returns: none. | 1699 $Returns: none. |
1700 | 1700 |
1701 $Arguments: | 1701 $Arguments: |
1702 | 1702 |
1703 *******************************************************************************/ | 1703 *******************************************************************************/ |
1704 static void tida_editor(T_MFW_HND win, USHORT event, SHORT value, void * parameter) | 1704 static void tida_editor(T_MFW_HND win, USHORT event, SHORT value, void * parameter) |
1705 { | 1705 { |
1706 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | 1706 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; |
1707 T_tida_edt * edt_data = (T_tida_edt *)win_data->user; | 1707 T_tida_edt * edt_data = (T_tida_edt *)win_data->user; |
1732 break; | 1732 break; |
1733 } | 1733 } |
1734 } | 1734 } |
1735 /******************************************************************************* | 1735 /******************************************************************************* |
1736 | 1736 |
1737 $Function: tida_edt_kbd_cb | 1737 $Function: tida_edt_kbd_cb |
1738 | 1738 |
1739 $Description: keyboard event handler for time and date | 1739 $Description: keyboard event handler for time and date |
1740 | 1740 |
1741 $Returns: none. | 1741 $Returns: none. |
1742 | 1742 |
1743 $Arguments: | 1743 $Arguments: |
1744 | 1744 |
1745 *******************************************************************************/ | 1745 *******************************************************************************/ |
1746 static int tida_edt_kbd_cb (MfwEvt e, MfwKbd *kc) | 1746 static int tida_edt_kbd_cb (MfwEvt e, MfwKbd *kc) |
1747 { | 1747 { |
1748 | 1748 |
1749 T_MFW_HND win = mfw_parent(mfw_header()); | 1749 T_MFW_HND win = mfw_parent(mfw_header()); |
1756 | 1756 |
1757 char lin1[MAX_LEN_DATE]; | 1757 char lin1[MAX_LEN_DATE]; |
1758 char lin2[MAX_LEN_TIME]; | 1758 char lin2[MAX_LEN_TIME]; |
1759 T_MFW_TIME* currclock; /*SPR 2639*/ | 1759 T_MFW_TIME* currclock; /*SPR 2639*/ |
1760 currclock = mfw_td_get_time();/*SPR 2639*/ | 1760 currclock = mfw_td_get_time();/*SPR 2639*/ |
1761 | 1761 |
1762 TRACE_FUNCTION ("MmiTimeDate: tida_edt_kbd_cb"); | 1762 TRACE_FUNCTION ("MmiTimeDate: tida_edt_kbd_cb"); |
1763 | 1763 |
1764 switch(kc->code) | 1764 switch(kc->code) |
1765 { | 1765 { |
1766 case KCD_0: | 1766 case KCD_0: |
1941 return MFW_EVENT_CONSUMED; | 1941 return MFW_EVENT_CONSUMED; |
1942 } | 1942 } |
1943 | 1943 |
1944 /******************************************************************************* | 1944 /******************************************************************************* |
1945 | 1945 |
1946 $Function: check_date | 1946 $Function: check_date |
1947 | 1947 |
1948 $Description: check date after date entering | 1948 $Description: check date after date entering |
1949 | 1949 |
1950 $Returns: none. | 1950 $Returns: none. |
1951 | 1951 |
1952 $Arguments: | 1952 $Arguments: |
1953 | 1953 |
1954 *******************************************************************************/ | 1954 *******************************************************************************/ |
1955 static int check_date (T_MFW_HND win, void * edt_dat) | 1955 static int check_date (T_MFW_HND win, void * edt_dat) |
1956 { | 1956 { |
1957 U8 i; | 1957 U8 i; |
1958 T_tida_edt * edt_data = (T_tida_edt *)edt_dat; | 1958 T_tida_edt * edt_data = (T_tida_edt *)edt_dat; |
1966 | 1966 |
1967 char debug[20]; | 1967 char debug[20]; |
1968 T_MFW_TIME* currclock; /*SPR 2639*/ | 1968 T_MFW_TIME* currclock; /*SPR 2639*/ |
1969 T_MFW_DATE* currdate; | 1969 T_MFW_DATE* currdate; |
1970 //T_MFW_TIME alarmTime; /*SPR 2639*/ | 1970 //T_MFW_TIME alarmTime; /*SPR 2639*/ |
1971 | 1971 |
1972 | 1972 |
1973 currclock= mfw_td_get_time();/*SPR 2639*/ | 1973 currclock= mfw_td_get_time();/*SPR 2639*/ |
1974 currdate =mfw_td_get_date(); | 1974 currdate =mfw_td_get_date(); |
1975 | 1975 |
1976 TRACE_FUNCTION ("MmiTimeDate:check_date"); | 1976 TRACE_FUNCTION ("MmiTimeDate:check_date"); |
1977 | 1977 |
1978 memset(internday, '\0', sizeof(internday));/* initial string */ | 1978 memset(internday, '\0', sizeof(internday));/* initial string */ |
1979 memset(internmonth, '\0', sizeof(internmonth)); | 1979 memset(internmonth, '\0', sizeof(internmonth)); |
1980 memset(internyear, '\0', sizeof(internyear)); | 1980 memset(internyear, '\0', sizeof(internyear)); |
2024 if((tempdate.month EQ 2) && (tempdate.day EQ 29)) | 2024 if((tempdate.month EQ 2) && (tempdate.day EQ 29)) |
2025 { | 2025 { |
2026 if(!(tempdate.year%4) || (tempdate.year EQ 2000)) | 2026 if(!(tempdate.year%4) || (tempdate.year EQ 2000)) |
2027 { | 2027 { |
2028 if(DateTimeEntryMode == ALARM) | 2028 if(DateTimeEntryMode == ALARM) |
2029 { | 2029 { |
2030 alarmDate.day = tempdate.day; | 2030 alarmDate.day = tempdate.day; |
2031 alarmDate.month = tempdate.month; | 2031 alarmDate.month = tempdate.month; |
2032 alarmDate.year = tempdate.year; | 2032 alarmDate.year = tempdate.year; |
2033 } | 2033 } |
2034 else | 2034 else |
2035 { | 2035 { |
2036 | 2036 |
2037 currdate->day = tempdate.day; | 2037 currdate->day = tempdate.day; |
2038 currdate->month = tempdate.month; | 2038 currdate->month = tempdate.month; |
2039 currdate->year = tempdate.year; | 2039 currdate->year = tempdate.year; |
2040 mfw_td_set_date(currdate);/*SPR 2639*/ | 2040 mfw_td_set_date(currdate);/*SPR 2639*/ |
2041 } | 2041 } |
2046 } | 2046 } |
2047 else | 2047 else |
2048 { | 2048 { |
2049 if(DateTimeEntryMode == ALARM) | 2049 if(DateTimeEntryMode == ALARM) |
2050 { | 2050 { |
2051 | 2051 |
2052 | 2052 |
2053 alarmDate.day = tempdate.day; | 2053 alarmDate.day = tempdate.day; |
2054 alarmDate.month = tempdate.month; | 2054 alarmDate.month = tempdate.month; |
2055 alarmDate.year = tempdate.year; | 2055 alarmDate.year = tempdate.year; |
2056 | 2056 |
2057 } | 2057 } |
2058 else | 2058 else |
2059 { | 2059 { |
2060 currdate->day = tempdate.day; | 2060 currdate->day = tempdate.day; |
2061 currdate->month = tempdate.month; | 2061 currdate->month = tempdate.month; |
2062 currdate->year = tempdate.year; | 2062 currdate->year = tempdate.year; |
2063 } | 2063 } |
2064 mfw_td_set_date(currdate);/*SPR 2639*/ | 2064 mfw_td_set_date(currdate);/*SPR 2639*/ |
2065 return TRUE; | 2065 return TRUE; |
2066 } | 2066 } |
2067 } | 2067 } |
2068 /******************************************************************************* | 2068 /******************************************************************************* |
2069 | 2069 |
2070 $Function: check_time | 2070 $Function: check_time |
2071 | 2071 |
2072 $Description: check time after time entering | 2072 $Description: check time after time entering |
2073 | 2073 |
2074 $Returns: none. | 2074 $Returns: none. |
2075 | 2075 |
2076 $Arguments: | 2076 $Arguments: |
2077 | 2077 |
2078 *******************************************************************************/ | 2078 *******************************************************************************/ |
2079 static int check_time (T_MFW_HND win, void * edt_dat) | 2079 static int check_time (T_MFW_HND win, void * edt_dat) |
2080 { | 2080 { |
2081 T_tida_edt * edt_data = (T_tida_edt *)edt_dat; | 2081 T_tida_edt * edt_data = (T_tida_edt *)edt_dat; |
2082 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | 2082 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; |
2087 char internhour[3]; | 2087 char internhour[3]; |
2088 T_MFW_TIME* currclock; /*SPR 2639*/ | 2088 T_MFW_TIME* currclock; /*SPR 2639*/ |
2089 T_MFW_DATE* currdate; | 2089 T_MFW_DATE* currdate; |
2090 T_MFW_TIME_FORMAT current_format; | 2090 T_MFW_TIME_FORMAT current_format; |
2091 //T_MFW_TIME alarmTime; /*SPR 2639*/ | 2091 //T_MFW_TIME alarmTime; /*SPR 2639*/ |
2092 | 2092 |
2093 currclock = mfw_td_get_time();/*SPR 2639*/ | 2093 currclock = mfw_td_get_time();/*SPR 2639*/ |
2094 currdate = mfw_td_get_date(); | 2094 currdate = mfw_td_get_date(); |
2095 | 2095 |
2096 current_format = currclock->format; | 2096 current_format = currclock->format; |
2097 memset(internmin, '\0', sizeof(internmin));/* initial string */ | 2097 memset(internmin, '\0', sizeof(internmin));/* initial string */ |
2098 memset(internhour, '\0', sizeof(internhour)); | 2098 memset(internhour, '\0', sizeof(internhour)); |
2099 | 2099 |
2100 internhour[0] = edt_data->edtbuf1[0]; | 2100 internhour[0] = edt_data->edtbuf1[0]; |
2108 | 2108 |
2109 tempclock.minute = atoi(internmin); | 2109 tempclock.minute = atoi(internmin); |
2110 if(tempclock.minute >59) | 2110 if(tempclock.minute >59) |
2111 return FALSE; | 2111 return FALSE; |
2112 if (DateTimeEntryMode == ALARM) | 2112 if (DateTimeEntryMode == ALARM) |
2113 { | 2113 { |
2114 alarmTime.hour = tempclock.hour; /*SPR 2639*/ | 2114 alarmTime.hour = tempclock.hour; /*SPR 2639*/ |
2115 alarmTime.minute = tempclock.minute; | 2115 alarmTime.minute = tempclock.minute; |
2116 alarmTime.format = MFW_TIME_FORMAT_24HOUR; | 2116 alarmTime.format = MFW_TIME_FORMAT_24HOUR; |
2117 mfw_td_set_alarm(&alarmTime, &alarmDate); | 2117 mfw_td_set_alarm(&alarmTime, &alarmDate); |
2118 } | 2118 } |
2119 else | 2119 else |
2120 { | 2120 { |
2121 | 2121 |
2122 | 2122 |
2123 currclock->hour = tempclock.hour; | 2123 currclock->hour = tempclock.hour; |
2124 currclock->minute = tempclock.minute; | 2124 currclock->minute = tempclock.minute; |
2125 currclock->format = MFW_TIME_FORMAT_24HOUR; | 2125 currclock->format = MFW_TIME_FORMAT_24HOUR; |
2126 mfw_td_set_time(currclock);/*SPR 2639*/ | 2126 mfw_td_set_time(currclock);/*SPR 2639*/ |
2127 mfw_td_set_time_format(current_format); | 2127 mfw_td_set_time_format(current_format); |
2128 } | 2128 } |
2129 | 2129 |
2130 return TRUE; | 2130 return TRUE; |
2131 } | 2131 } |
2132 /******************************************************************************* | 2132 /******************************************************************************* |
2133 | 2133 |
2134 $Function: tida_edt_tim_out_cb | 2134 $Function: tida_edt_tim_out_cb |
2135 | 2135 |
2136 $Description: Callback function for timer for time and date | 2136 $Description: Callback function for timer for time and date |
2137 | 2137 |
2138 $Returns: none. | 2138 $Returns: none. |
2139 | 2139 |
2140 $Arguments: | 2140 $Arguments: |
2141 | 2141 |
2142 *******************************************************************************/ | 2142 *******************************************************************************/ |
2143 static void tida_edt_tim_out_cb(T_MFW_EVENT event,T_MFW_TIM * t) | 2143 static void tida_edt_tim_out_cb(T_MFW_EVENT event,T_MFW_TIM * t) |
2144 { | 2144 { |
2145 T_MFW_HND win = mfw_parent(mfw_header()); | 2145 T_MFW_HND win = mfw_parent(mfw_header()); |
2146 | 2146 |
2154 SEND_EVENT(tida_data->tida_win,TIDA_CLEAR,0,tida_data); | 2154 SEND_EVENT(tida_data->tida_win,TIDA_CLEAR,0,tida_data); |
2155 | 2155 |
2156 } | 2156 } |
2157 /******************************************************************************* | 2157 /******************************************************************************* |
2158 | 2158 |
2159 $Function: tida_edt_kbd_long_cb | 2159 $Function: tida_edt_kbd_long_cb |
2160 | 2160 |
2161 $Description: keyboard long event handler for time and date | 2161 $Description: keyboard long event handler for time and date |
2162 | 2162 |
2163 $Returns: none. | 2163 $Returns: none. |
2164 | 2164 |
2165 $Arguments: | 2165 $Arguments: |
2166 | 2166 |
2167 *******************************************************************************/ | 2167 *******************************************************************************/ |
2168 static int tida_edt_kbd_long_cb (MfwEvt e, MfwKbd *kc) | 2168 static int tida_edt_kbd_long_cb (MfwEvt e, MfwKbd *kc) |
2169 { | 2169 { |
2170 T_MFW_HND win = mfw_parent(mfw_header()); | 2170 T_MFW_HND win = mfw_parent(mfw_header()); |
2171 | 2171 |