From 071b23efff9e3634060cbc555a364593ec786767 Mon Sep 17 00:00:00 2001 From: Rajeev Ranjan Date: Mon, 3 Sep 2012 07:24:20 +0000 Subject: [PATCH] From: Rajeev Ranjan Subject: [E-devel] [Patch] [Elementary] elm_datetime widget bug fix: elm_datetime_field_limit_set() API is not working for min/max boundary conditions Hi, Please review the attached patch for fixing issue in API elm_datetime_field_limit_set() for boundary values. It has been created by Sumanth for datetime widget. [Issue Details]: elm_datetime_field_limit_set() API is not working well for boundary values. [ex: for date, we can't set max limit as 31 and for minute, we can't set 60 etc.. - it fails at boundary conditions of Min/Max limit for all datetime fields.] [Root cause]: Boundary condition checking has not been done in a proper way. [Change Description]: Boundary checking condition is corrected and the min/max limit boundary values are included as API input. Signed-Off-By: Sumanth Krishna (sumanth.m@samsung.com) Signed-Off-By: Rajeev Ranjan (rajeev.r@samsung.com) SVN revision: 75958 --- ChangeLog | 5 +++++ src/lib/elm_datetime.c | 10 ++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 35694e4..9c2da2b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -431,3 +431,8 @@ * The state of elm_check is now changed by mouse click event. +2012-09-03 Rajeev Ranjan + + * Fix min/max limit setting to respect field boundaires EXCEPT + for years which have no boundaries with + elm_datetime_field_limit_set() diff --git a/src/lib/elm_datetime.c b/src/lib/elm_datetime.c index ee3f252..edfd99d 100644 --- a/src/lib/elm_datetime.c +++ b/src/lib/elm_datetime.c @@ -934,11 +934,13 @@ elm_datetime_field_limit_set(Evas_Object *obj, if (min > max) return; field = sd->field_list + fieldtype; - if ((min > mapping[fieldtype].def_min && min < mapping[fieldtype].def_max) - || (field->type == ELM_DATETIME_YEAR)) + if (((min >= mapping[fieldtype].def_min) && + (min <= mapping[fieldtype].def_max)) || + (field->type == ELM_DATETIME_YEAR)) field->min = min; - if ((max > mapping[fieldtype].def_min && max < mapping[fieldtype].def_max) - || (field->type == ELM_DATETIME_YEAR)) + if (((max >= mapping[fieldtype].def_min) && + (max <= mapping[fieldtype].def_max)) || + (field->type == ELM_DATETIME_YEAR)) field->max = max; _apply_field_limits(obj); -- 2.7.4