aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/itip-formatter
diff options
context:
space:
mode:
authorChenthill Palanisamy <pchen@src.gnome.org>2006-07-22 16:57:41 +0800
committerChenthill Palanisamy <pchen@src.gnome.org>2006-07-22 16:57:41 +0800
commit17e5226c6092aa230a72058ac56a2a9a13e1c7cb (patch)
treeb046ae1ceec87e33fdf4a24913accef1b66224a4 /plugins/itip-formatter
parentb01b92ad9c0fd771bb1b24daf619ea17d5e624cb (diff)
downloadgsoc2013-evolution-17e5226c6092aa230a72058ac56a2a9a13e1c7cb.tar
gsoc2013-evolution-17e5226c6092aa230a72058ac56a2a9a13e1c7cb.tar.gz
gsoc2013-evolution-17e5226c6092aa230a72058ac56a2a9a13e1c7cb.tar.bz2
gsoc2013-evolution-17e5226c6092aa230a72058ac56a2a9a13e1c7cb.tar.lz
gsoc2013-evolution-17e5226c6092aa230a72058ac56a2a9a13e1c7cb.tar.xz
gsoc2013-evolution-17e5226c6092aa230a72058ac56a2a9a13e1c7cb.tar.zst
gsoc2013-evolution-17e5226c6092aa230a72058ac56a2a9a13e1c7cb.zip
Added support for shared notes.
svn path=/trunk/; revision=32373
Diffstat (limited to 'plugins/itip-formatter')
-rw-r--r--plugins/itip-formatter/ChangeLog10
-rw-r--r--plugins/itip-formatter/itip-formatter.c176
-rw-r--r--plugins/itip-formatter/itip-view.c77
-rw-r--r--plugins/itip-formatter/itip-view.h1
4 files changed, 186 insertions, 78 deletions
diff --git a/plugins/itip-formatter/ChangeLog b/plugins/itip-formatter/ChangeLog
index c21aa01c87..02e5e196fa 100644
--- a/plugins/itip-formatter/ChangeLog
+++ b/plugins/itip-formatter/ChangeLog
@@ -1,3 +1,13 @@
+2006-07-22 Chenthill Palanisamy <pchenthill@novell.com>
+
+ * itip-formatter.c: (cal_opened_cb), (source_selected_cb),
+ (find_cal_opened_cb), (extract_itip_data), (view_response_cb),
+ (format_itip_object):
+ * itip-view.c: (set_journal_sender_text), (set_sender_text),
+ (set_buttons), (itip_view_set_source_list),
+ (itip_view_get_rsvp_comment), (itip_view_set_needs_decline):
+ * itip-view.h: Added support shared Memos.
+
2006-07-06 Harish Krishnaswamy <kharish@novell.com>
* itip-formatter.c: (format_itip_object):
diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c
index ee813f43b7..c563eb00c0 100644
--- a/plugins/itip-formatter/itip-formatter.c
+++ b/plugins/itip-formatter/itip-formatter.c
@@ -292,7 +292,14 @@ cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data)
itip_view_set_show_recur_check (ITIP_VIEW (pitip->view), FALSE);
}
-
+ if (pitip->type == E_CAL_SOURCE_TYPE_JOURNAL) {
+ if (e_cal_get_static_capability (ecal, CAL_STATIC_CAPABILITY_HAS_UNACCEPTED_MEETING))
+ itip_view_set_needs_decline (ITIP_VIEW (pitip->view), TRUE);
+ else
+ itip_view_set_needs_decline (ITIP_VIEW (pitip->view), FALSE);
+ itip_view_set_mode (ITIP_VIEW (pitip->view), ITIP_VIEW_MODE_PUBLISH);
+ }
+
pitip->current_ecal = ecal;
set_buttons_sensitive (pitip);
@@ -355,20 +362,6 @@ source_selected_cb (ItipView *view, ESource *source, gpointer data)
itip_view_set_buttons_sensitive (ITIP_VIEW (pitip->view), FALSE);
start_calendar_server (pitip, source, pitip->type, cal_opened_cb, pitip);
-
- /* If it is a GW recurrence instance, enable the 'Apply to all
- * instances' option */
- if (pitip->current_ecal && e_cal_get_static_capability (pitip->current_ecal, CAL_STATIC_CAPABILITY_RECURRENCES_NO_MASTER)) {
- icalcomponent *icalcomp = e_cal_component_get_icalcomponent (pitip->comp);
-
- if (check_is_instance (icalcomp))
- itip_view_set_show_recur_check (ITIP_VIEW (pitip->view), TRUE);
- else
- itip_view_set_show_recur_check (ITIP_VIEW (pitip->view), FALSE);
- } else
- itip_view_set_show_recur_check (ITIP_VIEW (pitip->view), FALSE);
-
-
}
static void
@@ -446,13 +439,25 @@ find_cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data)
set_buttons_sensitive (pitip);
}
- if (pitip->current_ecal && e_cal_get_static_capability (pitip->current_ecal, CAL_STATIC_CAPABILITY_RECURRENCES_NO_MASTER)) {
- icalcomponent *icalcomp = e_cal_component_get_icalcomponent (pitip->comp);
+ if (pitip->current_ecal) {
+ if (e_cal_get_static_capability (pitip->current_ecal, CAL_STATIC_CAPABILITY_RECURRENCES_NO_MASTER)) {
+ icalcomponent *icalcomp = e_cal_component_get_icalcomponent (pitip->comp);
- if (check_is_instance (icalcomp))
- itip_view_set_show_recur_check (ITIP_VIEW (pitip->view), TRUE);
- else
- itip_view_set_show_recur_check (ITIP_VIEW (pitip->view), FALSE);
+ if (check_is_instance (icalcomp))
+ itip_view_set_show_recur_check (ITIP_VIEW (pitip->view), TRUE);
+ else
+ itip_view_set_show_recur_check (ITIP_VIEW (pitip->view), FALSE);
+ }
+
+ if (pitip->type == E_CAL_SOURCE_TYPE_JOURNAL) {
+ /* TODO The static capability should be made generic to convey that the calendar contains unaccepted items */
+ if (e_cal_get_static_capability (pitip->current_ecal, CAL_STATIC_CAPABILITY_HAS_UNACCEPTED_MEETING))
+ itip_view_set_needs_decline (ITIP_VIEW (pitip->view), TRUE);
+ else
+ itip_view_set_needs_decline (ITIP_VIEW (pitip->view), FALSE);
+
+ itip_view_set_mode (ITIP_VIEW (pitip->view), ITIP_VIEW_MODE_PUBLISH);
+ }
}
cleanup:
@@ -475,6 +480,9 @@ find_cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data)
case E_CAL_SOURCE_TYPE_TODO:
uid = calendar_config_get_primary_tasks ();
break;
+ case E_CAL_SOURCE_TYPE_JOURNAL:
+ uid = calendar_config_get_primary_memos ();
+ break;
default:
uid = NULL;
g_assert_not_reached ();
@@ -1241,7 +1249,8 @@ extract_itip_data (FormatItipPObject *pitip, GtkContainer *container)
kind = icalcomponent_isa (pitip->ical_comp);
if (kind != ICAL_VEVENT_COMPONENT
&& kind != ICAL_VTODO_COMPONENT
- && kind != ICAL_VFREEBUSY_COMPONENT)
+ && kind != ICAL_VFREEBUSY_COMPONENT
+ && kind != ICAL_VJOURNAL_COMPONENT)
pitip->ical_comp = get_next (&pitip->iter);
}
@@ -1260,6 +1269,9 @@ extract_itip_data (FormatItipPObject *pitip, GtkContainer *container)
case ICAL_VTODO_COMPONENT:
pitip->type = E_CAL_SOURCE_TYPE_TODO;
break;
+ case ICAL_VJOURNAL_COMPONENT:
+ pitip->type = E_CAL_SOURCE_TYPE_JOURNAL;
+ break;
default:
set_itip_error (pitip, container,
_("The item in the calendar is not valid"),
@@ -1270,6 +1282,7 @@ extract_itip_data (FormatItipPObject *pitip, GtkContainer *container)
pitip->total = icalcomponent_count_components (pitip->main_comp, ICAL_VEVENT_COMPONENT);
pitip->total += icalcomponent_count_components (pitip->main_comp, ICAL_VTODO_COMPONENT);
pitip->total += icalcomponent_count_components (pitip->main_comp, ICAL_VFREEBUSY_COMPONENT);
+ pitip->total += icalcomponent_count_components (pitip->main_comp, ICAL_VJOURNAL_COMPONENT);
if (pitip->total > 1) {
set_itip_error (pitip, container,
@@ -1283,53 +1296,54 @@ extract_itip_data (FormatItipPObject *pitip, GtkContainer *container)
pitip->current = 0;
}
-
- comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (pitip->ical_comp));
- my_address = itip_get_comp_attendee (comp, NULL);
- g_object_unref (comp);
- comp = NULL;
-
- prop = find_attendee (pitip->ical_comp, my_address);
+ if (icalcomponent_isa (pitip->ical_comp) != ICAL_VJOURNAL_COMPONENT) {
+ comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (pitip->ical_comp));
+ my_address = itip_get_comp_attendee (comp, NULL);
+ g_object_unref (comp);
+ comp = NULL;
- if (prop) {
- icalparameter *param;
- const char * delfrom;
+ prop = find_attendee (pitip->ical_comp, my_address);
+
+ if (prop) {
+ icalparameter *param;
+ const char * delfrom;
+
+ if ((param =icalproperty_get_first_parameter (prop, ICAL_DELEGATEDFROM_PARAMETER))) {
+ delfrom = icalparameter_get_delegatedfrom (param);
- if ((param =icalproperty_get_first_parameter (prop, ICAL_DELEGATEDFROM_PARAMETER))) {
- delfrom = icalparameter_get_delegatedfrom (param);
+ pitip->delegator_address = g_strdup (itip_strip_mailto (delfrom));
+ }
- pitip->delegator_address = g_strdup (itip_strip_mailto (delfrom));
}
-
- }
- /* Determine any delegate sections */
- prop = icalcomponent_get_first_property (pitip->ical_comp, ICAL_X_PROPERTY);
- while (prop) {
- const char *x_name, *x_val;
+ /* Determine any delegate sections */
+ prop = icalcomponent_get_first_property (pitip->ical_comp, ICAL_X_PROPERTY);
+ while (prop) {
+ const char *x_name, *x_val;
- x_name = icalproperty_get_x_name (prop);
- x_val = icalproperty_get_x (prop);
+ x_name = icalproperty_get_x_name (prop);
+ x_val = icalproperty_get_x (prop);
- if (!strcmp (x_name, "X-EVOLUTION-DELEGATOR-CALENDAR-UID"))
- pitip->calendar_uid = g_strdup (x_val);
- else if (!strcmp (x_name, "X-EVOLUTION-DELEGATOR-CALENDAR-URI"))
- g_warning (G_STRLOC ": X-EVOLUTION-DELEGATOR-CALENDAR-URI used");
- else if (!strcmp (x_name, "X-EVOLUTION-DELEGATOR-ADDRESS"))
- pitip->delegator_address = g_strdup (x_val);
- else if (!strcmp (x_name, "X-EVOLUTION-DELEGATOR-NAME"))
- pitip->delegator_name = g_strdup (x_val);
+ if (!strcmp (x_name, "X-EVOLUTION-DELEGATOR-CALENDAR-UID"))
+ pitip->calendar_uid = g_strdup (x_val);
+ else if (!strcmp (x_name, "X-EVOLUTION-DELEGATOR-CALENDAR-URI"))
+ g_warning (G_STRLOC ": X-EVOLUTION-DELEGATOR-CALENDAR-URI used");
+ else if (!strcmp (x_name, "X-EVOLUTION-DELEGATOR-ADDRESS"))
+ pitip->delegator_address = g_strdup (x_val);
+ else if (!strcmp (x_name, "X-EVOLUTION-DELEGATOR-NAME"))
+ pitip->delegator_name = g_strdup (x_val);
- prop = icalcomponent_get_next_property (pitip->ical_comp, ICAL_X_PROPERTY);
- }
+ prop = icalcomponent_get_next_property (pitip->ical_comp, ICAL_X_PROPERTY);
+ }
- /* Strip out alarms for security purposes */
- alarm_iter = icalcomponent_begin_component (pitip->ical_comp, ICAL_VALARM_COMPONENT);
- while ((alarm_comp = icalcompiter_deref (&alarm_iter)) != NULL) {
- icalcomponent_remove_component (pitip->ical_comp, alarm_comp);
-
- icalcompiter_next (&alarm_iter);
+ /* Strip out alarms for security purposes */
+ alarm_iter = icalcomponent_begin_component (pitip->ical_comp, ICAL_VALARM_COMPONENT);
+ while ((alarm_comp = icalcompiter_deref (&alarm_iter)) != NULL) {
+ icalcomponent_remove_component (pitip->ical_comp, alarm_comp);
+
+ icalcompiter_next (&alarm_iter);
+ }
}
pitip->comp = e_cal_component_new ();
@@ -1364,17 +1378,17 @@ extract_itip_data (FormatItipPObject *pitip, GtkContainer *container)
trigger.u.rel_duration.is_neg = TRUE;
switch (units) {
- case CAL_MINUTES:
- trigger.u.rel_duration.minutes = interval;
- break;
- case CAL_HOURS:
- trigger.u.rel_duration.hours = interval;
- break;
- case CAL_DAYS:
- trigger.u.rel_duration.days = interval;
- break;
- default:
- g_assert_not_reached ();
+ case CAL_MINUTES:
+ trigger.u.rel_duration.minutes = interval;
+ break;
+ case CAL_HOURS:
+ trigger.u.rel_duration.hours = interval;
+ break;
+ case CAL_DAYS:
+ trigger.u.rel_duration.days = interval;
+ break;
+ default:
+ g_assert_not_reached ();
}
e_cal_component_alarm_set_trigger (acomp, trigger);
@@ -1431,8 +1445,11 @@ view_response_cb (GtkWidget *widget, ItipViewResponse response, gpointer data)
switch (response) {
case ITIP_VIEW_RESPONSE_ACCEPT:
- status = change_status (pitip->ical_comp, pitip->my_address,
+ if (pitip->type != E_CAL_SOURCE_TYPE_JOURNAL)
+ status = change_status (pitip->ical_comp, pitip->my_address,
ICAL_PARTSTAT_ACCEPTED);
+ else
+ status = TRUE;
if (status) {
e_cal_component_rescan (pitip->comp);
update_item (pitip, response);
@@ -1452,8 +1469,16 @@ view_response_cb (GtkWidget *widget, ItipViewResponse response, gpointer data)
}
break;
case ITIP_VIEW_RESPONSE_DECLINE:
- status = change_status (pitip->ical_comp, pitip->my_address,
+ if (pitip->type != E_CAL_SOURCE_TYPE_JOURNAL)
+ status = change_status (pitip->ical_comp, pitip->my_address,
ICAL_PARTSTAT_DECLINED);
+ else {
+ prop = icalproperty_new_x ("1");
+ icalproperty_set_x_name (prop, "X-GW-DECLINED");
+ icalcomponent_add_property (pitip->ical_comp, prop);
+ status = TRUE;
+ }
+
if (status) {
e_cal_component_rescan (pitip->comp);
update_item (pitip, response);
@@ -1599,7 +1624,7 @@ format_itip_object (EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject
GString *gstring = NULL;
GSList *list, *l;
icalcomponent *icalcomp;
- const char *string;
+ const char *string, *org;
int i;
/* Accounts */
@@ -1673,7 +1698,8 @@ format_itip_object (EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject
/* An organizer sent this */
e_cal_component_get_organizer (pitip->comp, &organizer);
- itip_view_set_organizer (ITIP_VIEW (pitip->view), organizer.cn ? organizer.cn : itip_strip_mailto (organizer.value));
+ org = organizer.cn ? organizer.cn : itip_strip_mailto (organizer.value);
+ itip_view_set_organizer (ITIP_VIEW (pitip->view), org);
/* FIXME, do i need to strip the sentby somehow? Maybe with camel? */
itip_view_set_sentby (ITIP_VIEW (pitip->view), organizer.sentby);
diff --git a/plugins/itip-formatter/itip-view.c b/plugins/itip-formatter/itip-view.c
index 8e272ad52b..64cb01f1ef 100644
--- a/plugins/itip-formatter/itip-view.c
+++ b/plugins/itip-formatter/itip-view.c
@@ -123,6 +123,8 @@ struct _ItipViewPrivate {
GtkWidget *button_box;
gboolean buttons_sensitive;
+
+ gboolean needs_decline;
};
/* Signal IDs */
@@ -463,6 +465,49 @@ set_tasklist_sender_text (ItipView *view)
}
static void
+set_journal_sender_text (ItipView *view)
+{
+ ItipViewPrivate *priv;
+ const char *organizer, *attendee;
+ char *sender = NULL;
+
+ priv = view->priv;
+
+ organizer = priv->organizer ? priv->organizer : _("An unknown person");
+ attendee = priv->attendee ? priv->attendee : _("An unknown person");
+
+ switch (priv->mode) {
+ case ITIP_VIEW_MODE_PUBLISH:
+ if (priv->sentby)
+ sender = g_strdup_printf (_("<b>%s</b> through %s has published the following memo:"), organizer, priv->sentby);
+ else
+ sender = g_strdup_printf (_("<b>%s</b> has published the following memo:"), organizer);
+ break;
+ case ITIP_VIEW_MODE_ADD:
+ /* FIXME What text for this? */
+ if (priv->sentby)
+ sender = g_strdup_printf (_("<b>%s</b> through %s wishes to add to an existing memo:"), organizer, priv->sentby);
+ else
+ sender = g_strdup_printf (_("<b>%s</b> wishes to add to an existing memo:"), organizer);
+ break;
+ case ITIP_VIEW_MODE_CANCEL:
+ if (priv->sentby)
+ sender = g_strdup_printf (_("<b>%s</b> through %s has canceled the following shared memo:"), organizer, priv->sentby);
+ else
+ sender = g_strdup_printf (_("<b>%s</b> has canceled the following shared memo:"), organizer);
+ break;
+ default:
+ break;
+ }
+
+ gtk_label_set_text (GTK_LABEL (priv->sender_label), sender);
+ gtk_label_set_use_markup (GTK_LABEL (priv->sender_label), TRUE);
+
+ g_free (sender);
+}
+
+
+static void
set_sender_text (ItipView *view)
{
ItipViewPrivate *priv;
@@ -476,6 +521,9 @@ set_sender_text (ItipView *view)
case E_CAL_SOURCE_TYPE_TODO:
set_tasklist_sender_text (view);
break;
+ case E_CAL_SOURCE_TYPE_JOURNAL:
+ set_journal_sender_text (view);
+ break;
default:
break;
}
@@ -707,6 +755,8 @@ set_buttons (ItipView *view)
switch (priv->mode) {
case ITIP_VIEW_MODE_PUBLISH:
/* FIXME Is this really the right button? */
+ if (priv->needs_decline)
+ set_one_button (view, _("_Decline"), GTK_STOCK_CANCEL, ITIP_VIEW_RESPONSE_DECLINE);
set_one_button (view, _("_Accept"), GTK_STOCK_APPLY, ITIP_VIEW_RESPONSE_ACCEPT);
break;
case ITIP_VIEW_MODE_REQUEST:
@@ -715,8 +765,10 @@ set_buttons (ItipView *view)
set_one_button (view, is_recur_set ? _("_Accept all") : _("_Accept"), GTK_STOCK_APPLY, ITIP_VIEW_RESPONSE_ACCEPT);
break;
case ITIP_VIEW_MODE_ADD:
- set_one_button (view, _("_Decline"), GTK_STOCK_CANCEL, ITIP_VIEW_RESPONSE_DECLINE);
- set_one_button (view, _("_Tentative"), GTK_STOCK_DIALOG_QUESTION, ITIP_VIEW_RESPONSE_TENTATIVE);
+ if (priv->type != E_CAL_SOURCE_TYPE_JOURNAL) {
+ set_one_button (view, _("_Decline"), GTK_STOCK_CANCEL, ITIP_VIEW_RESPONSE_DECLINE);
+ set_one_button (view, _("_Tentative"), GTK_STOCK_DIALOG_QUESTION, ITIP_VIEW_RESPONSE_TENTATIVE);
+ }
set_one_button (view, _("_Accept"), GTK_STOCK_APPLY, ITIP_VIEW_RESPONSE_ACCEPT);
break;
case ITIP_VIEW_MODE_REFRESH:
@@ -1651,7 +1703,13 @@ itip_view_set_source_list (ItipView *view, ESourceList *source_list)
g_signal_connect (priv->esom, "source_selected", G_CALLBACK (source_selected_cb), view);
if (!priv->esom_header) {
- priv->esom_header = gtk_label_new_with_mnemonic (_("_Calendar:"));
+ if (priv->type == E_CAL_SOURCE_TYPE_EVENT)
+ priv->esom_header = gtk_label_new_with_mnemonic (_("_Calendar:"));
+ else if (priv->type == E_CAL_SOURCE_TYPE_TODO)
+ priv->esom_header = gtk_label_new_with_mnemonic (_("_Tasks :"));
+ else if (priv->type == E_CAL_SOURCE_TYPE_JOURNAL)
+ priv->esom_header = gtk_label_new_with_mnemonic (_("Memos :"));
+
gtk_label_set_mnemonic_widget (GTK_LABEL (priv->esom_header), priv->esom);
gtk_widget_show (priv->esom_header);
}
@@ -1843,6 +1901,19 @@ itip_view_get_rsvp_comment (ItipView *view)
}
void
+itip_view_set_needs_decline (ItipView *view, gboolean needs_decline)
+{
+ ItipViewPrivate *priv;
+
+ g_return_if_fail (view != NULL);
+ g_return_if_fail (ITIP_IS_VIEW (view));
+
+ priv = view->priv;
+
+ priv->needs_decline = needs_decline;
+}
+
+void
itip_view_set_buttons_sensitive (ItipView *view, gboolean sensitive)
{
ItipViewPrivate *priv;
diff --git a/plugins/itip-formatter/itip-view.h b/plugins/itip-formatter/itip-view.h
index 4e47594270..9d12f6c65b 100644
--- a/plugins/itip-formatter/itip-view.h
+++ b/plugins/itip-formatter/itip-view.h
@@ -168,6 +168,7 @@ gboolean itip_view_get_buttons_sensitive (ItipView *view);
void itip_view_set_show_recur_check (ItipView *view, gboolean show);
gboolean itip_view_get_recur_check_state (ItipView *view);
+void itip_view_set_needs_decline (ItipView *view, gboolean needs_decline);
G_END_DECLS