summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorChunEon Park <hermet@hermet.pe.kr>2012-04-16 06:55:58 +0000
committerChunEon Park <hermet@hermet.pe.kr>2012-04-16 06:55:58 +0000
commit98156dccb163fb1716cd507d865e8a16be51bff2 (patch)
tree4e3be9f041b0b6a9ad7cda370572152a1e0ca6a1 /src/lib
parent582611514e750513b9451c2efa9b199ef695edc6 (diff)
elementary/datetime - elm_datetime - Open source patch : Separator parsing logic in Datetime is corrected
Change Description: [elm_datetime.c] Separator parsing logic is changed in Datetime widget. Predefined set of characters (both global and field specific) are ignored as field separators. Can some one, please review and check-in the code in SVN Elementary. Thanks, Sumanth Singed-Off-By: Sumanth Krishna Mannam<sumanth.m@samsung.com> SVN revision: 70220
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/elm_datetime.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/lib/elm_datetime.c b/src/lib/elm_datetime.c
index caecb9a78..1873f3745 100644
--- a/src/lib/elm_datetime.c
+++ b/src/lib/elm_datetime.c
@@ -74,19 +74,21 @@ struct _Format_Map
74 char *fmt_char; 74 char *fmt_char;
75 int def_min; 75 int def_min;
76 int def_max; 76 int def_max;
77 char *ignore_sep;
77}; 78};
78 79
79// default limits for individual fields 80// default limits for individual fields
80static Format_Map mapping[DATETIME_TYPE_COUNT] = { 81static Format_Map mapping[DATETIME_TYPE_COUNT] = {
81 [ELM_DATETIME_YEAR] = { "Yy", -1, -1 }, 82 [ELM_DATETIME_YEAR] = { "Yy", -1, -1, "" },
82 [ELM_DATETIME_MONTH] = { "mbBh", 0, 11 }, 83 [ELM_DATETIME_MONTH] = { "mbBh", 0, 11, "" },
83 [ELM_DATETIME_DATE] = { "de", 1, 31 }, 84 [ELM_DATETIME_DATE] = { "de", 1, 31, "" },
84 [ELM_DATETIME_HOUR] = { "IHkl", 0, 23 }, 85 [ELM_DATETIME_HOUR] = { "IHkl", 0, 23, "" },
85 [ELM_DATETIME_MINUTE] = { "M", 0, 59 }, 86 [ELM_DATETIME_MINUTE] = { "M", 0, 59, ":" },
86 [ELM_DATETIME_AMPM] = { "pP", 0, 1 } 87 [ELM_DATETIME_AMPM] = { "pP", 0, 1, "" }
87}; 88};
88 89
89static const char *multifield_formats = "cxXrRTDF"; 90static const char *multifield_formats = "cxXrRTDF";
91static const char *ignore_separators = "()";
90 92
91static Datetime_Mod_Api *dt_mod = NULL; 93static Datetime_Mod_Api *dt_mod = NULL;
92static const char *widtype = NULL; 94static const char *widtype = NULL;
@@ -640,7 +642,7 @@ _parse_format(Evas_Object *obj, char *fmt_ptr)
640{ 642{
641 Widget_Data *wd; 643 Widget_Data *wd;
642 Datetime_Field *field = NULL; 644 Datetime_Field *field = NULL;
643 unsigned int len = 0, idx, location = 0; 645 unsigned int len = 0, idx = 0, location = 0;
644 char separator[MAX_SEPARATOR_LEN]; 646 char separator[MAX_SEPARATOR_LEN];
645 char cur; 647 char cur;
646 Eina_Bool fmt_parsing = EINA_FALSE, sep_parsing = EINA_FALSE, 648 Eina_Bool fmt_parsing = EINA_FALSE, sep_parsing = EINA_FALSE,
@@ -678,9 +680,11 @@ _parse_format(Evas_Object *obj, char *fmt_ptr)
678 separator[len] = 0; 680 separator[len] = 0;
679 if (field) eina_stringshare_replace(&field->separator, separator); 681 if (field) eina_stringshare_replace(&field->separator, separator);
680 } 682 }
683
684 // ignore the set of chars (global, field specific) as field separators.
681 if (sep_parsing && (len < MAX_SEPARATOR_LEN - 1) && 685 if (sep_parsing && (len < MAX_SEPARATOR_LEN - 1) &&
682 (field->type != ELM_DATETIME_AMPM) && 686 (field->type != ELM_DATETIME_AMPM) && (!strchr(ignore_separators, cur)) &&
683 (!((field->type == ELM_DATETIME_MINUTE) && (cur ==':')))) 687 (!strchr(mapping[idx].ignore_sep, cur)))
684 separator[len++] = cur; 688 separator[len++] = cur;
685 if (sep_lookup) sep_parsing = EINA_TRUE; 689 if (sep_lookup) sep_parsing = EINA_TRUE;
686 sep_lookup = EINA_FALSE; 690 sep_lookup = EINA_FALSE;