From a30ba5c3f1b6bddcb32d659b1e1a088fc29c4102 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 16 Jan 2009 11:21:14 +0000 Subject: ** Partial fix for bug #310844 2009-01-16 Milan Crha ** Partial fix for bug #310844 * gui/e-calendar-view.c: (transfer_item_to): Transfer master object instead of the instance for recurring events. svn path=/trunk/; revision=37084 --- calendar/ChangeLog | 7 +++++++ calendar/gui/e-calendar-view.c | 37 ++++++++++++++++++++++++++++++++----- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index f0eb2a8a79..e91c205e30 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,10 @@ +2009-01-16 Milan Crha + + ** Partial fix for bug #310844 + + * gui/e-calendar-view.c: (transfer_item_to): + Transfer master object instead of the instance for recurring events. + 2009-01-15 Milan Crha ** Fix for bug #303738 diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c index 2967a84389..a2d6c7f14d 100644 --- a/calendar/gui/e-calendar-view.c +++ b/calendar/gui/e-calendar-view.c @@ -1350,7 +1350,28 @@ transfer_item_to (ECalendarViewEvent *event, ECal *dest_client, gboolean remove_ if (!e_cal_modify_object (dest_client, event->comp_data->icalcomp, CALOBJ_MOD_ALL, NULL)) return; } else { - orig_icalcomp = icalcomponent_new_clone (event->comp_data->icalcomp); + if (e_cal_util_component_is_instance (event->comp_data->icalcomp)) { + icalcomponent *icalcomp = NULL; + + if (e_cal_get_object (event->comp_data->client, uid, NULL, &icalcomp, NULL)) { + /* use master object when working with recurring event */ + orig_icalcomp = icalcomponent_new_clone (icalcomp); + icalcomponent_free (icalcomp); + } else { + /* ... or remove the recurrence id property... */ + orig_icalcomp = icalcomponent_new_clone (event->comp_data->icalcomp); + + if (e_cal_util_component_has_recurrences (orig_icalcomp)) { + /* ... for non-detached instances, to make it a master object */ + icalproperty *prop; + + prop = icalcomponent_get_first_property (orig_icalcomp, ICAL_RECURRENCEID_PROPERTY); + if (prop) + icalcomponent_remove_property (orig_icalcomp, prop); + } + } + } else + orig_icalcomp = icalcomponent_new_clone (event->comp_data->icalcomp); icalprop = icalproperty_new_x ("1"); icalproperty_set_x_name (icalprop, "X-EVOLUTION-MOVE-CALENDAR"); @@ -1377,10 +1398,16 @@ transfer_item_to (ECalendarViewEvent *event, ECal *dest_client, gboolean remove_ /* remove the item from the source calendar */ if (remove_item) { - if (e_cal_util_component_is_instance (event->comp_data->icalcomp) || e_cal_util_component_is_instance (event->comp_data->icalcomp)) - e_cal_remove_object_with_mod (event->comp_data->client, uid, - NULL, CALOBJ_MOD_ALL, NULL); - else + if (e_cal_util_component_is_instance (event->comp_data->icalcomp) || e_cal_util_component_has_recurrences (event->comp_data->icalcomp)) { + char *rid = NULL; + struct icaltimetype recur_id = icalcomponent_get_recurrenceid (event->comp_data->icalcomp); + + if (!icaltime_is_null_time (recur_id)) + rid = icaltime_as_ical_string (recur_id); + + e_cal_remove_object_with_mod (event->comp_data->client, uid, rid, CALOBJ_MOD_ALL, NULL); + g_free (rid); + } else e_cal_remove_object (event->comp_data->client, uid, NULL); } } -- cgit v1.2.3