From b280d814d60baee0a3fb9f6885f1a0c4b9553606 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Thu, 13 Sep 2001 19:06:15 +0000 Subject: use ical partstat, role, cutypes directly 2001-09-13 JP Rosevear * cal-util/cal-component.h: use ical partstat, role, cutypes directly * cal-util/cal-component.c: ditto * gui/e-itip-control.c (find_my_address): set my addresses if the addresses match (find_attendee): strstr returns non-null on a match (write_html): use new icon, select the name displayed (organizer or attendee) based on method, (ok_clicked_cb): when rsvp'ing strip off all but the attendee being replied for as is specified in the spec (find_attendee_partstat): new util function to extract the partstat of an attendee (update_attendee_status): updates the partstat of a specific attendee in the reply message * gui/dialogs/meeting-page.c: use ical partstat, role, cutypes directly (popup_delegate_cb): if we delegate, notify of needs send and changed (popup_delete_cb): notify of needs send and changed for each deletion svn path=/trunk/; revision=12806 --- calendar/ChangeLog | 26 +++++ calendar/cal-util/cal-component.c | 141 ++--------------------- calendar/cal-util/cal-component.h | 35 +----- calendar/gui/dialogs/meeting-page.c | 99 +++++++++-------- calendar/gui/e-itip-control.c | 215 +++++++++++++++++++++++++++++------- 5 files changed, 268 insertions(+), 248 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 551a977439..848f678a5b 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,29 @@ +2001-09-13 JP Rosevear + + * cal-util/cal-component.h: use ical partstat, role, cutypes + directly + + * cal-util/cal-component.c: ditto + + * gui/e-itip-control.c (find_my_address): set my addresses if the + addresses match + (find_attendee): strstr returns non-null on a match + (write_html): use new icon, select the name displayed (organizer + or attendee) based on method, + (ok_clicked_cb): when rsvp'ing strip off all but the attendee + being replied for as is specified in the spec + (find_attendee_partstat): new util function to extract the + partstat of an attendee + (update_attendee_status): updates the partstat of a specific + attendee in the reply message + + * gui/dialogs/meeting-page.c: use ical partstat, role, cutypes + directly + (popup_delegate_cb): if we delegate, notify of needs send and + changed + (popup_delete_cb): notify of needs send and changed for each + deletion + 2001-09-12 JP Rosevear * gui/calendar-commands.c (publish_freebusy_cmd): send 6 weeks of diff --git a/calendar/cal-util/cal-component.c b/calendar/cal-util/cal-component.c index d74c1238b2..7ef6f9e477 100644 --- a/calendar/cal-util/cal-component.c +++ b/calendar/cal-util/cal-component.c @@ -3587,78 +3587,17 @@ get_attendee_list (GSList *attendee_list, GSList **al) a->value = icalproperty_get_attendee (attendee->prop); if (attendee->member_param) - a->member = icalparameter_get_member (attendee->member_param); - if (attendee->cutype_param) { - switch (icalparameter_get_cutype (attendee->cutype_param)) { - case ICAL_CUTYPE_INDIVIDUAL: - a->cutype = CAL_COMPONENT_CUTYPE_INDIVIDUAL; - break; - case ICAL_CUTYPE_GROUP: - a->cutype = CAL_COMPONENT_CUTYPE_GROUP; - break; - case ICAL_CUTYPE_RESOURCE: - a->cutype = CAL_COMPONENT_CUTYPE_RESOURCE; - break; - case ICAL_CUTYPE_ROOM: - a->cutype = CAL_COMPONENT_CUTYPE_ROOM; - break; - default: - a->cutype = CAL_COMPONENT_CUTYPE_UNKNOWN; - } - } - - if (attendee->role_param) { - switch (icalparameter_get_role (attendee->role_param)) { - case ICAL_ROLE_CHAIR: - a->role = CAL_COMPONENT_ROLE_CHAIR; - break; - case ICAL_ROLE_REQPARTICIPANT: - a->role = CAL_COMPONENT_ROLE_REQUIRED; - break; - case ICAL_ROLE_OPTPARTICIPANT: - a->role = CAL_COMPONENT_ROLE_OPTIONAL; - break; - case ICAL_ROLE_NONPARTICIPANT: - a->role = CAL_COMPONENT_ROLE_NON; - break; - default: - a->role = CAL_COMPONENT_ROLE_UNKNOWN; - } - } - - if (attendee->partstat_param) { - switch (icalparameter_get_role (attendee->partstat_param)) { - case ICAL_PARTSTAT_NEEDSACTION: - a->status = CAL_COMPONENT_PARTSTAT_NEEDSACTION; - break; - case ICAL_PARTSTAT_ACCEPTED: - a->status = CAL_COMPONENT_PARTSTAT_ACCEPTED; - break; - case ICAL_PARTSTAT_DECLINED: - a->status = CAL_COMPONENT_PARTSTAT_DECLINED; - break; - case ICAL_PARTSTAT_TENTATIVE: - a->status = CAL_COMPONENT_PARTSTAT_TENTATIVE; - break; - case ICAL_PARTSTAT_DELEGATED: - a->status = CAL_COMPONENT_PARTSTAT_DELEGATED; - break; - case ICAL_PARTSTAT_COMPLETED: - a->status = CAL_COMPONENT_PARTSTAT_COMPLETED; - break; - case ICAL_PARTSTAT_INPROCESS: - a->status = CAL_COMPONENT_PARTSTAT_INPROCESS; - break; - default: - a->status = CAL_COMPONENT_PARTSTAT_UNKNOWN; - } - } - + a->member = icalparameter_get_member (attendee->member_param); + if (attendee->cutype_param) + a->cutype = icalparameter_get_cutype (attendee->cutype_param); + if (attendee->role_param) + a->role = icalparameter_get_role (attendee->role_param); + if (attendee->partstat_param) + a->status = icalparameter_get_role (attendee->partstat_param); if (attendee->rsvp_param && icalparameter_get_rsvp (attendee->rsvp_param) == ICAL_RSVP_TRUE) a->rsvp = TRUE; else a->rsvp = FALSE; - if (attendee->delfrom_param) a->delfrom = icalparameter_get_sentby (attendee->delfrom_param); if (attendee->delto_param) @@ -3709,9 +3648,6 @@ set_attendee_list (CalComponent *comp, for (l = al; l; l = l->next) { CalComponentAttendee *a; struct attendee *attendee; - icalparameter_cutype ct; - icalparameter_role r; - icalparameter_partstat p; a = l->data; g_return_if_fail (a->value != NULL); @@ -3726,70 +3662,13 @@ set_attendee_list (CalComponent *comp, icalproperty_add_parameter (attendee->prop, attendee->member_param); } - switch (a->cutype) { - case CAL_COMPONENT_CUTYPE_INDIVIDUAL: - ct = ICAL_CUTYPE_INDIVIDUAL; - break; - case CAL_COMPONENT_CUTYPE_GROUP: - ct = ICAL_CUTYPE_GROUP; - break; - case CAL_COMPONENT_CUTYPE_RESOURCE: - ct = ICAL_CUTYPE_RESOURCE; - break; - case CAL_COMPONENT_CUTYPE_ROOM: - ct = ICAL_CUTYPE_ROOM; - break; - default: - ct = ICAL_CUTYPE_UNKNOWN; - } - attendee->cutype_param = icalparameter_new_cutype (ct); + attendee->cutype_param = icalparameter_new_cutype (a->cutype); icalproperty_add_parameter (attendee->prop, attendee->cutype_param); - switch (a->role) { - case CAL_COMPONENT_ROLE_CHAIR: - r = ICAL_ROLE_CHAIR; - break; - case CAL_COMPONENT_ROLE_REQUIRED: - r = ICAL_ROLE_REQPARTICIPANT; - break; - case CAL_COMPONENT_ROLE_OPTIONAL: - r = ICAL_ROLE_OPTPARTICIPANT; - break; - case CAL_COMPONENT_ROLE_NON: - r = ICAL_ROLE_NONPARTICIPANT; - break; - default: - r = ICAL_ROLE_NONE; - } - attendee->role_param = icalparameter_new_role (r); + attendee->role_param = icalparameter_new_role (a->role); icalproperty_add_parameter (attendee->prop, attendee->role_param); - switch (a->status) { - case CAL_COMPONENT_PARTSTAT_NEEDSACTION: - p = ICAL_PARTSTAT_NEEDSACTION; - break; - case CAL_COMPONENT_PARTSTAT_ACCEPTED: - p = ICAL_PARTSTAT_ACCEPTED; - break; - case CAL_COMPONENT_PARTSTAT_DECLINED: - p = ICAL_PARTSTAT_DECLINED; - break; - case CAL_COMPONENT_PARTSTAT_TENTATIVE: - p = ICAL_PARTSTAT_TENTATIVE; - break; - case CAL_COMPONENT_PARTSTAT_DELEGATED: - p = ICAL_PARTSTAT_DELEGATED; - break; - case CAL_COMPONENT_PARTSTAT_COMPLETED: - p = ICAL_PARTSTAT_COMPLETED; - break; - case CAL_COMPONENT_PARTSTAT_INPROCESS: - p = ICAL_PARTSTAT_INPROCESS; - break; - default: - p = ICAL_PARTSTAT_NONE; - } - attendee->partstat_param = icalparameter_new_partstat (p); + attendee->partstat_param = icalparameter_new_partstat (a->status); icalproperty_add_parameter (attendee->prop, attendee->partstat_param); if (a->rsvp) diff --git a/calendar/cal-util/cal-component.h b/calendar/cal-util/cal-component.h index ef38483c68..1ab8ee24bd 100644 --- a/calendar/cal-util/cal-component.h +++ b/calendar/cal-util/cal-component.h @@ -150,41 +150,14 @@ typedef enum { CAL_COMPONENT_TRANSP_UNKNOWN } CalComponentTransparency; -/* Organizer & Attendee */ -typedef enum { - CAL_COMPONENT_CUTYPE_INDIVIDUAL, - CAL_COMPONENT_CUTYPE_GROUP, - CAL_COMPONENT_CUTYPE_RESOURCE, - CAL_COMPONENT_CUTYPE_ROOM, - CAL_COMPONENT_CUTYPE_UNKNOWN -} CalComponentCUType; - -typedef enum { - CAL_COMPONENT_ROLE_CHAIR, - CAL_COMPONENT_ROLE_REQUIRED, - CAL_COMPONENT_ROLE_OPTIONAL, - CAL_COMPONENT_ROLE_NON, - CAL_COMPONENT_ROLE_UNKNOWN -} CalComponentRole; - -typedef enum { - CAL_COMPONENT_PARTSTAT_NEEDSACTION, - CAL_COMPONENT_PARTSTAT_ACCEPTED, - CAL_COMPONENT_PARTSTAT_DECLINED, - CAL_COMPONENT_PARTSTAT_TENTATIVE, - CAL_COMPONENT_PARTSTAT_DELEGATED, - CAL_COMPONENT_PARTSTAT_COMPLETED, - CAL_COMPONENT_PARTSTAT_INPROCESS, - CAL_COMPONENT_PARTSTAT_UNKNOWN -} CalComponentPartStat; - +/* Organizer & Attendee */ typedef struct { const char *value; const char *member; - CalComponentCUType cutype; - CalComponentRole role; - CalComponentPartStat status; + icalparameter_cutype cutype; + icalparameter_role role; + icalparameter_partstat status; gboolean rsvp; const char *delto; diff --git a/calendar/gui/dialogs/meeting-page.c b/calendar/gui/dialogs/meeting-page.c index b02efe4735..55ca96975c 100644 --- a/calendar/gui/dialogs/meeting-page.c +++ b/calendar/gui/dialogs/meeting-page.c @@ -78,9 +78,9 @@ struct attendee { char *address; char *member; - CalComponentCUType cutype; - CalComponentRole role; - CalComponentPartStat status; + icalparameter_cutype cutype; + icalparameter_role role; + icalparameter_partstat status; gboolean rsvp; char *delto; @@ -562,32 +562,32 @@ get_widgets (MeetingPage *mpage) } -static CalComponentCUType +static icalparameter_cutype text_to_type (const char *type) { if (!g_strcasecmp (type, _("Individual"))) - return CAL_COMPONENT_CUTYPE_INDIVIDUAL; + return ICAL_CUTYPE_INDIVIDUAL; else if (!g_strcasecmp (type, _("Group"))) - return CAL_COMPONENT_CUTYPE_GROUP; + return ICAL_CUTYPE_GROUP; else if (!g_strcasecmp (type, _("Resource"))) - return CAL_COMPONENT_CUTYPE_RESOURCE; + return ICAL_CUTYPE_RESOURCE; else if (!g_strcasecmp (type, _("Room"))) - return CAL_COMPONENT_CUTYPE_ROOM; + return ICAL_CUTYPE_ROOM; else - return CAL_COMPONENT_ROLE_UNKNOWN; + return ICAL_CUTYPE_NONE; } static char * -type_to_text (CalComponentCUType type) +type_to_text (icalparameter_cutype type) { switch (type) { - case CAL_COMPONENT_CUTYPE_INDIVIDUAL: + case ICAL_CUTYPE_INDIVIDUAL: return _("Individual"); - case CAL_COMPONENT_CUTYPE_GROUP: + case ICAL_CUTYPE_GROUP: return _("Group"); - case CAL_COMPONENT_CUTYPE_RESOURCE: + case ICAL_CUTYPE_RESOURCE: return _("Resource"); - case CAL_COMPONENT_CUTYPE_ROOM: + case ICAL_CUTYPE_ROOM: return _("Room"); default: return _("Unknown"); @@ -597,32 +597,32 @@ type_to_text (CalComponentCUType type) } -static CalComponentRole +static icalparameter_role text_to_role (const char *role) { if (!g_strcasecmp (role, _("Chair"))) - return CAL_COMPONENT_ROLE_CHAIR; + return ICAL_ROLE_CHAIR; else if (!g_strcasecmp (role, _("Required Participant"))) - return CAL_COMPONENT_ROLE_REQUIRED; + return ICAL_ROLE_REQPARTICIPANT; else if (!g_strcasecmp (role, _("Optional Participant"))) - return CAL_COMPONENT_ROLE_OPTIONAL; + return ICAL_ROLE_OPTPARTICIPANT; else if (!g_strcasecmp (role, _("Non-Participant"))) - return CAL_COMPONENT_ROLE_NON; + return ICAL_ROLE_NONPARTICIPANT; else - return CAL_COMPONENT_ROLE_UNKNOWN; + return ICAL_ROLE_NONE; } static char * -role_to_text (CalComponentRole role) +role_to_text (icalparameter_role role) { switch (role) { - case CAL_COMPONENT_ROLE_CHAIR: + case ICAL_ROLE_CHAIR: return _("Chair"); - case CAL_COMPONENT_ROLE_REQUIRED: + case ICAL_ROLE_REQPARTICIPANT: return _("Required Participant"); - case CAL_COMPONENT_ROLE_OPTIONAL: + case ICAL_ROLE_OPTPARTICIPANT: return _("Optional Participant"); - case CAL_COMPONENT_ROLE_NON: + case ICAL_ROLE_NONPARTICIPANT: return _("Non-Participant"); default: return _("Unknown"); @@ -649,46 +649,45 @@ boolean_to_text (gboolean b) return _("No"); } -static CalComponentPartStat +static icalparameter_partstat text_to_partstat (const char *partstat) { if (!g_strcasecmp (partstat, _("Needs Action"))) - return CAL_COMPONENT_PARTSTAT_NEEDSACTION; + return ICAL_PARTSTAT_NEEDSACTION; else if (!g_strcasecmp (partstat, _("Accepted"))) - return CAL_COMPONENT_PARTSTAT_ACCEPTED; + return ICAL_PARTSTAT_ACCEPTED; else if (!g_strcasecmp (partstat, _("Declined"))) - return CAL_COMPONENT_PARTSTAT_DECLINED; + return ICAL_PARTSTAT_DECLINED; else if (!g_strcasecmp (partstat, _("Tentative"))) - return CAL_COMPONENT_PARTSTAT_TENTATIVE; + return ICAL_PARTSTAT_TENTATIVE; else if (!g_strcasecmp (partstat, _("Delegated"))) - return CAL_COMPONENT_PARTSTAT_DELEGATED; + return ICAL_PARTSTAT_DELEGATED; else if (!g_strcasecmp (partstat, _("Completed"))) - return CAL_COMPONENT_PARTSTAT_COMPLETED; + return ICAL_PARTSTAT_COMPLETED; else if (!g_strcasecmp (partstat, _("In Process"))) - return CAL_COMPONENT_PARTSTAT_INPROCESS; + return ICAL_PARTSTAT_INPROCESS; else - return CAL_COMPONENT_PARTSTAT_UNKNOWN; + return ICAL_PARTSTAT_NONE; } static char * -partstat_to_text (CalComponentPartStat partstat) +partstat_to_text (icalparameter_partstat partstat) { switch (partstat) { - case CAL_COMPONENT_PARTSTAT_NEEDSACTION: + case ICAL_PARTSTAT_NEEDSACTION: return _("Needs Action"); - case CAL_COMPONENT_PARTSTAT_ACCEPTED: + case ICAL_PARTSTAT_ACCEPTED: return _("Accepted"); - case CAL_COMPONENT_PARTSTAT_DECLINED: + case ICAL_PARTSTAT_DECLINED: return _("Declined"); - case CAL_COMPONENT_PARTSTAT_TENTATIVE: + case ICAL_PARTSTAT_TENTATIVE: return _("Tentative"); - case CAL_COMPONENT_PARTSTAT_DELEGATED: + case ICAL_PARTSTAT_DELEGATED: return _("Delegated"); - case CAL_COMPONENT_PARTSTAT_COMPLETED: + case ICAL_PARTSTAT_COMPLETED: return _("Completed"); - case CAL_COMPONENT_PARTSTAT_INPROCESS: + case ICAL_PARTSTAT_INPROCESS: return _("In Process"); - case CAL_COMPONENT_PARTSTAT_UNKNOWN: default: return _("Unknown"); } @@ -778,13 +777,13 @@ invite_entry_changed (BonoboListener *listener, g_free (str); if (!strcmp (section, _("Chair Persons"))) - a->role = CAL_COMPONENT_ROLE_CHAIR; + a->role = ICAL_ROLE_CHAIR; else if (!strcmp (section, _("Required Participants"))) - a->role = CAL_COMPONENT_ROLE_REQUIRED; + a->role = ICAL_ROLE_REQPARTICIPANT; else if (!strcmp (section, _("Optional Participants"))) - a->role = CAL_COMPONENT_ROLE_OPTIONAL; + a->role = ICAL_ROLE_OPTPARTICIPANT; else if (!strcmp (section, _("Non-Participants"))) - a->role = CAL_COMPONENT_ROLE_NON; + a->role = ICAL_ROLE_NONPARTICIPANT; str = init_value (NULL, MEETING_RSVP_COL, mpage); a->rsvp = text_to_boolean (str); @@ -1417,6 +1416,9 @@ popup_delegate_cb (GtkWidget *widget, gpointer data) row_cnt = row_count (priv->model, mpage) - 1; e_table_model_row_changed (priv->model, priv->row); e_table_model_row_inserted (priv->model, row_cnt); + + comp_editor_page_notify_needs_send (COMP_EDITOR_PAGE (mpage)); + comp_editor_page_notify_changed (COMP_EDITOR_PAGE (mpage)); } cleanup: @@ -1462,6 +1464,9 @@ popup_delete_cb (GtkWidget *widget, gpointer data) e_table_model_row_deleted (priv->model, pos); + comp_editor_page_notify_needs_send (COMP_EDITOR_PAGE (mpage)); + comp_editor_page_notify_changed (COMP_EDITOR_PAGE (mpage)); + if (a->delto != NULL) b = find_match (mpage, a->delto, &pos); a = b; diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c index 88745ff654..1d54fb6a01 100644 --- a/calendar/gui/e-itip-control.c +++ b/calendar/gui/e-itip-control.c @@ -98,7 +98,7 @@ struct _EItipControlPrivate { " #define REPLY_OPTIONS "
Choose an action:    \ +    \
" #define REFRESH_OPTIONS "
Choose an action: