diff options
Diffstat (limited to 'calendar/gui/e-week-view.c')
-rw-r--r-- | calendar/gui/e-week-view.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 1f6768c4cb..69533969d4 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -1865,6 +1865,8 @@ e_week_view_copy_clipboard (EWeekView *week_view) { EWeekViewEvent *event; char *comp_str; + icalcomponent *vcal_comp; + icalcomponent *new_icalcomp; g_return_if_fail (E_IS_WEEK_VIEW (week_view)); @@ -1873,11 +1875,21 @@ e_week_view_copy_clipboard (EWeekView *week_view) if (event == NULL) return; - comp_str = cal_component_get_as_string (event->comp); + /* create top-level VCALENDAR component and add VTIMEZONE's */ + vcal_comp = cal_util_new_top_level (); + cal_util_add_timezones_from_component (vcal_comp, event->comp); + + new_icalcomp = icalcomponent_new_clone (cal_component_get_icalcomponent (event->comp)); + icalcomponent_add_component (vcal_comp, new_icalcomp); + + comp_str = icalcomponent_as_ical_string (vcal_comp); if (week_view->clipboard_selection != NULL) g_free (week_view->clipboard_selection); - week_view->clipboard_selection = comp_str; + week_view->clipboard_selection = g_strdup (comp_str); gtk_selection_owner_set (week_view->invisible, clipboard_atom, GDK_CURRENT_TIME); + + /* free memory */ + icalcomponent_free (vcal_comp); } void @@ -3994,6 +4006,8 @@ e_week_view_on_copy (GtkWidget *widget, gpointer data) EWeekView *week_view; EWeekViewEvent *event; char *comp_str; + icalcomponent *vcal_comp; + icalcomponent *new_icalcomp; week_view = E_WEEK_VIEW (data); @@ -4003,12 +4017,22 @@ e_week_view_on_copy (GtkWidget *widget, gpointer data) event = &g_array_index (week_view->events, EWeekViewEvent, week_view->popup_event_num); - comp_str = cal_component_get_as_string (event->comp); + /* create top-level VCALENDAR component and add VTIMEZONE's */ + vcal_comp = cal_util_new_top_level (); + cal_util_add_timezones_from_component (vcal_comp, event->comp); + + new_icalcomp = icalcomponent_new_clone (cal_component_get_icalcomponent (event->comp)); + icalcomponent_add_component (vcal_comp, new_icalcomp); + + comp_str = icalcomponent_as_ical_string (vcal_comp); if (week_view->clipboard_selection) g_free (week_view->clipboard_selection); - week_view->clipboard_selection = comp_str; + week_view->clipboard_selection = g_strdup (comp_str); gtk_selection_owner_set (week_view->invisible, clipboard_atom, GDK_CURRENT_TIME); + + /* free memory */ + icalcomponent_free (vcal_comp); } static void |