Index: calendar/gui/e-calendar-view.c
===================================================================
--- calendar/gui/e-calendar-view.c	(revision 36447)
+++ calendar/gui/e-calendar-view.c	(working copy)
@@ -266,7 +266,7 @@ e_calendar_view_add_event (ECalendarView
 	gint start_offset, end_offset;
 	gboolean all_day_event = FALSE;
 	GnomeCalendarViewType view_type;
-	ECalComponentDateTime dt;
+	GError *error = NULL;
 
 	start_offset = 0;
 	end_offset = 0;
@@ -323,15 +323,16 @@ e_calendar_view_add_event (ECalendarView
 			new_time.minute = old_dtstart.minute;
 			new_time.second = old_dtstart.second;
 
-			new_dtstart = icaltime_as_timet_with_zone (new_time, default_zone);
+			new_dtstart = icaltime_as_timet_with_zone (new_time, old_dtstart.zone ? old_dtstart.zone : default_zone);
 		}
 		break;
 	default:
 		g_return_if_reached ();
 	}
 
-
-	itime = icaltime_from_timet_with_zone (new_dtstart, FALSE, default_zone);
+	itime = icaltime_from_timet_with_zone (new_dtstart, FALSE, old_dtstart.zone ? old_dtstart.zone : default_zone);
+	/* set the timezone properly */
+	itime.zone = old_dtstart.zone ? old_dtstart.zone : default_zone;
 	if (all_day_event)
 		itime.is_date = TRUE;
 	icalcomponent_set_dtstart (icalcomp, itime);
@@ -350,26 +351,10 @@ e_calendar_view_add_event (ECalendarView
 	e_cal_component_set_uid (comp, uid);
 	g_free (uid);
 
-	/* set the timezone properly */
-	e_cal_component_get_dtstart (comp, &dt);
-	g_free ((char *) dt.tzid);
-	dt.tzid = icaltimezone_get_tzid (default_zone);
-	e_cal_component_set_dtstart (comp, &dt);
-	dt.tzid = NULL;
-	e_cal_component_free_datetime (&dt);
-
-	e_cal_component_get_dtend (comp, &dt);
-	g_free ((char *) dt.tzid);
-	dt.tzid = icaltimezone_get_tzid (default_zone);
-	e_cal_component_set_dtend (comp, &dt);
-	dt.tzid = NULL;
-	e_cal_component_free_datetime (&dt);
-
 	e_cal_component_commit_sequence (comp);
 
-	/* FIXME Error handling */
 	uid = NULL;
-	if (e_cal_create_object (client, e_cal_component_get_icalcomponent (comp), &uid, NULL)) {
+	if (e_cal_create_object (client, e_cal_component_get_icalcomponent (comp), &uid, &error)) {
 		if (uid) {
 			e_cal_component_set_uid (comp, uid);
 			g_free (uid);
@@ -382,7 +367,9 @@ e_calendar_view_add_event (ECalendarView
 				client, NULL, NULL, NULL);
 		}
 	} else {
-		g_message (G_STRLOC ": Could not create the object!");
+		g_message (G_STRLOC ": Could not create the object! %s", error ? error->message : "");
+		if (error)
+			g_error_free (error);
 	}
 
 	g_object_unref (comp);
@@ -799,40 +786,35 @@ clipboard_get_text_cb (GtkClipboard *cli
 	else
 		in_top_canvas = FALSE;
 
-	/* FIXME Timezone handling */
 	if (kind == ICAL_VCALENDAR_COMPONENT) {
-		icalcomponent_kind child_kind;
 		icalcomponent *subcomp;
 
-		subcomp = icalcomponent_get_first_component (icalcomp, ICAL_ANY_COMPONENT);
-		while (subcomp) {
-			child_kind = icalcomponent_isa (subcomp);
-			if (child_kind == ICAL_VEVENT_COMPONENT) {
-
-				if (e_cal_util_component_has_recurrences (subcomp)) {
-					icalproperty *icalprop = icalcomponent_get_first_property (subcomp, ICAL_RRULE_PROPERTY);
-					if (icalprop)
-						icalproperty_remove_parameter_by_name (icalprop, "X-EVOLUTION-ENDDATE");
-				}
-
-				e_calendar_view_add_event (cal_view, client, selected_time_start,
-							   default_zone, subcomp, in_top_canvas);
-			} else if (child_kind == ICAL_VTIMEZONE_COMPONENT) {
-				icaltimezone *zone;
-
-				zone = icaltimezone_new ();
-				icaltimezone_set_component (zone, subcomp);
-				e_cal_add_timezone (client, zone, NULL);
-
-				icaltimezone_free (zone, 1);
+		/* add timezones first, to have them ready */
+		for (subcomp = icalcomponent_get_first_component (icalcomp, ICAL_VTIMEZONE_COMPONENT);
+		     subcomp;
+		     subcomp = icalcomponent_get_next_component (icalcomp, ICAL_VTIMEZONE_COMPONENT)) {
+			icaltimezone *zone;
+
+			zone = icaltimezone_new ();
+			icaltimezone_set_component (zone, subcomp);
+			e_cal_add_timezone (client, zone, NULL);
+
+			icaltimezone_free (zone, 1);
+		}
+
+		for (subcomp = icalcomponent_get_first_component (icalcomp, ICAL_VEVENT_COMPONENT);
+		     subcomp;
+		     subcomp = icalcomponent_get_next_component (icalcomp, ICAL_VEVENT_COMPONENT)) {
+			if (e_cal_util_component_has_recurrences (subcomp)) {
+				icalproperty *icalprop = icalcomponent_get_first_property (subcomp, ICAL_RRULE_PROPERTY);
+				if (icalprop)
+					icalproperty_remove_parameter_by_name (icalprop, "X-EVOLUTION-ENDDATE");
 			}
 
-			subcomp = icalcomponent_get_next_component (
-				icalcomp, ICAL_ANY_COMPONENT);
+			e_calendar_view_add_event (cal_view, client, selected_time_start, default_zone, subcomp, in_top_canvas);
 		}
 
 		icalcomponent_free (icalcomp);
-
 	} else {
 		e_calendar_view_add_event (cal_view, client, selected_time_start, default_zone, icalcomp, in_top_canvas);
 	}
Index: calendar/ChangeLog
===================================================================
--- calendar/ChangeLog	(revision 36447)
+++ calendar/ChangeLog	(working copy)
@@ -1,3 +1,12 @@
+2008-09-26  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #238346
+
+	* gui/e-calendar-view.c: (e_calendar_view_add_event): Keep old
+	timezone when adding event if possible, use the default one otherwise.
+	* gui/e-calendar-view.c: (clipboard_get_text_cb):
+	Set timezones from component to the calendar first, then add events.
+
 2008-09-24  Sankar P  <psankar@novell.com>
 
 License Changes
