diff options
author | Iván Frade <frade@asturlinux.org> | 2004-10-07 00:33:28 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2004-10-07 00:33:28 +0800 |
commit | 1f2031899cdb9754574dbf3005e17587fa77993c (patch) | |
tree | 6d1607e7638914c51c123f91d50d8fb92f0ba664 /calendar | |
parent | 1180b398cfabf939fc833000be7c82cca725ad42 (diff) | |
download | gsoc2013-evolution-1f2031899cdb9754574dbf3005e17587fa77993c.tar gsoc2013-evolution-1f2031899cdb9754574dbf3005e17587fa77993c.tar.gz gsoc2013-evolution-1f2031899cdb9754574dbf3005e17587fa77993c.tar.bz2 gsoc2013-evolution-1f2031899cdb9754574dbf3005e17587fa77993c.tar.lz gsoc2013-evolution-1f2031899cdb9754574dbf3005e17587fa77993c.tar.xz gsoc2013-evolution-1f2031899cdb9754574dbf3005e17587fa77993c.tar.zst gsoc2013-evolution-1f2031899cdb9754574dbf3005e17587fa77993c.zip |
Fixes #48116
2004-10-02 Iván Frade <frade@asturlinux.org>
Fixes #48116
* gui/dialogs/task-details.page.c (task_details_page_fill_component):
Validation: completed date is not a future date.
svn path=/trunk/; revision=27480
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 7 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-details-page.c | 34 |
2 files changed, 30 insertions, 11 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 59b2b204dd..9086c60b66 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,10 @@ +2004-10-02 Iván Frade <frade@asturlinux.org> + + Fixes #48116 + + * gui/dialogs/task-details.page.c (task_details_page_fill_component): + Validation: completed date is not a future date. + 2004-10-01 Not Zed <NotZed@Ximian.com> * gui/tasks-component.c (create_component_view): cast warning diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c index d5fa0465cf..9e88e915b8 100644 --- a/calendar/gui/dialogs/task-details-page.c +++ b/calendar/gui/dialogs/task-details-page.c @@ -393,12 +393,13 @@ task_details_page_fill_component (CompEditorPage *page, ECalComponent *comp) { TaskDetailsPage *tdpage; TaskDetailsPagePrivate *priv; - struct icaltimetype icaltime; + struct icaltimetype icalcomplete, icaltoday; icalproperty_status status; TaskEditorPriority priority; int priority_value, percent; char *url; gboolean date_set; + icaltimezone *zone = calendar_config_get_icaltimezone (); tdpage = TASK_DETAILS_PAGE (page); priv = tdpage->priv; @@ -416,10 +417,10 @@ task_details_page_fill_component (CompEditorPage *page, ECalComponent *comp) priority_value = priority_index_to_value (priority); e_cal_component_set_priority (comp, &priority_value); - icaltime = icaltime_null_time (); + icalcomplete = icaltime_null_time (); /* COMPLETED must be in UTC. */ - icaltime.is_utc = 1; + icalcomplete.is_utc = 1; /* Completed Date. */ if (!e_date_edit_date_is_valid (E_DATE_EDIT (priv->completed_date)) || @@ -429,12 +430,24 @@ task_details_page_fill_component (CompEditorPage *page, ECalComponent *comp) } date_set = e_date_edit_get_date (E_DATE_EDIT (priv->completed_date), - &icaltime.year, - &icaltime.month, - &icaltime.day); + &icalcomplete.year, + &icalcomplete.month, + &icalcomplete.day); + e_date_edit_get_time_of_day (E_DATE_EDIT (priv->completed_date), - &icaltime.hour, - &icaltime.minute); + &icalcomplete.hour, + &icalcomplete.minute); + + /* COMPLETED today or before */ + icaltoday = icaltime_current_time_with_zone (zone); + icaltimezone_convert_time (&icaltoday, zone, + icaltimezone_get_utc_timezone()); + + if (icaltime_compare_date_only (icalcomplete, icaltoday) > 0) { + comp_editor_page_display_validation_error (page, _("Completed date is wrong"), priv->completed_date); + return FALSE; + } + if (date_set) { /* COMPLETED must be in UTC, so we assume that the date in the dialog is in the current timezone, and we now convert it @@ -442,10 +455,9 @@ task_details_page_fill_component (CompEditorPage *page, ECalComponent *comp) entire time the dialog is shown. Otherwise if the user changes the timezone, the COMPLETED date may get changed as well. */ - icaltimezone *zone = calendar_config_get_icaltimezone (); - icaltimezone_convert_time (&icaltime, zone, + icaltimezone_convert_time (&icalcomplete, zone, icaltimezone_get_utc_timezone ()); - e_cal_component_set_completed (comp, &icaltime); + e_cal_component_set_completed (comp, &icalcomplete); } else { e_cal_component_set_completed (comp, NULL); } |