Index: calendar/gui/dialogs/comp-editor.c
===================================================================
--- calendar/gui/dialogs/comp-editor.c	(revision 35225)
+++ calendar/gui/dialogs/comp-editor.c	(working copy)
@@ -715,6 +715,7 @@ save_comp (CompEditor *editor)
 	GError *error = NULL;
 	GHashTable *timezones;
 	const char *orig_uid;
+	char *orig_rid = NULL;
 	icalcomponent *icalcomp;
 
 	priv = editor->priv;
@@ -737,11 +738,16 @@ save_comp (CompEditor *editor)
 	timezones = g_hash_table_new (g_str_hash, g_str_equal);
 
 	clone = e_cal_component_clone (priv->comp);
+
+	if (e_cal_component_is_instance (clone) || e_cal_component_has_recurrences (clone))
+		orig_rid = e_cal_component_get_recurid_as_string (priv->comp);
+
 	for (l = priv->pages; l != NULL; l = l->next) {
 		if (!comp_editor_page_fill_component (l->data, clone)) {
 			g_object_unref (clone);
 			g_hash_table_destroy (timezones);
 			comp_editor_show_page (editor, COMP_EDITOR_PAGE (l->data));
+			g_free (orig_rid);
 			return FALSE;
 		}
 
@@ -771,25 +777,50 @@ save_comp (CompEditor *editor)
 	icalcomp = e_cal_component_get_icalcomponent (priv->comp);
 	/* send the component to the server */
 	if (!cal_comp_is_on_server (priv->comp, priv->client)) {
-		result = e_cal_create_object (priv->client, icalcomp, NULL, &error);
+		result = FALSE;
+
+		if (priv->mod != CALOBJ_MOD_THIS && orig_rid && *orig_rid) {
+			icalcomponent *ic = NULL;
+
+			/* transfer master object first and then modify it */
+			if (e_cal_get_object (priv->source_client, orig_uid, NULL, &ic, NULL)) {
+				result = e_cal_create_object (priv->client, ic, NULL, NULL);
+				icalcomponent_free (ic);
+			}
+		}
+
+		if (!result) {
+			if (priv->mod == CALOBJ_MOD_THIS) {
+				icalproperty *prop;
+
+				/* Remove the recurrence id property if exists when moving event to different source */
+				prop = icalcomponent_get_first_property (icalcomp, ICAL_RECURRENCEID_PROPERTY);
+				if (prop)
+					icalcomponent_remove_property (icalcomp, prop);
+			}
+
+			result = e_cal_create_object (priv->client, icalcomp, NULL, &error);
+		}
+
 		if (result)
 			g_signal_emit_by_name (editor, "object_created");
-	} else {
-		if (priv->mod == CALOBJ_MOD_THIS) {
-			e_cal_component_set_rdate_list (priv->comp, NULL);
-			e_cal_component_set_rrule_list (priv->comp, NULL);
-			e_cal_component_set_exdate_list (priv->comp, NULL);
-			e_cal_component_set_exrule_list (priv->comp, NULL);
-		}
-		result = e_cal_modify_object (priv->client, icalcomp, priv->mod, &error);
-
-		if (result && priv->mod == CALOBJ_MOD_THIS) {
-			/* FIXME do we really need to do this ? */
-			if ((priv->flags & COMP_EDITOR_DELEGATE) || !e_cal_component_has_organizer (clone) || itip_organizer_is_user (clone, priv->client) || itip_sentby_is_user (clone))
-				e_cal_component_commit_sequence (clone);
-			else
-				e_cal_component_abort_sequence (clone);
-		}
+	}
+
+	if (priv->mod == CALOBJ_MOD_THIS) {
+		e_cal_component_set_rdate_list (priv->comp, NULL);
+		e_cal_component_set_rrule_list (priv->comp, NULL);
+		e_cal_component_set_exdate_list (priv->comp, NULL);
+		e_cal_component_set_exrule_list (priv->comp, NULL);
+	}
+
+	result = e_cal_modify_object (priv->client, icalcomp, priv->mod, &error);
+
+	if (result && priv->mod == CALOBJ_MOD_THIS) {
+		/* FIXME do we really need to do this ? */
+		if ((priv->flags & COMP_EDITOR_DELEGATE) || !e_cal_component_has_organizer (clone) || itip_organizer_is_user (clone, priv->client) || itip_sentby_is_user (clone))
+			e_cal_component_commit_sequence (clone);
+		else
+			e_cal_component_abort_sequence (clone);
 	}
 
 	/* If the delay delivery is set, the items will not be created in the server immediately,
@@ -810,8 +841,11 @@ save_comp (CompEditor *editor)
 
 			icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY);
 		}
-		if (delay_set)
+		if (delay_set) {
+			g_free (orig_rid);
+
 			return TRUE;
+		}
 	}
 
 	if (!result) {
@@ -829,6 +863,8 @@ save_comp (CompEditor *editor)
 		if (error)
 			g_error_free (error);
 
+		g_free (orig_rid);
+
 		return FALSE;
 	} else {
 		if (priv->source_client &&
@@ -836,10 +872,8 @@ save_comp (CompEditor *editor)
 				     e_cal_get_source (priv->source_client)) &&
 		    cal_comp_is_on_server (priv->comp, priv->source_client)) {
 			/* Comp found a new home. Remove it from old one. */
-
-			if (e_cal_component_is_instance (priv->comp) || e_cal_component_has_recurrences (priv->comp))
-				e_cal_remove_object_with_mod (priv->source_client, orig_uid, NULL,
-						CALOBJ_MOD_ALL, NULL);
+			if (orig_rid && priv->mod != CALOBJ_MOD_ALL)
+				e_cal_remove_object_with_mod (priv->source_client, orig_uid, orig_rid, priv->mod, NULL);
 			else
 				e_cal_remove_object (priv->source_client, orig_uid, NULL);
 
@@ -854,6 +888,8 @@ save_comp (CompEditor *editor)
 		priv->changed = FALSE;
 	}
 
+	g_free (orig_rid);
+
 	return TRUE;
 }
 
Index: calendar/ChangeLog
===================================================================
--- calendar/ChangeLog	(revision 35225)
+++ calendar/ChangeLog	(working copy)
@@ -1,3 +1,11 @@
+2008-03-21  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #324219
+
+	* gui/dialogs/comp-editor.c: (save_comp):
+	When saving recurring event to other than initial source, then take
+	care to either split it correctly or move the master object too.
+
 2008-03-13  Milan Crha  <mcrha@redhat.com>
 
 	** Fix for bug #512543
