[evolution/gnome-40] I#1467 - Calendar: Ignores change of repeating event's end date only



commit d1f1939089e6093c63cc5483f83435c546647fff
Author: Milan Crha <mcrha redhat com>
Date:   Wed Apr 21 11:11:54 2021 +0200

    I#1467 - Calendar: Ignores change of repeating event's end date only
    
    Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1467

 src/calendar/gui/comp-util.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/calendar/gui/comp-util.c b/src/calendar/gui/comp-util.c
index e931b48a39..f307008c85 100644
--- a/src/calendar/gui/comp-util.c
+++ b/src/calendar/gui/comp-util.c
@@ -781,6 +781,7 @@ comp_util_sanitize_recurrence_master_sync (ECalComponent *comp,
            i_cal_time_compare_date_only (e_cal_component_datetime_get_value (rdt), 
e_cal_component_datetime_get_value (sdt)) == 0) {
                ECalComponentDateTime *msdt, *medt, *edt;
                gint yy = 0, mm = 0, dd = 0;
+               gint64 diff;
 
                msdt = e_cal_component_get_dtstart (master);
                medt = e_cal_component_get_dtend (master);
@@ -798,12 +799,17 @@ comp_util_sanitize_recurrence_master_sync (ECalComponent *comp,
                        return FALSE;
                }
 
+               /* Consider the day difference only, because the time is preserved */
+               diff = (i_cal_time_as_timet (e_cal_component_datetime_get_value (edt)) -
+                       i_cal_time_as_timet (e_cal_component_datetime_get_value (sdt))) / (24 * 60 * 60);
+
                i_cal_time_get_date (e_cal_component_datetime_get_value (msdt), &yy, &mm, &dd);
                i_cal_time_set_date (e_cal_component_datetime_get_value (sdt), yy, mm, dd);
-
-               i_cal_time_get_date (e_cal_component_datetime_get_value (medt), &yy, &mm, &dd);
                i_cal_time_set_date (e_cal_component_datetime_get_value (edt), yy, mm, dd);
 
+               if (diff)
+                       i_cal_time_adjust (e_cal_component_datetime_get_value (edt), diff, 0, 0, 0);
+
                /* Make sure the DATE value of the DTSTART and DTEND do not match */
                if (i_cal_time_is_date (e_cal_component_datetime_get_value (sdt)) &&
                    i_cal_time_is_date (e_cal_component_datetime_get_value (edt)) &&


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