Blame SOURCES/evolution-3.40.4-comp-editor-timezone-reset.patch

0b0387
From 9bbb9289477c8a61a641b0b67cec367629f1e73a Mon Sep 17 00:00:00 2001
0b0387
From: Milan Crha <mcrha@redhat.com>
0b0387
Date: Thu, 10 Feb 2022 11:59:36 +0100
0b0387
Subject: [PATCH] ECompEditor: Timezone can be reset on component save
0b0387
0b0387
The libical 3.0.14 contains a change, which unsets non-UTC timezones
0b0387
in date/time values. That uncovered a bug in the Evolution code, which
0b0387
expects the timezone will be preserved on re-read from the component,
0b0387
but it's not always possible. This is corrected by re-setting the timezone
0b0387
on the used ICalTime value.
0b0387
---
0b0387
 src/calendar/gui/e-comp-editor-property-part.c | 18 ++++++++++++++++++
0b0387
 1 file changed, 18 insertions(+)
0b0387
0b0387
diff --git a/src/calendar/gui/e-comp-editor-property-part.c b/src/calendar/gui/e-comp-editor-property-part.c
0b0387
index 6bed833b12..6ce699a2e6 100644
0b0387
--- a/src/calendar/gui/e-comp-editor-property-part.c
0b0387
+++ b/src/calendar/gui/e-comp-editor-property-part.c
0b0387
@@ -913,8 +913,15 @@ ecepp_datetime_fill_component (ECompEditorPropertyPart *property_part,
0b0387
 			g_object_unref (prop);
0b0387
 		}
0b0387
 	} else {
0b0387
+		ICalTimezone *zone;
0b0387
+
0b0387
 		value = e_comp_editor_property_part_datetime_get_value (part_datetime);
0b0387
 
0b0387
+		zone = value && !i_cal_time_is_null_time (value) ? i_cal_time_get_timezone (value) : NULL;
0b0387
+
0b0387
+		if (zone)
0b0387
+			g_object_ref (zone);
0b0387
+
0b0387
 		if (prop) {
0b0387
 			/* Remove the VALUE parameter, to correspond to the actual value being set */
0b0387
 			i_cal_property_remove_parameter_by_kind (prop, I_CAL_VALUE_PARAMETER);
0b0387
@@ -925,6 +932,11 @@ ecepp_datetime_fill_component (ECompEditorPropertyPart *property_part,
0b0387
 			g_clear_object (&value);
0b0387
 			value = klass->i_cal_get_func (prop);
0b0387
 
0b0387
+			/* The timezone can be dropped since libical 3.0.14, thus restore it
0b0387
+			   before updating the TZID parameter */
0b0387
+			if (zone && value && !i_cal_time_is_null_time (value) && !i_cal_time_is_date (value))
0b0387
+				i_cal_time_set_timezone (value, zone);
0b0387
+
0b0387
 			cal_comp_util_update_tzid_parameter (prop, value);
0b0387
 		} else {
0b0387
 			prop = klass->i_cal_new_func (value);
0b0387
@@ -933,12 +945,18 @@ ecepp_datetime_fill_component (ECompEditorPropertyPart *property_part,
0b0387
 			g_clear_object (&value);
0b0387
 			value = klass->i_cal_get_func (prop);
0b0387
 
0b0387
+			/* The timezone can be dropped since libical 3.0.14, thus restore it
0b0387
+			   before updating the TZID parameter */
0b0387
+			if (zone && value && !i_cal_time_is_null_time (value) && !i_cal_time_is_date (value))
0b0387
+				i_cal_time_set_timezone (value, zone);
0b0387
+
0b0387
 			cal_comp_util_update_tzid_parameter (prop, value);
0b0387
 			i_cal_component_add_property (component, prop);
0b0387
 		}
0b0387
 
0b0387
 		g_clear_object (&value);
0b0387
 		g_clear_object (&prop);
0b0387
+		g_clear_object (&zone);
0b0387
 	}
0b0387
 }
0b0387
 
0b0387
-- 
0b0387
2.33.1
0b0387