diff options
author | 7 <jpr@ximian.com> | 2002-07-18 01:23:49 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2002-07-18 01:23:49 +0800 |
commit | 1ea6884e825cb2e30787f6f6d0c7911647473945 (patch) | |
tree | 7b31a4699adb7dae215d1eb03bef4e89f6d235c3 /calendar | |
parent | 6dee50394a99a1d1e2e95309764bfedbcd95275d (diff) | |
download | gsoc2013-evolution-1ea6884e825cb2e30787f6f6d0c7911647473945.tar.gz gsoc2013-evolution-1ea6884e825cb2e30787f6f6d0c7911647473945.tar.zst gsoc2013-evolution-1ea6884e825cb2e30787f6f6d0c7911647473945.zip |
use util function to see if the user is the organizer
2002-07-17 <jpr@ximian.com>
* gui/calendar-model.c (calendar_model_value_at): use util
function to see if the user is the organizer
* gui/dialogs/cancel-comp.c (cancel_component_dialog): add
deleting proto to indicate whether cancelling or deleting is the
primary operation
* gui/dialogs/cancel-comp.h: update proto
* gui/dialogs/comp-editor.c (delete_cmd): offer to cancel
* gui/dialogs/task-editor.c (cancel_task_cmd): call
cancel_component_dialog with new param
* gui/dialogs/event-editor.c (cancel_meeting_cmd): ditto
* gui/e-week-view.c (e_week_view_on_editing_stopped): only update
request if user is organizer
(e_week_view_show_popup_menu): disable the meeting and meeting
organizer mask if appropriate
(e_week_view_delete_event_internal): offer to cancel the meeting
(e_week_view_on_cut): ditto
(selection_received): send request if its a meeting
* gui/e-day-view.h: add meeting icon/mask
* gui/e-day-view.c (e_day_view_on_event_right_click): disable the
meeting and meeting organizer mask if appropriate
(e_day_view_delete_event_internal): offer to cancel meeting
(e_day_view_on_cut): ditto
(e_day_view_finish_long_event_resize): only update request if user
is organizer
(e_day_view_reshape_long_event): add meeting icon to count
(e_day_view_reshape_day_event): ditto
(e_day_view_on_top_canvas_drag_data_received): only update request
if user is organizer
(e_day_view_on_main_canvas_drag_data_received): ditto
(selection_received): offer to send meeting info
* gui/e-day-view-main-item.c
(e_day_view_main_item_draw_day_event): draw meeting icon if
appropriate (using dummy icon atm)
svn path=/trunk/; revision=17491
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 45 | ||||
-rw-r--r-- | calendar/gui/calendar-model.c | 18 | ||||
-rw-r--r-- | calendar/gui/dialogs/cancel-comp.c | 28 | ||||
-rw-r--r-- | calendar/gui/dialogs/cancel-comp.h | 2 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor.c | 10 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-editor.c | 2 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-editor.c | 2 | ||||
-rw-r--r-- | calendar/gui/e-day-view-main-item.c | 27 | ||||
-rw-r--r-- | calendar/gui/e-day-view.c | 68 | ||||
-rw-r--r-- | calendar/gui/e-day-view.h | 2 | ||||
-rw-r--r-- | calendar/gui/e-week-view.c | 50 |
11 files changed, 199 insertions, 55 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 795f424eba..034c01f335 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,48 @@ +2002-07-17 <jpr@ximian.com> + + * gui/calendar-model.c (calendar_model_value_at): use util + function to see if the user is the organizer + + * gui/dialogs/cancel-comp.c (cancel_component_dialog): add + deleting proto to indicate whether cancelling or deleting is the + primary operation + + * gui/dialogs/cancel-comp.h: update proto + + * gui/dialogs/comp-editor.c (delete_cmd): offer to cancel + + * gui/dialogs/task-editor.c (cancel_task_cmd): call + cancel_component_dialog with new param + + * gui/dialogs/event-editor.c (cancel_meeting_cmd): ditto + + * gui/e-week-view.c (e_week_view_on_editing_stopped): only update + request if user is organizer + (e_week_view_show_popup_menu): disable the meeting and meeting + organizer mask if appropriate + (e_week_view_delete_event_internal): offer to cancel the meeting + (e_week_view_on_cut): ditto + (selection_received): send request if its a meeting + + * gui/e-day-view.h: add meeting icon/mask + + * gui/e-day-view.c (e_day_view_on_event_right_click): disable the + meeting and meeting organizer mask if appropriate + (e_day_view_delete_event_internal): offer to cancel meeting + (e_day_view_on_cut): ditto + (e_day_view_finish_long_event_resize): only update request if user + is organizer + (e_day_view_reshape_long_event): add meeting icon to count + (e_day_view_reshape_day_event): ditto + (e_day_view_on_top_canvas_drag_data_received): only update request + if user is organizer + (e_day_view_on_main_canvas_drag_data_received): ditto + (selection_received): offer to send meeting info + + * gui/e-day-view-main-item.c + (e_day_view_main_item_draw_day_event): draw meeting icon if + appropriate (using dummy icon atm) + 2002-07-14 Rodrigo Moya <rodrigo@ximian.com> Fixes #8001 diff --git a/calendar/gui/calendar-model.c b/calendar/gui/calendar-model.c index 927b986212..55663f254c 100644 --- a/calendar/gui/calendar-model.c +++ b/calendar/gui/calendar-model.c @@ -845,21 +845,9 @@ calendar_model_value_at (ETableModel *etm, int col, int row) if (cal_component_has_recurrences (comp)) return GINT_TO_POINTER (1); - - cal_component_get_organizer (comp, &organizer); - if (organizer.value != NULL) { - GList *l; - const char *text = itip_strip_mailto (organizer.value); - - for (l = priv->addresses; l != NULL; l = l->next) { - ia = l->data; - - if (!strcmp (text, ia->address)) { - retval = 3; - goto cleanup; - } - } - } + + if (itip_organizer_is_user (comp)) + return GINT_TO_POINTER (3); cal_component_get_attendee_list (comp, &attendees); for (sl = attendees; sl != NULL; sl = sl->next) { diff --git a/calendar/gui/dialogs/cancel-comp.c b/calendar/gui/dialogs/cancel-comp.c index 92590cfa40..9156877016 100644 --- a/calendar/gui/dialogs/cancel-comp.c +++ b/calendar/gui/dialogs/cancel-comp.c @@ -42,30 +42,40 @@ * Return value: TRUE if the user clicked Yes, FALSE otherwise. **/ gboolean -cancel_component_dialog (CalComponent *comp) +cancel_component_dialog (CalComponent *comp, gboolean deleting) { GtkWidget *dialog; CalComponentVType vtype; char *str; - str = _("The meeting status has changed. Send an updated version?"); - vtype = cal_component_get_vtype (comp); switch (vtype) { case CAL_COMPONENT_EVENT: - str = g_strdup_printf (_("Are you sure you want to cancel " - "and delete this meeting?")); + if (deleting) + str = g_strdup_printf (_("The event being deleted is a meeting, " + "would you like to send a cancellation notice?")); + else + str = g_strdup_printf (_("Are you sure you want to cancel " + "and delete this meeting?")); break; case CAL_COMPONENT_TODO: - str = g_strdup_printf (_("Are you sure you want to cancel " - "and delete this task?")); + if (deleting) + str = g_strdup_printf (_("The task being deleted is assigned, " + "would you like to send a cancellation notice?")); + else + str = g_strdup_printf (_("Are you sure you want to cancel " + "and delete this task?")); break; case CAL_COMPONENT_JOURNAL: - str = g_strdup_printf (_("Are you sure you want to cancel " - "and delete this journal entry?")); + if (deleting) + str = g_strdup_printf (_("The journal entry being deleted is published, " + "would you like to send a cancellation notice?")); + else + str = g_strdup_printf (_("Are you sure you want to cancel " + "and delete this journal entry?")); break; default: diff --git a/calendar/gui/dialogs/cancel-comp.h b/calendar/gui/dialogs/cancel-comp.h index d12466ffa1..b05d6a5cab 100644 --- a/calendar/gui/dialogs/cancel-comp.h +++ b/calendar/gui/dialogs/cancel-comp.h @@ -24,6 +24,6 @@ #include <glib.h> #include <cal-util/cal-component.h> -gboolean cancel_component_dialog (CalComponent *comp); +gboolean cancel_component_dialog (CalComponent *comp, gboolean deleting); #endif diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 1179453aff..44e7f80c20 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -47,6 +47,7 @@ #include "delete-comp.h" #include "send-comp.h" #include "changed-comp.h" +#include "cancel-comp.h" #include "comp-editor.h" @@ -379,7 +380,7 @@ save_comp_with_send (CompEditor *editor) if (!save_comp (editor)) return FALSE; - if (send && send_component_dialog (priv->comp, priv->existing_org)) { + if (send && send_component_dialog (priv->comp, !priv->existing_org)) { if (itip_organizer_is_user (priv->comp)) comp_editor_send_comp (editor, CAL_COMPONENT_METHOD_REQUEST); else @@ -1232,8 +1233,13 @@ delete_cmd (GtkWidget *widget, gpointer data) vtype = cal_component_get_vtype (priv->comp); - if (delete_component_dialog (priv->comp, FALSE, 1, vtype, GTK_WIDGET (editor))) + if (delete_component_dialog (priv->comp, FALSE, 1, vtype, GTK_WIDGET (editor))) { + if (itip_organizer_is_user (priv->comp) + && cancel_component_dialog (priv->comp, TRUE)) + itip_send_comp (CAL_COMPONENT_METHOD_CANCEL, priv->comp, priv->client, NULL); + delete_comp (editor); + } } static void diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 7c020caff0..7224f6f175 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -446,7 +446,7 @@ cancel_meeting_cmd (GtkWidget *widget, gpointer data) CalComponent *comp; comp = comp_editor_get_current_comp (COMP_EDITOR (ee)); - if (cancel_component_dialog (comp)) { + if (cancel_component_dialog (comp, FALSE)) { comp_editor_send_comp (COMP_EDITOR (ee), CAL_COMPONENT_METHOD_CANCEL); comp_editor_delete_comp (COMP_EDITOR (ee)); } diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index b712e07135..7a637f34f1 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -394,7 +394,7 @@ cancel_task_cmd (GtkWidget *widget, gpointer data) CalComponent *comp; comp = comp_editor_get_current_comp (COMP_EDITOR (te)); - if (cancel_component_dialog (comp)) { + if (cancel_component_dialog (comp, FALSE)) { comp_editor_send_comp (COMP_EDITOR (te), CAL_COMPONENT_METHOD_CANCEL); comp_editor_delete_comp (COMP_EDITOR (te)); } diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c index f28e0c6a2b..201f0cbc52 100644 --- a/calendar/gui/e-day-view-main-item.c +++ b/calendar/gui/e-day-view-main-item.c @@ -478,7 +478,7 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, CalComponent *comp; gint num_icons, icon_x, icon_y, icon_x_inc, icon_y_inc; gint max_icon_w, max_icon_h; - gboolean draw_reminder_icon, draw_recurrence_icon, draw_timezone_icon; + gboolean draw_reminder_icon, draw_recurrence_icon, draw_timezone_icon, draw_meeting_icon; GSList *categories_list, *elem; CalComponentTransparency transparency; @@ -580,6 +580,7 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, draw_reminder_icon = FALSE; draw_recurrence_icon = FALSE; draw_timezone_icon = FALSE; + draw_meeting_icon = FALSE; icon_x = item_x + E_DAY_VIEW_BAR_WIDTH + E_DAY_VIEW_ICON_X_PAD; icon_y = item_y + E_DAY_VIEW_EVENT_BORDER_HEIGHT + E_DAY_VIEW_ICON_Y_PAD; @@ -602,6 +603,10 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, num_icons++; } + if (cal_component_has_organizer (comp)) { + draw_meeting_icon = TRUE; + num_icons++; + } cal_component_get_categories_list (comp, &categories_list); for (elem = categories_list; elem; elem = elem->next) { @@ -684,6 +689,26 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, icon_y += icon_y_inc; } + + if (draw_meeting_icon) { + max_icon_w = item_x + item_w - icon_x + - E_DAY_VIEW_EVENT_BORDER_WIDTH; + max_icon_h = item_y + item_h - icon_y + - E_DAY_VIEW_EVENT_BORDER_HEIGHT; + + gdk_gc_set_clip_origin (gc, icon_x, icon_y); + gdk_gc_set_clip_mask (gc, day_view->meeting_mask); + gdk_draw_pixmap (drawable, gc, + day_view->meeting_icon, + 0, 0, icon_x, icon_y, + MIN (E_DAY_VIEW_ICON_WIDTH, + max_icon_w), + MIN (E_DAY_VIEW_ICON_HEIGHT, + max_icon_h)); + icon_x += icon_x_inc; + icon_y += icon_y_inc; + } + /* draw categories icons */ for (elem = categories_list; elem; elem = elem->next) { char *category; diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 6e445dcaaf..144d82c0ad 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -53,6 +53,7 @@ #include "cal-util/timeutil.h" #include "dialogs/delete-comp.h" #include "dialogs/send-comp.h" +#include "dialogs/cancel-comp.h" #include "print.h" #include "comp-util.h" #include "itip-utils.h" @@ -1077,6 +1078,7 @@ e_day_view_realize (GtkWidget *widget) day_view->reminder_icon = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap, &day_view->reminder_mask, NULL, bell_xpm); day_view->recurrence_icon = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap, &day_view->recurrence_mask, NULL, recur_xpm); day_view->timezone_icon = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap, &day_view->timezone_mask, NULL, timezone_16_xpm); + day_view->meeting_icon = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap, &day_view->meeting_mask, NULL, timezone_16_xpm); @@ -3542,7 +3544,19 @@ enum { * in another window and we want to disable the event * from being edited twice */ - MASK_EDITING = 8 + MASK_EDITING = 8, + + /* + * This is used to when an event is already a meeting and + * we want to disable the schedule meeting command + */ + MASK_MEETING = 16, + + /* + * To disable cut and copy for meetings the user is not the + * organizer of + */ + MASK_MEETING_ORGANIZER = 32 }; static EPopupMenu main_items [] = { @@ -3592,27 +3606,27 @@ static EPopupMenu main_items [] = { static EPopupMenu child_items [] = { E_POPUP_ITEM (N_("_Open"), e_day_view_on_edit_appointment, MASK_EDITABLE | MASK_EDITING), - E_POPUP_ITEM (N_("_Save As..."), e_day_view_on_save_as, MASK_EDITABLE | MASK_EDITING), - E_POPUP_ITEM (N_("_Print..."), e_day_view_on_print_event, MASK_EDITABLE | MASK_EDITING), + E_POPUP_ITEM (N_("_Save As..."), e_day_view_on_save_as, MASK_EDITING), + E_POPUP_ITEM (N_("_Print..."), e_day_view_on_print_event, MASK_EDITING), /* Only show this separator if one of the above is shown. */ E_POPUP_SEPARATOR, - E_POPUP_ITEM (N_("C_ut"), e_day_view_on_cut, MASK_EDITABLE | MASK_EDITING), - E_POPUP_ITEM (N_("_Copy"), e_day_view_on_copy, 0), + E_POPUP_ITEM (N_("C_ut"), e_day_view_on_cut, MASK_EDITABLE | MASK_EDITING | MASK_MEETING_ORGANIZER), + E_POPUP_ITEM (N_("_Copy"), e_day_view_on_copy, MASK_EDITING | MASK_MEETING_ORGANIZER), E_POPUP_ITEM (N_("_Paste"), e_day_view_on_paste, 0), E_POPUP_SEPARATOR, - E_POPUP_ITEM (N_("_Schedule Meeting..."), e_day_view_on_meeting, MASK_EDITABLE | MASK_EDITING), - E_POPUP_ITEM (N_("_Forward as iCalendar..."), e_day_view_on_forward, MASK_EDITABLE | MASK_EDITING), + E_POPUP_ITEM (N_("_Schedule Meeting..."), e_day_view_on_meeting, MASK_EDITABLE | MASK_EDITING | MASK_MEETING), + E_POPUP_ITEM (N_("_Forward as iCalendar..."), e_day_view_on_forward, MASK_EDITING), E_POPUP_SEPARATOR, E_POPUP_ITEM (N_("_Delete"), e_day_view_on_delete_appointment, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING), - E_POPUP_ITEM (N_("Make this Occurrence _Movable"), e_day_view_on_unrecur_appointment, MASK_RECURRING | MASK_EDITING), - E_POPUP_ITEM (N_("Delete this _Occurrence"), e_day_view_on_delete_occurrence, MASK_RECURRING | MASK_EDITING), - E_POPUP_ITEM (N_("Delete _All Occurrences"), e_day_view_on_delete_appointment, MASK_RECURRING | MASK_EDITING), + E_POPUP_ITEM (N_("Make this Occurrence _Movable"), e_day_view_on_unrecur_appointment, MASK_EDITABLE | MASK_RECURRING | MASK_EDITING), + E_POPUP_ITEM (N_("Delete this _Occurrence"), e_day_view_on_delete_occurrence, MASK_EDITABLE | MASK_RECURRING | MASK_EDITING), + E_POPUP_ITEM (N_("Delete _All Occurrences"), e_day_view_on_delete_appointment, MASK_EDITABLE | MASK_RECURRING | MASK_EDITING), E_POPUP_TERMINATOR }; @@ -3673,11 +3687,18 @@ e_day_view_on_event_right_click (EDayView *day_view, hide_mask |= MASK_SINGLE; else hide_mask |= MASK_RECURRING; + + if (cal_component_has_organizer (event->comp)) { + disable_mask |= MASK_MEETING; + + if (!itip_organizer_is_user (event->comp)) + disable_mask |= MASK_MEETING_ORGANIZER; + } } if (being_edited) disable_mask |= MASK_EDITING; - + day_view->popup_event_day = day; day_view->popup_event_num = event_num; @@ -4013,6 +4034,10 @@ e_day_view_delete_event_internal (EDayView *day_view, EDayViewEvent *event) GTK_WIDGET (day_view))) { const char *uid; + if (itip_organizer_is_user (event->comp) + && cancel_component_dialog (event->comp, TRUE)) + itip_send_comp (CAL_COMPONENT_METHOD_CANCEL, event->comp, day_view->client, NULL); + cal_component_get_uid (event->comp, &uid); /* We don't check the return value; FALSE can mean the object @@ -4088,6 +4113,10 @@ e_day_view_on_cut (GtkWidget *widget, gpointer data) e_day_view_on_copy (widget, data); + if (itip_organizer_is_user (event->comp) + && cancel_component_dialog (event->comp, TRUE)) + itip_send_comp (CAL_COMPONENT_METHOD_CANCEL, event->comp, day_view->client, NULL); + cal_component_get_uid (event->comp, &uid); cal_client_remove_object (day_view->client, uid); } @@ -4713,7 +4742,7 @@ e_day_view_finish_long_event_resize (EDayView *day_view) day_view->resize_drag_pos = E_DAY_VIEW_POS_NONE; if (cal_client_update_object (day_view->client, comp) == CAL_CLIENT_RESULT_SUCCESS) { - if (cal_component_has_attendees (comp) && send_component_dialog (comp, FALSE)) + if (itip_organizer_is_user (comp) && send_component_dialog (comp, TRUE)) itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, day_view->client, NULL); } else { g_message ("e_day_view_finish_long_event_resize(): Could not update the object!"); @@ -4774,7 +4803,7 @@ e_day_view_finish_resize (EDayView *day_view) day_view->resize_drag_pos = E_DAY_VIEW_POS_NONE; if (cal_client_update_object (day_view->client, comp) == CAL_CLIENT_RESULT_SUCCESS) { - if (cal_component_has_attendees (comp) && send_component_dialog (comp, FALSE)) + if (itip_organizer_is_user (comp) && send_component_dialog (comp, FALSE)) itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, day_view->client, NULL); } else { g_message ("e_day_view_finish_resize(): Could not update the object!"); @@ -5090,6 +5119,8 @@ e_day_view_reshape_long_event (EDayView *day_view, num_icons++; if (event->different_timezone) num_icons++; + if (cal_component_has_organizer (comp)) + num_icons++; cal_component_get_categories_list (comp, &categories_list); for (elem = categories_list; elem; elem = elem->next) { @@ -5237,6 +5268,8 @@ e_day_view_reshape_day_event (EDayView *day_view, num_icons++; if (event->different_timezone) num_icons++; + if (cal_component_has_organizer (comp)) + num_icons++; cal_component_get_categories_list (comp, &categories_list); for (elem = categories_list; elem; elem = elem->next) { @@ -6133,7 +6166,7 @@ e_day_view_on_editing_stopped (EDayView *day_view, cal_component_set_summary (event->comp, &summary); if (cal_client_update_object (day_view->client, event->comp) == CAL_CLIENT_RESULT_SUCCESS) { - if (cal_component_has_attendees (event->comp) && send_component_dialog (event->comp, FALSE)) + if (itip_organizer_is_user (event->comp) && send_component_dialog (event->comp, FALSE)) itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, event->comp, day_view->client, NULL); } else { @@ -7183,7 +7216,7 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget, if (cal_client_update_object (day_view->client, comp) == CAL_CLIENT_RESULT_SUCCESS) { - if (cal_component_has_attendees (comp) && send_component_dialog (comp, FALSE)) + if (itip_organizer_is_user (comp) && send_component_dialog (comp, FALSE)) itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, day_view->client, NULL); } else { @@ -7297,7 +7330,7 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget, if (cal_client_update_object (day_view->client, comp) == CAL_CLIENT_RESULT_SUCCESS) { - if (cal_component_has_attendees (comp) && send_component_dialog (comp, FALSE)) + if (itip_organizer_is_user (comp) && send_component_dialog (comp, FALSE)) itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, day_view->client, NULL); } else { @@ -7489,6 +7522,9 @@ selection_received (GtkWidget *invisible, cal_client_update_object (day_view->client, comp); + if (itip_organizer_is_user (comp) && send_component_dialog (comp, TRUE)) + itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, day_view->client, NULL); + gtk_object_unref (GTK_OBJECT (comp)); } diff --git a/calendar/gui/e-day-view.h b/calendar/gui/e-day-view.h index 25f9181218..bb66f8b9fe 100644 --- a/calendar/gui/e-day-view.h +++ b/calendar/gui/e-day-view.h @@ -373,6 +373,8 @@ struct _EDayView GdkBitmap *recurrence_mask; GdkPixmap *timezone_icon; GdkBitmap *timezone_mask; + GdkPixmap *meeting_icon; + GdkBitmap *meeting_mask; /* Colors for drawing. */ GdkColor colors[E_DAY_VIEW_COLOR_LAST]; diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 22b4623f13..1f6768c4cb 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -53,6 +53,7 @@ #include <e-util/e-dialog-utils.h> #include "dialogs/delete-comp.h" #include "dialogs/send-comp.h" +#include "dialogs/cancel-comp.h" #include "comp-util.h" #include "itip-utils.h" #include "cal-util/timeutil.h" @@ -3225,7 +3226,7 @@ e_week_view_on_editing_stopped (EWeekView *week_view, cal_component_set_summary (event->comp, &summary); if (cal_client_update_object (week_view->client, event->comp) == CAL_CLIENT_RESULT_SUCCESS) { - if (cal_component_has_attendees (event->comp) && send_component_dialog (event->comp, FALSE)) + if (itip_organizer_is_user (event->comp) && send_component_dialog (event->comp, FALSE)) itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, event->comp, week_view->client, NULL); } else { @@ -3439,7 +3440,19 @@ enum { * in another window and we want to disable the event * from being edited twice */ - MASK_EDITING = 8 + MASK_EDITING = 8, + + /* + * This is used to when an event is already a meeting and + * we want to disable the schedule meeting command + */ + MASK_MEETING = 16, + + /* + * To disable cut and copy for meetings the user is not the + * organizer of + */ + MASK_MEETING_ORGANIZER = 32 }; static EPopupMenu main_items [] = { @@ -3477,24 +3490,24 @@ static EPopupMenu main_items [] = { static EPopupMenu child_items [] = { E_POPUP_ITEM (N_("_Open"), e_week_view_on_edit_appointment, MASK_EDITABLE | MASK_EDITING), - E_POPUP_ITEM (N_("_Save As..."), e_week_view_on_save_as, MASK_EDITABLE | MASK_EDITING), - E_POPUP_ITEM (N_("_Print..."), e_week_view_on_print_event, MASK_EDITABLE | MASK_EDITING), + E_POPUP_ITEM (N_("_Save As..."), e_week_view_on_save_as, MASK_EDITING), + E_POPUP_ITEM (N_("_Print..."), e_week_view_on_print_event, MASK_EDITING), /* Only show this separator if one of the above is shown. */ E_POPUP_SEPARATOR, - E_POPUP_ITEM (N_("C_ut"), e_week_view_on_cut, MASK_EDITING | MASK_EDITABLE), - E_POPUP_ITEM (N_("_Copy"), e_week_view_on_copy, MASK_EDITING | MASK_EDITABLE), + E_POPUP_ITEM (N_("C_ut"), e_week_view_on_cut, MASK_EDITING | MASK_EDITABLE | MASK_MEETING_ORGANIZER), + E_POPUP_ITEM (N_("_Copy"), e_week_view_on_copy, MASK_EDITING | MASK_MEETING_ORGANIZER), E_POPUP_ITEM (N_("_Paste"), e_week_view_on_paste, 0), E_POPUP_SEPARATOR, - E_POPUP_ITEM (N_("_Schedule Meeting..."), e_week_view_on_meeting, MASK_EDITABLE | MASK_EDITING), - E_POPUP_ITEM (N_("_Forward as iCalendar..."), e_week_view_on_forward, MASK_EDITABLE | MASK_EDITING), + E_POPUP_ITEM (N_("_Schedule Meeting..."), e_week_view_on_meeting, MASK_EDITABLE | MASK_EDITING | MASK_MEETING), + E_POPUP_ITEM (N_("_Forward as iCalendar..."), e_week_view_on_forward, MASK_EDITING), E_POPUP_SEPARATOR, - E_POPUP_ITEM (N_("_Delete this Appointment"), e_week_view_on_delete_appointment, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING), + E_POPUP_ITEM (N_("_Delete"), e_week_view_on_delete_appointment, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING), E_POPUP_ITEM (N_("Make this Occurrence _Movable"), e_week_view_on_unrecur_appointment, MASK_RECURRING | MASK_EDITING), E_POPUP_ITEM (N_("Delete this _Occurrence"), e_week_view_on_delete_occurrence, MASK_RECURRING | MASK_EDITING), E_POPUP_ITEM (N_("Delete _All Occurrences"), e_week_view_on_delete_appointment, MASK_RECURRING | MASK_EDITING), @@ -3544,10 +3557,18 @@ e_week_view_show_popup_menu (EWeekView *week_view, context_menu = child_items; event = &g_array_index (week_view->events, EWeekViewEvent, event_num); + if (cal_component_has_recurrences (event->comp)) hide_mask |= MASK_SINGLE; else hide_mask |= MASK_RECURRING; + + if (cal_component_has_organizer (event->comp)) { + disable_mask |= MASK_MEETING; + + if (!itip_organizer_is_user (event->comp)) + disable_mask |= MASK_MEETING_ORGANIZER; + } } if (being_edited) @@ -3900,6 +3921,10 @@ e_week_view_delete_event_internal (EWeekView *week_view, gint event_num) GTK_WIDGET (week_view))) { const char *uid; + if (itip_organizer_is_user (event->comp) + && cancel_component_dialog (event->comp, TRUE)) + itip_send_comp (CAL_COMPONENT_METHOD_CANCEL, event->comp, week_view->client, NULL); + cal_component_get_uid (event->comp, &uid); /* We don't check the return value; FALSE can mean the object @@ -3955,6 +3980,10 @@ e_week_view_on_cut (GtkWidget *widget, gpointer data) event = &g_array_index (week_view->events, EWeekViewEvent, week_view->popup_event_num); + if (itip_organizer_is_user (event->comp) + && cancel_component_dialog (event->comp, TRUE)) + itip_send_comp (CAL_COMPONENT_METHOD_CANCEL, event->comp, week_view->client, NULL); + cal_component_get_uid (event->comp, &uid); cal_client_remove_object (week_view->client, uid); } @@ -4285,6 +4314,9 @@ selection_received (GtkWidget *invisible, cal_client_update_object (week_view->client, comp); + if (itip_organizer_is_user (comp) && send_component_dialog (comp, TRUE)) + itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, week_view->client, NULL); + g_free (uid); gtk_object_unref (GTK_OBJECT (comp)); } |