[evolution-patches] fix for the bug #317322 [calendar]
- From: chen <pchenthill novell com>
- To: patches <evolution-patches gnome org>
- Subject: [evolution-patches] fix for the bug #317322 [calendar]
- Date: Fri, 07 Oct 2005 18:59:20 +0530
Hi,
Have attached the fix for the bug. Sent the proper recurrence while
removing a particular instance and set right instance in EDS if the
detached instance has no master object.
thanks, Chenthill.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.521
diff -u -p -r1.521 ChangeLog
--- ChangeLog 7 Oct 2005 08:53:18 -0000 1.521
+++ ChangeLog 7 Oct 2005 13:09:00 -0000
@@ -1,3 +1,11 @@
+2005-10-07 Chenthill Palanisamy <pchenthill novell com>
+
+ Fixes #317322
+ * backends/file/e-cal-backend-file.c:
+ (get_object_string_from_fileobject),
+ (e_cal_backend_file_remove_object): Handle the case
+ of deleting a recurring event with no master object.
+
2005-10-07 Arunprakash <arunp novell com>
* libedata-cal/e-data-cal-factory.c (backend_last_client_gone_cb) :
Index: backends/file/e-cal-backend-file.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/file/e-cal-backend-file.c,v
retrieving revision 1.60
diff -u -p -r1.60 e-cal-backend-file.c
--- backends/file/e-cal-backend-file.c 31 Aug 2005 04:21:52 -0000 1.60
+++ backends/file/e-cal-backend-file.c 7 Oct 2005 13:09:01 -0000
@@ -2012,6 +2012,27 @@ remove_instance (ECalBackendFile *cbfile
cbfile->priv->comp = g_list_prepend (cbfile->priv->comp, obj_data->full_object);
}
+static char *
+get_object_string_from_fileobject (ECalBackendFileObject *obj_data, const char *rid)
+{
+ ECalComponent *comp = obj_data->full_object;
+ char *real_rid;
+
+ if (!rid) {
+ return e_cal_component_get_as_string (comp);
+ } else {
+ if (g_hash_table_lookup_extended (obj_data->recurrences, rid, (void **)&real_rid, (void **)&comp))
+ return e_cal_component_get_as_string (comp);
+ else {
+ /* FIXME remove this once we delete an instance from master object through
+ modify request by setting exception */
+ return e_cal_component_get_as_string (comp);
+ }
+ }
+
+ return NULL;
+}
+
/* Remove_object handler for the file backend */
static ECalBackendSyncStatus
e_cal_backend_file_remove_object (ECalBackendSync *backend, EDataCal *cal,
@@ -2024,6 +2045,7 @@ e_cal_backend_file_remove_object (ECalBa
ECalBackendFileObject *obj_data;
ECalComponent *comp;
RemoveRecurrenceData rrdata;
+ const char *recur_id = NULL;
cbfile = E_CAL_BACKEND_FILE (backend);
priv = cbfile->priv;
@@ -2036,37 +2058,35 @@ e_cal_backend_file_remove_object (ECalBa
obj_data = g_hash_table_lookup (priv->comp_uid_hash, uid);
if (!obj_data)
return GNOME_Evolution_Calendar_ObjectNotFound;
-
+
+ if (rid && *rid)
+ recur_id = rid;
+
comp = obj_data->full_object;
switch (mod) {
case CALOBJ_MOD_ALL :
- if (comp) {
- *old_object = e_cal_component_get_as_string (comp);
- } else {
- char *real_rid;
-
- if (g_hash_table_lookup_extended (obj_data->recurrences, rid, (void **)&real_rid, (void **)&comp))
- *old_object = e_cal_component_get_as_string (comp);
- }
-
+ *old_object = get_object_string_from_fileobject (obj_data, recur_id);
remove_component (cbfile, uid, obj_data);
*object = NULL;
break;
case CALOBJ_MOD_THIS :
- *old_object = e_cal_component_get_as_string (comp);
- if (!rid || !*rid) {
+ if (!recur_id) {
+ *old_object = get_object_string_from_fileobject (obj_data, recur_id);
remove_component (cbfile, uid, obj_data);
*object = NULL;
} else {
- remove_instance (cbfile, obj_data, rid);
- *object = e_cal_component_get_as_string (obj_data->full_object);
+ *old_object = get_object_string_from_fileobject (obj_data, recur_id);
+
+ remove_instance (cbfile, obj_data, recur_id);
+ if (comp)
+ *object = e_cal_component_get_as_string (comp);
}
break;
case CALOBJ_MOD_THISANDPRIOR :
case CALOBJ_MOD_THISANDFUTURE :
- if (!rid || !*rid)
+ if (!recur_id || !*recur_id)
return GNOME_Evolution_Calendar_ObjectNotFound;
*old_object = e_cal_component_get_as_string (comp);
@@ -2077,12 +2097,12 @@ e_cal_backend_file_remove_object (ECalBa
priv->comp = g_list_remove (priv->comp, comp);
e_cal_util_remove_instances (e_cal_component_get_icalcomponent (comp),
- icaltime_from_string (rid), mod);
+ icaltime_from_string (recur_id), mod);
/* now remove all detached instances */
rrdata.cbfile = cbfile;
rrdata.obj_data = obj_data;
- rrdata.rid = rid;
+ rrdata.rid = recur_id;
rrdata.mod = mod;
g_hash_table_foreach_remove (obj_data->recurrences, (GHRFunc) remove_object_instance_cb, &rrdata);
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2826
diff -u -p -r1.2826 ChangeLog
--- ChangeLog 6 Oct 2005 18:21:50 -0000 1.2826
+++ ChangeLog 7 Oct 2005 13:10:06 -0000
@@ -1,3 +1,13 @@
+2005-10-07 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-10-06 Srinivasa Ragavan <sragavan novell com>
* calendar.error.xml: Added accels to the Disard new event/
Index: gui/e-calendar-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-calendar-view.c,v
retrieving revision 1.95
diff -u -p -r1.95 e-calendar-view.c
--- gui/e-calendar-view.c 3 Oct 2005 11:20:51 -0000 1.95
+++ gui/e-calendar-view.c 7 Oct 2005 13:10:06 -0000
@@ -933,71 +933,79 @@ e_calendar_view_delete_selected_events (
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_component_get_uid (comp, &uid);
+ e_cal_component_get_dtstart (comp, &dt);
+ is_instance = e_cal_component_is_instance (comp);
+
+ if (dt.tzid) {
+ GError *error = 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);
- 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);
- itt = icaltime_from_timet_with_zone (event->comp_data->instance_start, TRUE, zone ? zone : icaltimezone_get_utc_timezone ());
+ if (is_instance)
+ rid = e_cal_component_get_recurid_as_string (comp);
- 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_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 */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]