[evolution/wip/webkit2] Bug 329869 - All-day event in list view ends on following day



commit cbd640b57eae4b11a30a0e7ce0ed085f2a5e0583
Author: Milan Crha <mcrha redhat com>
Date:   Mon Jun 15 15:33:44 2015 +0200

    Bug 329869 - All-day event in list view ends on following day

 calendar/gui/e-cal-model-calendar.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/calendar/gui/e-cal-model-calendar.c b/calendar/gui/e-cal-model-calendar.c
index 47a25c7..f5b7021 100644
--- a/calendar/gui/e-cal-model-calendar.c
+++ b/calendar/gui/e-cal-model-calendar.c
@@ -84,6 +84,34 @@ get_dtend (ECalModelCalendar *model,
                if (!icaltime_is_valid_time (tt_end) || icaltime_is_null_time (tt_end))
                        return NULL;
 
+               if (tt_end.is_date && icalcomponent_get_first_property (comp_data->icalcomp, 
ICAL_DTSTART_PROPERTY)) {
+                       struct icaltimetype tt_start;
+                       icaltimezone *start_zone = NULL;
+                       gboolean got_start_zone = FALSE;
+
+                       tt_start = icalproperty_get_dtstart (prop);
+
+                       if (icaltime_get_tzid (tt_start)
+                           && e_cal_client_get_timezone_sync (comp_data->client, icaltime_get_tzid 
(tt_start), &start_zone, NULL, NULL))
+                               got_start_zone = TRUE;
+
+                       if (got_start_zone) {
+                               tt_start = icaltime_from_timet_with_zone (comp_data->instance_start, 
tt_start.is_date, start_zone);
+                               if (model_zone)
+                                       icaltimezone_convert_time (&tt_start, start_zone, model_zone);
+                       } else {
+                               tt_start = icaltime_from_timet_with_zone (
+                                       comp_data->instance_start,
+                                       tt_start.is_date, model_zone);
+                       }
+
+                       icaltime_adjust (&tt_start, 1, 0, 0, 0);
+
+                       /* Decrease by a day only if the DTSTART will still be before, or the same as, DTEND 
*/
+                       if (icaltime_compare (tt_start, tt_end) <= 0)
+                               icaltime_adjust (&tt_end, -1, 0, 0, 0);
+               }
+
                comp_data->dtend = g_new0 (ECellDateEditValue, 1);
                comp_data->dtend->tt = tt_end;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]