diff options
author | JP Rosevear <jpr@ximian.com> | 2001-09-17 13:56:16 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2001-09-17 13:56:16 +0800 |
commit | d99aeae7edf0e639c866389d537ea33a11b3cd45 (patch) | |
tree | 5ed41294bcdd51ac63d9512025876c1c89f25680 /calendar/gui | |
parent | 169d9ae19a0eb165edc757eca753a757a02f60f7 (diff) | |
download | gsoc2013-evolution-d99aeae7edf0e639c866389d537ea33a11b3cd45.tar.gz gsoc2013-evolution-d99aeae7edf0e639c866389d537ea33a11b3cd45.tar.zst gsoc2013-evolution-d99aeae7edf0e639c866389d537ea33a11b3cd45.zip |
for each call back, removes the alarms (cal_component_remove_all_alarms):
2001-09-17 JP Rosevear <jpr@ximian.com>
* cal-util/cal-component.c (for_each_remove_all_alarms): for each
call back, removes the alarms
(cal_component_remove_all_alarms): remove all alarms from the
component
* cal-util/cal-component.h: new proto
* gui/e-itip-control.c (write_error_html): writes error messages
rather than normal html
* gui/itip-utils.c (itip_send_comp): remove all alarms if the
method warrants it
svn path=/trunk/; revision=12897
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/e-itip-control.c | 98 | ||||
-rw-r--r-- | calendar/gui/itip-utils.c | 17 |
2 files changed, 95 insertions, 20 deletions
diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c index 2450acab91..c6638bfa29 100644 --- a/calendar/gui/e-itip-control.c +++ b/calendar/gui/e-itip-control.c @@ -217,8 +217,6 @@ init (EItipControl *itip) priv->addresses = itip_addresses_get (); /* Header */ - priv->count = gtk_label_new ("0 of 0"); - gtk_widget_show (priv->count); priv->prev = gnome_stock_button (GNOME_STOCK_BUTTON_PREV); gtk_widget_show (priv->prev); priv->next = gnome_stock_button (GNOME_STOCK_BUTTON_NEXT); @@ -230,8 +228,6 @@ init (EItipControl *itip) gtk_box_pack_start (GTK_BOX (hbox), priv->next, FALSE, FALSE, 4); gtk_widget_show (hbox); -// gtk_box_pack_start (GTK_BOX (itip), hbox, FALSE, FALSE, 4); - gtk_signal_connect (GTK_OBJECT (priv->prev), "clicked", GTK_SIGNAL_FUNC (prev_clicked_cb), itip); gtk_signal_connect (GTK_OBJECT (priv->next), "clicked", @@ -523,6 +519,64 @@ set_message (GtkHTML *html, GtkHTMLStream *html_stream, gchar *message, gboolean } static void +write_error_html (EItipControl *itip, gchar *itip_err) +{ + EItipControlPrivate *priv; + GtkHTMLStream *html_stream; + CalComponentText text; + CalComponentOrganizer organizer; + CalComponentAttendee *attendee; + GSList *attendees, *l = NULL; + gchar *html; + + priv = itip->priv; + + /* Html widget */ + html_stream = gtk_html_begin (GTK_HTML (priv->html)); + gtk_html_write (GTK_HTML (priv->html), html_stream, + HTML_HEADER, strlen(HTML_HEADER)); + gtk_html_write (GTK_HTML (priv->html), html_stream, + HTML_BODY_START, strlen(HTML_BODY_START)); + + /* The table */ + html = g_strdup ("<table width=450 cellspacing=\"0\" cellpadding=\"4\" border=\"0\">"); + gtk_html_write (GTK_HTML (priv->html), html_stream, html, strlen(html)); + g_free (html); + + /* The column for the image */ + html = g_strdup ("<tr><td width=48 align=\"center\" valign=\"top\" rowspan=\"8\">"); + gtk_html_write (GTK_HTML (priv->html), html_stream, html, strlen(html)); + g_free (html); + + /* The image */ + html = g_strdup ("<img src=\"/meeting-request.png\"></td>"); + gtk_html_write (GTK_HTML (priv->html), html_stream, html, strlen(html)); + g_free (html); + + html = g_strdup ("<td align=\"left\" valign=\"top\">"); + gtk_html_write (GTK_HTML (priv->html), html_stream, html, strlen(html)); + g_free (html); + + /* Title */ + set_message (GTK_HTML (priv->html), html_stream, "iCalendar Error", TRUE); + + /* Error */ + gtk_html_write (GTK_HTML (priv->html), html_stream, itip_err, strlen(itip_err)); + + /* Clean up */ + html = g_strdup ("</td></tr></table>"); + gtk_html_write (GTK_HTML (priv->html), html_stream, html, strlen(html)); + g_free (html); + + gtk_html_write (GTK_HTML (priv->html), html_stream, + HTML_BODY_END, strlen(HTML_BODY_END)); + gtk_html_write (GTK_HTML (priv->html), html_stream, + HTML_FOOTER, strlen(HTML_FOOTER)); + + gtk_html_end (GTK_HTML (priv->html), html_stream, GTK_HTML_STREAM_OK); +} + +static void write_html (EItipControl *itip, gchar *itip_desc, gchar *itip_title, gchar *options) { EItipControlPrivate *priv; @@ -813,7 +867,9 @@ show_current (EItipControl *itip) { EItipControlPrivate *priv; CalComponentVType type; - + icalcomponent *alarm_comp; + icalcompiter alarm_iter; + priv = itip->priv; set_label (itip); @@ -822,9 +878,17 @@ show_current (EItipControl *itip) if (priv->comp) gtk_object_unref (GTK_OBJECT (priv->comp)); + /* Strip out alarms for security purposes */ + alarm_iter = icalcomponent_begin_component (priv->ical_comp, ICAL_VALARM_COMPONENT); + while ((alarm_comp = icalcompiter_deref (&alarm_iter)) != NULL) { + icalcomponent_remove_component (priv->ical_comp, alarm_comp); + + icalcompiter_next (&alarm_iter); + } + priv->comp = cal_component_new (); if (!cal_component_set_icalcomponent (priv->comp, priv->ical_comp)) { -// set_message (itip, _("The message does not appear to be properly formed"), TRUE); + write_error_html (itip, _("The message does not appear to be properly formed")); gtk_object_unref (GTK_OBJECT (priv->comp)); priv->comp = NULL; return; @@ -843,7 +907,7 @@ show_current (EItipControl *itip) show_current_freebusy (itip); break; default: -// set_message (itip, _("The message contains only unsupported requests."), TRUE); + write_error_html (itip, _("The message contains only unsupported requests.")); } find_my_address (itip, priv->ical_comp); @@ -861,23 +925,26 @@ e_itip_control_set_data (EItipControl *itip, const gchar *text) priv = itip->priv; clean_up (itip); + + priv->comp = NULL; + priv->total = 0; + priv->current = 0; priv->vcalendar = g_strdup (text); priv->top_level = cal_util_new_top_level (); priv->main_comp = icalparser_parse_string (priv->vcalendar); if (priv->main_comp == NULL) { -// set_message (itip, _("The information contained in this attachment was not valid"), TRUE); - priv->comp = NULL; - priv->total = 0; - priv->current = 0; - goto show; - + write_error_html (itip, _("The attachment does not contain a valid calendar message")); + return; } prop = icalcomponent_get_first_property (priv->main_comp, ICAL_METHOD_PROPERTY); - if (prop == NULL) - goto show; + if (prop == NULL) { + write_error_html (itip, _("The attachment does not contain a valid calendar message")); + return; + } + priv->method = icalproperty_get_method (prop); tz_iter = icalcomponent_begin_component (priv->main_comp, ICAL_VTIMEZONE_COMPONENT); @@ -907,7 +974,6 @@ e_itip_control_set_data (EItipControl *itip, const gchar *text) else priv->current = 0; - show: show_current (itip); } diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c index 459f6e1a9e..8811db3487 100644 --- a/calendar/gui/itip-utils.c +++ b/calendar/gui/itip-utils.c @@ -389,7 +389,8 @@ itip_send_comp (CalComponentItipMethod method, CalComponent *comp) /* Create a top level component, and add our component */ { - icalcomponent *icomp, *clone; + CalComponent *clone; + icalcomponent *icomp, *iclone; icalproperty *prop; icalvalue *value; gchar *ical_string; @@ -401,10 +402,18 @@ itip_send_comp (CalComponentItipMethod method, CalComponent *comp) icalproperty_set_value (prop, value); icalcomponent_add_property (icomp, prop); - clone = icalcomponent_new_clone (cal_component_get_icalcomponent (comp)); - icalcomponent_add_component (icomp, clone); + /* Strip alarms if necessary */ + clone = cal_component_clone (comp); + if (method == CAL_COMPONENT_METHOD_REPLY + || method == CAL_COMPONENT_METHOD_CANCEL + || method == CAL_COMPONENT_METHOD_REFRESH + || method == CAL_COMPONENT_METHOD_DECLINECOUNTER) + cal_component_remove_all_alarms (clone); + + iclone = cal_component_get_icalcomponent (clone); + icalcomponent_add_component (icomp, iclone); - icalcomponent_foreach_tzid (clone, foreach_tzid_callback, icomp); + icalcomponent_foreach_tzid (iclone, foreach_tzid_callback, icomp); ical_string = icalcomponent_as_ical_string (icomp); attach_data = GNOME_Evolution_Composer_AttachmentData__alloc (); |