[evolution-data-server] Bug #655253 - Delete of one occurrence of a repeatable event don't work



commit 8631a8f2e0c1ca71a48aeca5a44a11506ac77e33
Author: Milan Crha <mcrha redhat com>
Date:   Fri Sep 2 13:21:07 2011 +0200

    Bug #655253 - Delete of one occurrence of a repeatable event don't work

 calendar/backends/file/e-cal-backend-file.c |   28 +++++++++++++++++++++++++++
 calendar/libecal/e-cal-client-view.c        |   14 +++++++++++-
 2 files changed, 40 insertions(+), 2 deletions(-)
---
diff --git a/calendar/backends/file/e-cal-backend-file.c b/calendar/backends/file/e-cal-backend-file.c
index 46c2e35..0f86097 100644
--- a/calendar/backends/file/e-cal-backend-file.c
+++ b/calendar/backends/file/e-cal-backend-file.c
@@ -2292,8 +2292,12 @@ e_cal_backend_file_modify_object (ECalBackendSync *backend, EDataCal *cal, GCanc
 			priv->comp = g_list_remove (priv->comp, recurrence);
 			obj_data->recurrences_list = g_list_remove (obj_data->recurrences_list, recurrence);
 			g_hash_table_remove (obj_data->recurrences, rid);
+		} else if (obj_data->full_object) {
+			/* add exception for the modified instance */
+			e_cal_util_remove_instances (e_cal_component_get_icalcomponent (obj_data->full_object), icaltime_from_string (rid), CALOBJ_MOD_THIS);
 		}
 
+
 		/* add the detached instance */
 		g_hash_table_insert (obj_data->recurrences,
 				     rid,
@@ -2588,6 +2592,28 @@ get_object_string_from_fileobject (ECalBackendFileObject *obj_data, const gchar
 	return NULL;
 }
 
+static void
+notify_comp_removed_cb (gpointer pecalcomp, gpointer pbackend)
+{
+	ECalComponent *comp = pecalcomp;
+	ECalBackend *backend = pbackend;
+	ECalComponentId *id;
+	gchar *compstr;
+
+	g_return_if_fail (comp != NULL);
+	g_return_if_fail (backend != NULL);
+
+	id = e_cal_component_get_id (comp);
+	g_return_if_fail (id != NULL);
+
+	compstr = e_cal_component_get_as_string (comp);
+
+	e_cal_backend_notify_object_removed (backend, id, compstr, NULL);
+
+	e_cal_component_free_id (id);
+	g_free (compstr);
+}
+
 /* Remove_object handler for the file backend */
 static void
 e_cal_backend_file_remove_object (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable,
@@ -2636,6 +2662,8 @@ e_cal_backend_file_remove_object (ECalBackendSync *backend, EDataCal *cal, GCanc
 	switch (mod) {
 	case CALOBJ_MOD_ALL :
 		*old_object = get_object_string_from_fileobject (obj_data, recur_id);
+		if (obj_data->recurrences_list)
+			g_list_foreach (obj_data->recurrences_list, notify_comp_removed_cb, cbfile);
 		remove_component (cbfile, uid, obj_data);
 
 		*object = NULL;
diff --git a/calendar/libecal/e-cal-client-view.c b/calendar/libecal/e-cal-client-view.c
index 4e479b0..c20d661 100644
--- a/calendar/libecal/e-cal-client-view.c
+++ b/calendar/libecal/e-cal-client-view.c
@@ -88,14 +88,24 @@ static GSList *
 build_id_list (const gchar * const *seq)
 {
 	GSList *list;
+	const gchar *eol;
 	gint i;
 
 	list = NULL;
 	for (i = 0; seq[i]; i++) {
 		ECalComponentId *id;
 		id = g_new (ECalComponentId, 1);
-		id->uid = g_strdup (seq[i]);
-		id->rid = NULL; /* TODO */
+
+		/* match encoding as in notify_remove() in e-data-cal-view.c: <uid>[\n<rid>] */
+		eol = strchr (seq[i], '\n');
+		if (eol) {
+			id->uid = g_strndup (seq[i], eol - seq[i]);
+			id->rid = g_strdup (eol + 1);
+		} else {
+			id->uid = g_strdup (seq[i]);
+			id->rid = NULL;
+		}
+
 		list = g_slist_prepend (list, id);
 	}
 



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