From 5b3791bb89c449b143691a7cb79ea89549adeff1 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Tue, 21 Dec 2004 16:52:00 +0000 Subject: Merge from recurrences-work-branch 2004-12-21 Rodrigo Moya Merge from recurrences-work-branch * gui/e-cal-model.c (free_comp_data): renamed to e_cal_model_free_component_data and made it public. (clear_objects_array, e_cal_view_objects_removed_cb, remove_client_objects): use e_cal_model_free_component_data. (get_dtstart): get the DTSTART correctly for recurrences. (add_instance_cb): initialize all members of ECalModelComponent, and use the correct icalcomponent when setting the field. (set_instance_times): new function to set the instance_* fields of the ECalModelComponent when not expanding recurrences. (e_cal_view_objects_added_cb): expand recurrences for all objects when the model is set to expand. Call set_instance_times when not expanding recurrences. (e_cal_view_objects_modified_cb): made it remove objects and re-add them. (copy_ecdv): check values before using them. (e_cal_model_copy_component_data): Added code to copy the instance_* and color fields. * gui/e-cal-model-calendar.c (get_dtend): get the DTEND correctly for recurrences. (ecmc_set_value_at): ask user which instances to modify. * gui/e-day-view.c (e_day_view_find_event_from_uid): changed to search by UID and RID if given. (process_component): changed to not expand recurrences at all, this is now done on the model. (row_deleted_check_cb, remove_uid_cb): removed these functions. (model_rows_deleted_cb): changed to just remove the rows signalled from the model, which is the responsible for the recurrence expansion. (e_day_view_new): set the model to expand recurrences. (e_day_view_remove_event_cb): check the value searched in the array. (e_day_view_do_key_press): use e_day_view_find_event_from_uid correctly. * gui/e-week-view.c (e_week_view_find_event_from_uid): changed to search by UID and RID if given. (process_component_recur_cb): removed. (process_component): changed to not expand recurrences at all, this is now done on the model. (row_deleted_check_cb, remove_uid_cb): removed these functions. (model_rows_deleted_cb): changed to just remove the rows signalled from the model, which is the responsible for the recurrence expansion. (e_week_view_new): set the model to expand recurrences. (e_week_view_remove_event_cb): check the value searched in the array. Set the ECalModelComponent field to NULL after freeing it. (e_week_view_do_key_press): use e_week_view_find_event_from_uid correctly. * gui/dialogs/recur-comp.c (recur_component_dialog): remove the RECURRENCE-ID from the object when modifying all instances. svn path=/trunk/; revision=28166 --- calendar/gui/e-cal-model-calendar.c | 39 ++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) (limited to 'calendar/gui/e-cal-model-calendar.c') diff --git a/calendar/gui/e-cal-model-calendar.c b/calendar/gui/e-cal-model-calendar.c index c4734d4d6f..5284332f72 100644 --- a/calendar/gui/e-cal-model-calendar.c +++ b/calendar/gui/e-cal-model-calendar.c @@ -26,7 +26,10 @@ #include #include "e-cal-model-calendar.h" #include "e-cell-date-edit-text.h" +#include "itip-utils.h" #include "misc.h" +#include "dialogs/recur-comp.h" +#include "dialogs/send-comp.h" struct _ECalModelCalendarPrivate { }; @@ -112,7 +115,7 @@ get_dtend (ECalModelCalendar *model, ECalModelComponent *comp_data) if (!comp_data->dtend) { icalproperty *prop; - icaltimezone *zone; + icaltimezone *zone, *model_zone; gboolean got_zone = FALSE; prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_DTEND_PROPERTY); @@ -125,11 +128,12 @@ get_dtend (ECalModelCalendar *model, ECalModelComponent *comp_data) && e_cal_get_timezone (comp_data->client, icaltime_get_tzid (tt_end), &zone, NULL)) got_zone = TRUE; - if ((e_cal_model_get_flags (E_CAL_MODEL (model)) & E_CAL_MODEL_FLAGS_EXPAND_RECURRENCES) && - (e_cal_util_component_has_recurrences (comp_data->icalcomp))) { - if (got_zone) + if (e_cal_model_get_flags (E_CAL_MODEL (model)) & E_CAL_MODEL_FLAGS_EXPAND_RECURRENCES) { + if (got_zone) { tt_end = icaltime_from_timet_with_zone (comp_data->instance_end, tt_end.is_date, zone); - else + if ((model_zone = e_cal_model_get_timezone (E_CAL_MODEL (model)))) + icaltimezone_convert_time (&tt_end, zone, model_zone); + } else tt_end = icaltime_from_timet (comp_data->instance_end, tt_end.is_date); } @@ -329,6 +333,8 @@ static void ecmc_set_value_at (ETableModel *etm, int col, int row, const void *value) { ECalModelComponent *comp_data; + CalObjModType mod = CALOBJ_MOD_ALL; + ECalComponent *comp; ECalModelCalendar *model = (ECalModelCalendar *) etm; g_return_if_fail (E_IS_CAL_MODEL_CALENDAR (model)); @@ -344,6 +350,20 @@ ecmc_set_value_at (ETableModel *etm, int col, int row, const void *value) if (!comp_data) return; + comp = e_cal_component_new (); + if (!e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp))) { + g_object_unref (comp); + return; + } + + /* ask about mod type */ + if (e_cal_component_is_instance (comp)) { + if (!recur_component_dialog (comp_data->client, comp, &mod, NULL)) { + g_object_unref (comp); + return; + } + } + switch (col) { case E_CAL_MODEL_CALENDAR_FIELD_DTEND : set_dtend (comp_data, value); @@ -356,12 +376,17 @@ ecmc_set_value_at (ETableModel *etm, int col, int row, const void *value) break; } - /* FIXME ask about mod type */ - if (!e_cal_modify_object (comp_data->client, comp_data->icalcomp, CALOBJ_MOD_ALL, NULL)) { + if (e_cal_modify_object (comp_data->client, comp_data->icalcomp, CALOBJ_MOD_ALL, NULL)) { + if (itip_organizer_is_user (comp, comp_data->client) && + send_component_dialog (NULL, comp_data->client, comp, FALSE)) + itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp, comp_data->client, NULL); + } else { g_warning (G_STRLOC ": Could not modify the object!"); /* FIXME Show error dialog */ } + + g_object_unref (comp); } static gboolean -- cgit v1.2.3