diff options
author | Chenthill Palanisamy <pchen@src.gnome.org> | 2005-11-29 03:05:24 +0800 |
---|---|---|
committer | Chenthill Palanisamy <pchen@src.gnome.org> | 2005-11-29 03:05:24 +0800 |
commit | b58366837b5763f2c90d31998c78d2af72e43e0a (patch) | |
tree | b38502174c5b4c449b4b8be9d081d721877771ab /calendar | |
parent | f451a8f285465976c3ae5192adb8b17121c03c8c (diff) | |
download | gsoc2013-evolution-b58366837b5763f2c90d31998c78d2af72e43e0a.tar.gz gsoc2013-evolution-b58366837b5763f2c90d31998c78d2af72e43e0a.tar.zst gsoc2013-evolution-b58366837b5763f2c90d31998c78d2af72e43e0a.zip |
fixes #317322
svn path=/trunk/; revision=30699
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 10 | ||||
-rw-r--r-- | calendar/gui/e-calendar-view.c | 102 |
2 files changed, 65 insertions, 47 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index e910418892..43f8f8dede 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,15 @@ 2005-11-28 Chenthill Palanisamy <pchenthill@novell.com> + Fixes #317322 + * gui/e-calendar-view.c: + (e_calendar_view_delete_selected_occurrence): Do not + set a new rid if the component already has it. If an + instance is removed from master component, send a modify + request setting the exception for that instance. Cleaned + up the code. + +2005-11-28 Chenthill Palanisamy <pchenthill@novell.com> + Fixes #314639 * gui/e-calendar-view.c: (e_calendar_view_new_appointment_for): Check if the default diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c index 8709281820..e137fd079c 100644 --- a/calendar/gui/e-calendar-view.c +++ b/calendar/gui/e-calendar-view.c @@ -943,71 +943,79 @@ e_calendar_view_delete_selected_events (ECalendarView *cal_view) void e_calendar_view_delete_selected_occurrence (ECalendarView *cal_view) { - ECalendarViewEvent *event; GList *selected; - const char *uid, *rid = NULL; - GError *error = NULL; ECalComponent *comp; - struct icaltimetype itt; - ECalComponentDateTime dt; - icaltimezone *zone = NULL; + ECalendarViewEvent *event; selected = e_calendar_view_get_selected_events (cal_view); if (!selected) return; - + event = (ECalendarViewEvent *) selected->data; - comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); - e_cal_component_get_uid (comp, &uid); - e_cal_component_get_dtstart (comp, &dt); - - if (dt.tzid) { + if (delete_component_dialog (comp, FALSE, 1, e_cal_component_get_vtype (comp), GTK_WIDGET (cal_view))) { + const char *uid, *rid = NULL; GError *error = NULL; + ECalComponentDateTime dt; + icaltimezone *zone = NULL; + gboolean is_instance = FALSE; - e_cal_get_timezone (event->comp_data->client, dt.tzid, &zone, &error); - if (error) { - zone = e_calendar_view_get_timezone (cal_view); - g_clear_error(&error); - } - } else - zone = e_calendar_view_get_timezone (cal_view); + e_cal_component_get_uid (comp, &uid); + e_cal_component_get_dtstart (comp, &dt); + is_instance = e_cal_component_is_instance (comp); - itt = icaltime_from_timet_with_zone (event->comp_data->instance_start, TRUE, zone ? zone : icaltimezone_get_utc_timezone ()); + if (dt.tzid) { + GError *error = NULL; - if (!e_cal_get_recurrences_no_master (event->comp_data->client)) - rid = icaltime_as_ical_string (itt); - else - rid = e_cal_component_get_recurid_as_string (comp); - - e_cal_component_free_datetime (&dt); - if (rid) { - if (delete_component_dialog (comp, FALSE, 1, e_cal_component_get_vtype (comp), GTK_WIDGET (cal_view))) { - - if (itip_organizer_is_user (comp, event->comp_data->client) - && cancel_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)), - event->comp_data->client, - comp, TRUE) && !e_cal_get_save_schedules (event->comp_data->client)) { - if (!e_cal_component_is_instance (comp)) { - ECalComponentRange range; - - /* set the recurrence ID of the object we send */ - range.type = E_CAL_COMPONENT_RANGE_SINGLE; - e_cal_component_get_dtstart (comp, &range.datetime); - range.datetime.value->is_date = 1; - e_cal_component_set_recurid (comp, &range); - - e_cal_component_free_datetime (&range.datetime); - } - itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, event->comp_data->client, NULL, NULL); + e_cal_get_timezone (event->comp_data->client, dt.tzid, &zone, &error); + if (error) { + zone = e_calendar_view_get_timezone (cal_view); + g_clear_error(&error); + } + } else + zone = e_calendar_view_get_timezone (cal_view); + + + if (is_instance) + rid = e_cal_component_get_recurid_as_string (comp); + + e_cal_component_free_datetime (&dt); + + + if (itip_organizer_is_user (comp, event->comp_data->client) + && cancel_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)), + event->comp_data->client, + comp, TRUE) && !e_cal_get_save_schedules (event->comp_data->client)) { + if (!e_cal_component_is_instance (comp)) { + ECalComponentRange range; + + /* set the recurrence ID of the object we send */ + range.type = E_CAL_COMPONENT_RANGE_SINGLE; + e_cal_component_get_dtstart (comp, &range.datetime); + range.datetime.value->is_date = 1; + e_cal_component_set_recurid (comp, &range); + + e_cal_component_free_datetime (&range.datetime); } + itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, event->comp_data->client, NULL, NULL); + } + if (is_instance) e_cal_remove_object_with_mod (event->comp_data->client, uid, rid, CALOBJ_MOD_THIS, &error); - delete_error_dialog (error, E_CAL_COMPONENT_EVENT); - g_clear_error (&error); + else { + struct icaltimetype instance_rid; + + instance_rid = icaltime_from_timet_with_zone (event->comp_data->instance_start, + TRUE, zone ? zone : icaltimezone_get_utc_timezone ()); + e_cal_util_remove_instances (event->comp_data->icalcomp, instance_rid, CALOBJ_MOD_THIS); + e_cal_modify_object (event->comp_data->client, event->comp_data->icalcomp, CALOBJ_MOD_THIS, + &error); } + + delete_error_dialog (error, E_CAL_COMPONENT_EVENT); + g_clear_error (&error); } /* free memory */ |