aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/itip-formatter/ChangeLog16
-rw-r--r--plugins/itip-formatter/itip-formatter.c71
-rw-r--r--plugins/itip-formatter/itip-view.c119
-rw-r--r--plugins/itip-formatter/itip-view.h5
4 files changed, 202 insertions, 9 deletions
diff --git a/plugins/itip-formatter/ChangeLog b/plugins/itip-formatter/ChangeLog
index ea5c47085f..6ea39362b1 100644
--- a/plugins/itip-formatter/ChangeLog
+++ b/plugins/itip-formatter/ChangeLog
@@ -1,5 +1,21 @@
2005-01-07 JP Rosevear <jpr@novell.com>
+ * itip-view.h: new protos
+
+ * itip-view.c (set_tasklist_sender_text): task sender messages
+ (set_calendar_sender_text): calendar sender messages
+ (set_sender_text): select above as appropriate
+ (itip_view_set_item_type): accessor
+ (itip_view_get_item_type): ditto
+
+ * itip-formatter.c (find_cal_opened_cb): messages for
+ meetings/tasks/journals
+ (send_item): ditto
+ (format_itip_object): ditto
+ (itip_formatter_page_factory): change page title
+
+2005-01-07 JP Rosevear <jpr@novell.com>
+
* itip-formatter.c (view_response_cb): ensure there is only one
attendee in the RSVP even if the user is duplicated
diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c
index 03c9b9689a..96c2f9ce00 100644
--- a/plugins/itip-formatter/itip-formatter.c
+++ b/plugins/itip-formatter/itip-formatter.c
@@ -382,7 +382,7 @@ find_cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data)
/* If the query fails, we'll just ignore it */
/* FIXME Limit the calendars checked for conflicts? */
/* FIXME What happens for recurring conflicts? */
- if (e_cal_get_object_list (ecal, fd->sexp, &objects, NULL) && g_list_length (objects) > 0) {
+ if (pitip->type == E_CAL_SOURCE_TYPE_EVENT && e_cal_get_object_list (ecal, fd->sexp, &objects, NULL) && g_list_length (objects) > 0) {
itip_view_add_upper_info_item_printf (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_WARNING,
"An appointment in the calendar '%s' conflicts with this meeting", e_source_peek_name (source));
@@ -465,8 +465,23 @@ find_cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data)
itip_view_set_buttons_sensitive (ITIP_VIEW (pitip->view), FALSE);
}
} else if (!pitip->current_ecal) {
- itip_view_add_lower_info_item_printf (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_WARNING,
- "Unable to find this meeting in any calendar");
+ switch (pitip->type) {
+ case E_CAL_SOURCE_TYPE_EVENT:
+ itip_view_add_lower_info_item_printf (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_WARNING,
+ "Unable to find this meeting in any calendar");
+ break;
+ case E_CAL_SOURCE_TYPE_TODO:
+ itip_view_add_lower_info_item_printf (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_WARNING,
+ "Unable to find this task in any task list");
+ break;
+ case E_CAL_SOURCE_TYPE_JOURNAL:
+ itip_view_add_lower_info_item_printf (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_WARNING,
+ "Unable to find this journal entry in any journal");
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
+ }
}
g_free (fd->uid);
@@ -763,9 +778,35 @@ send_item (FormatItipPObject *pitip)
itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp, pitip->current_ecal, NULL);
g_object_unref (comp);
- itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO, "Meeting information sent");
+ switch (pitip->type) {
+ case E_CAL_SOURCE_TYPE_EVENT:
+ itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO, "Meeting information sent");
+ break;
+ case E_CAL_SOURCE_TYPE_TODO:
+ itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO, "Task information sent");
+ break;
+ case E_CAL_SOURCE_TYPE_JOURNAL:
+ itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO, "Journal entry information sent");
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
+ }
} else {
- itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_ERROR, "Unable to send meeting information, the meeting does not exist");
+ switch (pitip->type) {
+ case E_CAL_SOURCE_TYPE_EVENT:
+ itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_ERROR, "Unable to send meeting information, the meeting does not exist");
+ break;
+ case E_CAL_SOURCE_TYPE_TODO:
+ itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_ERROR, "Unable to send task information, the task does not exist");
+ break;
+ case E_CAL_SOURCE_TYPE_JOURNAL:
+ itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_ERROR, "Unable to send journal entry information, the journal entry does not exist");
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
+ }
}
}
@@ -1060,6 +1101,8 @@ format_itip_object (EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject
itip_view_set_mode (ITIP_VIEW (pitip->view), ITIP_VIEW_MODE_ERROR);
}
+ itip_view_set_item_type (ITIP_VIEW (pitip->view), pitip->type);
+
switch (pitip->method) {
case ICAL_METHOD_PUBLISH:
case ICAL_METHOD_REQUEST:
@@ -1202,7 +1245,21 @@ format_itip_object (EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject
/* Recurrence info */
/* FIXME Better recurring description */
if (e_cal_component_has_recurrences (pitip->comp)) {
- itip_view_add_upper_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO, "This meeting recurs");
+ /* FIXME Tell the user we don't support recurring tasks */
+ switch (pitip->type) {
+ case E_CAL_SOURCE_TYPE_EVENT:
+ itip_view_add_upper_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO, "This meeting recurs");
+ break;
+ case E_CAL_SOURCE_TYPE_TODO:
+ itip_view_add_upper_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO, "This task recurs");
+ break;
+ case E_CAL_SOURCE_TYPE_JOURNAL:
+ itip_view_add_upper_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO, "This journal recurs");
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
+ }
}
gtk_container_add (GTK_CONTAINER (eb), pitip->view);
@@ -1298,7 +1355,7 @@ itip_formatter_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data)
/* Create a new notebook page */
page = gtk_vbox_new (FALSE, 0);
GTK_CONTAINER (page)->border_width = 12;
- tab_label = gtk_label_new (_("Meetings"));
+ tab_label = gtk_label_new (_("Meetings and Tasks"));
gtk_notebook_append_page (GTK_NOTEBOOK (hook_data->parent), page, tab_label);
/* Frame */
diff --git a/plugins/itip-formatter/itip-view.c b/plugins/itip-formatter/itip-view.c
index 455325db15..0ab931b0b4 100644
--- a/plugins/itip-formatter/itip-view.c
+++ b/plugins/itip-formatter/itip-view.c
@@ -59,6 +59,7 @@ typedef struct {
struct _ItipViewPrivate {
ItipViewMode mode;
+ ECalSourceType type;
GtkWidget *sender_label;
char *organizer;
@@ -273,7 +274,7 @@ format_date_and_time_x (struct tm *date_tm,
}
static void
-set_sender_text (ItipView *view)
+set_calendar_sender_text (ItipView *view)
{
ItipViewPrivate *priv;
const char *organizer, *attendee;
@@ -341,6 +342,93 @@ set_sender_text (ItipView *view)
}
static void
+set_tasklist_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 task:"), organizer, priv->sentby);
+ else
+ sender = g_strdup_printf (_("<b>%s</b> has published the following task:"), organizer);
+ break;
+ case ITIP_VIEW_MODE_REQUEST:
+ /* FIXME is the delegator stuff handled correctly here? */
+ if (priv->delegator) {
+ sender = g_strdup_printf (_("<b>%s</b> requests the assignment of %s to the following task:"), organizer, priv->delegator);
+ } else {
+ if (priv->sentby)
+ sender = g_strdup_printf (_("<b>%s</b> through %s has assigned you a task:"), organizer, priv->sentby);
+ else
+ sender = g_strdup_printf (_("<b>%s</b> has assigned you a task:"), 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 task:"), organizer, priv->sentby);
+ else
+ sender = g_strdup_printf (_("<b>%s</b> wishes to add to an existing task:"), organizer);
+ break;
+ case ITIP_VIEW_MODE_REFRESH:
+ sender = g_strdup_printf (_("<b>%s</b> wishes to receive the latest information for the following assigned task:"), attendee);
+ break;
+ case ITIP_VIEW_MODE_REPLY:
+ sender = g_strdup_printf (_("<b>%s</b> has sent back the following assigned task response:"), attendee);
+ break;
+ case ITIP_VIEW_MODE_CANCEL:
+ if (priv->sentby)
+ sender = g_strdup_printf (_("<b>%s</b> through %s has cancelled the following assigned task:"), organizer, priv->sentby);
+ else
+ sender = g_strdup_printf (_("<b>%s</b> has cancelled the following assigned task:"), organizer);
+ break;
+ case ITIP_VIEW_MODE_COUNTER:
+ sender = g_strdup_printf (_("<b>%s</b> has proposed the following task assignment changes:"), attendee);
+ break;
+ case ITIP_VIEW_MODE_DECLINECOUNTER:
+ if (priv->sentby)
+ sender = g_strdup_printf (_("<b>%s</b> through %s has declined the following assigned task:"), organizer, priv->sentby);
+ else
+ sender = g_strdup_printf (_("<b>%s</b> has declined the following assigned task:"), 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;
+
+ priv = view->priv;
+
+ switch (priv->type) {
+ case E_CAL_SOURCE_TYPE_EVENT:
+ set_calendar_sender_text (view);
+ break;
+ case E_CAL_SOURCE_TYPE_TODO:
+ set_tasklist_sender_text (view);
+ break;
+ default:
+ break;
+ }
+}
+
+static void
set_summary_text (ItipView *view)
{
ItipViewPrivate *priv;
@@ -863,6 +951,35 @@ itip_view_get_mode (ItipView *view)
}
void
+itip_view_set_item_type (ItipView *view, ECalSourceType type)
+{
+ ItipViewPrivate *priv;
+
+ g_return_if_fail (view != NULL);
+ g_return_if_fail (ITIP_IS_VIEW (view));
+
+ priv = view->priv;
+
+ priv->type = type;
+
+ set_sender_text (view);
+}
+
+ECalSourceType
+itip_view_get_item_type (ItipView *view)
+{
+ ItipViewPrivate *priv;
+
+ g_return_val_if_fail (view != NULL, ITIP_VIEW_MODE_NONE);
+ g_return_val_if_fail (ITIP_IS_VIEW (view), ITIP_VIEW_MODE_NONE);
+
+ priv = view->priv;
+
+ return priv->type;
+}
+
+
+void
itip_view_set_organizer (ItipView *view, const char *organizer)
{
ItipViewPrivate *priv;
diff --git a/plugins/itip-formatter/itip-view.h b/plugins/itip-formatter/itip-view.h
index b2a12a5ad0..7e7b782e91 100644
--- a/plugins/itip-formatter/itip-view.h
+++ b/plugins/itip-formatter/itip-view.h
@@ -28,6 +28,7 @@
#include <glib-object.h>
#include <gtk/gtkhbox.h>
#include <libedataserver/e-source-list.h>
+#include <libecal/e-cal.h>
G_BEGIN_DECLS
@@ -74,7 +75,6 @@ typedef enum {
ITIP_VIEW_INFO_ITEM_TYPE_PROGRESS
} ItipViewInfoItemType;
-
struct _ItipView {
GtkHBox parent_instance;
@@ -96,6 +96,9 @@ GtkWidget *itip_view_new (void);
void itip_view_set_mode (ItipView *view, ItipViewMode mode);
ItipViewMode itip_view_get_mode (ItipView *view);
+void itip_view_set_item_type (ItipView *view, ECalSourceType type);
+ECalSourceType itip_view_get_item_type (ItipView *view);
+
void itip_view_set_organizer (ItipView *view, const char *organizer);
const char *itip_view_get_organizer (ItipView *view);