evolution r37097 - in trunk: calendar calendar/gui calendar/gui/dialogs plugins/itip-formatter
- From: mcrha svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution r37097 - in trunk: calendar calendar/gui calendar/gui/dialogs plugins/itip-formatter
- Date: Mon, 19 Jan 2009 13:56:42 +0000 (UTC)
Author: mcrha
Date: Mon Jan 19 13:56:42 2009
New Revision: 37097
URL: http://svn.gnome.org/viewvc/evolution?rev=37097&view=rev
Log:
2009-01-19 Milan Crha <mcrha redhat com>
** Fix for bug #225712
* calendar/gui/dialogs/comp-editor.h: (CompEditorClass::send_comp),
(comp_editor_send_comp): Changed function prototypes.
* calendar/gui/dialogs/comp-editor.c: (real_send_comp), (save_comp_with_send),
(comp_editor_send_comp): Strip alarms based on user's choice.
* calendar/gui/dialogs/send-comp.h: (send_component_dialog):
* calendar/gui/dialogs/send-comp.c: (have_nonprocedural_alarm),
(send_component_dialog): Show option "Send my alarms with this event"
when prompting to send event or not, but only if have any non-procedure
alarms and if it the caller want to know user's opinion. Default is
to strip all alarms. Procedure alarms are always strip out.
* calendar/gui/dialogs/event-editor.c: (event_editor_send_comp):
* calendar/gui/dialogs/task-editor.c: (task_editor_send_comp):
Honor function prototype changes and use new parameter strip_alarms.
* calendar/gui/itip-utils.h: (itip_send_comp):
* calendar/gui/itip-utils.c: (comp_compliant), (itip_send_comp),
(reply_to_calendar_comp):
New parameter to strip all alarms or only procedure alarms.
* calendar/gui/tasks-control.c: (tasks_control_forward_cmd):
* calendar/gui/e-itip-control.c: (send_item), (send_freebusy), (ok_clicked_cb):
* calendar/gui/e-calendar-table.c: (e_calendar_table_on_forward):
* calendar/gui/e-memo-table.c: (e_memo_table_on_forward):
* calendar/gui/e-calendar-view.c: (e_calendar_view_cut_clipboard),
(delete_event), (e_calendar_view_delete_selected_occurrence),
(on_forward):
Always strip alarms when sending component.
* calendar/gui/e-calendar-view.c: (e_calendar_view_add_event),
(e_calendar_view_modify_and_send):
* calendar/gui/e-cal-model-calendar.c: (ecmc_set_value_at):
Strip alarms based on user's choice.
* plugins/itip-formatter/itip-view.h:
* plugins/itip-formatter/itip-view.c: (itip_view_set_show_keep_alarm_check),
(itip_view_get_keep_alarm_check_state),
(itip_view_set_show_inherit_alarm_check),
(itip_view_get_inherit_alarm_check_state): New functions to new
options to either inherit reminder from the incoming event or to
preserve users reminders in already existing event in the calendar.
* plugins/itip-formatter/itip-view.c: (struct _ItipViewPrivate), (alarm_check_toggled_cb),
(itip_view_init): Properly initialize new option's members.
* plugins/itip-formatter/itip-formatter.c: (find_cal_opened_cb), (update_item),
(send_comp_to_attendee), (update_attendee_status), (send_item),
(extract_itip_data), (view_response_cb), (format_itip_object):
Setup new options based on the actual data.
Modified:
trunk/calendar/ChangeLog
trunk/calendar/gui/dialogs/comp-editor.c
trunk/calendar/gui/dialogs/comp-editor.h
trunk/calendar/gui/dialogs/event-editor.c
trunk/calendar/gui/dialogs/send-comp.c
trunk/calendar/gui/dialogs/send-comp.h
trunk/calendar/gui/dialogs/task-editor.c
trunk/calendar/gui/e-cal-model-calendar.c
trunk/calendar/gui/e-calendar-table.c
trunk/calendar/gui/e-calendar-view.c
trunk/calendar/gui/e-itip-control.c
trunk/calendar/gui/e-memo-table.c
trunk/calendar/gui/itip-utils.c
trunk/calendar/gui/itip-utils.h
trunk/calendar/gui/tasks-control.c
trunk/plugins/itip-formatter/ChangeLog
trunk/plugins/itip-formatter/itip-formatter.c
trunk/plugins/itip-formatter/itip-view.c
trunk/plugins/itip-formatter/itip-view.h
Modified: trunk/calendar/gui/dialogs/comp-editor.c
==============================================================================
--- trunk/calendar/gui/dialogs/comp-editor.c (original)
+++ trunk/calendar/gui/dialogs/comp-editor.c Mon Jan 19 13:56:42 2009
@@ -172,7 +172,7 @@
static void setup_widgets (CompEditor *editor);
static void real_edit_comp (CompEditor *editor, ECalComponent *comp);
-static gboolean real_send_comp (CompEditor *editor, ECalComponentItipMethod method);
+static gboolean real_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboolean strip_alarms);
static gboolean prompt_and_save_changes (CompEditor *editor, gboolean send);
static void close_dialog (CompEditor *editor);
@@ -888,6 +888,7 @@
CompEditorFlags flags;
gboolean send;
gboolean delegate;
+ gboolean strip_alarms = TRUE;
priv = editor->priv;
@@ -907,18 +908,18 @@
if (!save_comp (editor))
return FALSE;
- if ((delegate && !e_cal_get_save_schedules (priv->client)) || (send && send_component_dialog ((GtkWindow *) editor, priv->client, priv->comp, !priv->existing_org))) {
+ if ((delegate && !e_cal_get_save_schedules (priv->client)) || (send && send_component_dialog ((GtkWindow *) editor, priv->client, priv->comp, !priv->existing_org, &strip_alarms))) {
if ((itip_organizer_is_user (priv->comp, priv->client) || itip_sentby_is_user (priv->comp))) {
if (e_cal_component_get_vtype (priv->comp) == E_CAL_COMPONENT_JOURNAL)
- return comp_editor_send_comp (editor, E_CAL_COMPONENT_METHOD_PUBLISH);
+ return comp_editor_send_comp (editor, E_CAL_COMPONENT_METHOD_PUBLISH, strip_alarms);
else
- return comp_editor_send_comp (editor, E_CAL_COMPONENT_METHOD_REQUEST);
+ return comp_editor_send_comp (editor, E_CAL_COMPONENT_METHOD_REQUEST, strip_alarms);
} else {
- if (!comp_editor_send_comp (editor, E_CAL_COMPONENT_METHOD_REQUEST))
+ if (!comp_editor_send_comp (editor, E_CAL_COMPONENT_METHOD_REQUEST, strip_alarms))
return FALSE;
if (delegate)
- return comp_editor_send_comp (editor, E_CAL_COMPONENT_METHOD_REPLY);
+ return comp_editor_send_comp (editor, E_CAL_COMPONENT_METHOD_REPLY, strip_alarms);
}
}
@@ -3045,7 +3046,7 @@
}
static gboolean
-real_send_comp (CompEditor *editor, ECalComponentItipMethod method)
+real_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboolean strip_alarms)
{
CompEditorPrivate *priv;
CompEditorFlags flags;
@@ -3091,7 +3092,7 @@
if (!e_cal_component_has_attachments (priv->comp)
|| e_cal_get_static_capability (priv->client, CAL_STATIC_CAPABILITY_CREATE_MESSAGES)) {
if (itip_send_comp (method, send_comp, priv->client,
- NULL, NULL, users)) {
+ NULL, NULL, users, strip_alarms)) {
g_object_unref (send_comp);
return TRUE;
}
@@ -3112,7 +3113,7 @@
/* mime_attach_list is freed by itip_send_comp */
mime_attach_list = comp_editor_get_mime_attach_list (editor);
if (itip_send_comp (method, send_comp, priv->client,
- NULL, mime_attach_list, users)) {
+ NULL, mime_attach_list, users, strip_alarms)) {
save_comp (editor);
g_object_unref (send_comp);
return TRUE;
@@ -3234,7 +3235,7 @@
*
**/
gboolean
-comp_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method)
+comp_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboolean strip_alarms)
{
CompEditorClass *class;
@@ -3243,7 +3244,7 @@
class = COMP_EDITOR_GET_CLASS (editor);
if (class->send_comp)
- return class->send_comp (editor, method);
+ return class->send_comp (editor, method, strip_alarms);
return FALSE;
}
Modified: trunk/calendar/gui/dialogs/comp-editor.h
==============================================================================
--- trunk/calendar/gui/dialogs/comp-editor.h (original)
+++ trunk/calendar/gui/dialogs/comp-editor.h Mon Jan 19 13:56:42 2009
@@ -67,7 +67,7 @@
/* Virtual functions */
void (*edit_comp) (CompEditor *page, ECalComponent *comp);
void (*object_created) (CompEditor *page);
- gboolean (*send_comp) (CompEditor *page, ECalComponentItipMethod method);
+ gboolean (*send_comp) (CompEditor *page, ECalComponentItipMethod method, gboolean strip_alarms);
void (*show_categories) (CompEditor *editor, gboolean visible);
void (*show_role) (CompEditor *editor, gboolean visible);
@@ -129,7 +129,8 @@
gboolean send);
void comp_editor_delete_comp (CompEditor *editor);
gboolean comp_editor_send_comp (CompEditor *editor,
- ECalComponentItipMethod method);
+ ECalComponentItipMethod method,
+ gboolean strip_alarms);
GSList * comp_editor_get_mime_attach_list(CompEditor *editor);
gboolean comp_editor_close (CompEditor *editor);
Modified: trunk/calendar/gui/dialogs/event-editor.c
==============================================================================
--- trunk/calendar/gui/dialogs/event-editor.c (original)
+++ trunk/calendar/gui/dialogs/event-editor.c Mon Jan 19 13:56:42 2009
@@ -99,7 +99,7 @@
"</ui>";
static void event_editor_edit_comp (CompEditor *editor, ECalComponent *comp);
-static gboolean event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method);
+static gboolean event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboolean strip_alarms);
G_DEFINE_TYPE (EventEditor, event_editor, TYPE_COMP_EDITOR)
@@ -620,7 +620,7 @@
}
static gboolean
-event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method)
+event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboolean strip_alarms)
{
EventEditorPrivate *priv;
ECalComponent *comp = NULL;
@@ -639,7 +639,7 @@
client = e_meeting_store_get_e_cal (priv->model);
result = itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp,
- client, NULL, NULL, NULL);
+ client, NULL, NULL, NULL, strip_alarms);
g_object_unref (comp);
return result;
@@ -647,7 +647,7 @@
parent:
if (COMP_EDITOR_CLASS (event_editor_parent_class)->send_comp)
- return COMP_EDITOR_CLASS (event_editor_parent_class)->send_comp (editor, method);
+ return COMP_EDITOR_CLASS (event_editor_parent_class)->send_comp (editor, method, strip_alarms);
return FALSE;
}
Modified: trunk/calendar/gui/dialogs/send-comp.c
==============================================================================
--- trunk/calendar/gui/dialogs/send-comp.c (original)
+++ trunk/calendar/gui/dialogs/send-comp.c Mon Jan 19 13:56:42 2009
@@ -26,11 +26,44 @@
#include <config.h>
#endif
+#include <glib/gi18n-lib.h>
#include "e-util/e-error.h"
#include "send-comp.h"
+static gboolean
+have_nonprocedural_alarm (ECalComponent *comp)
+{
+ GList *uids, *l;
+
+ g_return_val_if_fail (comp != NULL, FALSE);
+
+ uids = e_cal_component_get_alarm_uids (comp);
+
+ for (l = uids; l; l = l->next) {
+ ECalComponentAlarm *alarm;
+ ECalComponentAlarmAction action = E_CAL_COMPONENT_ALARM_UNKNOWN;
+
+ alarm = e_cal_component_get_alarm (comp, (const char *)l->data);
+ if (alarm) {
+ e_cal_component_alarm_get_action (alarm, &action);
+ e_cal_component_alarm_free (alarm);
+
+ if (action != E_CAL_COMPONENT_ALARM_NONE &&
+ action != E_CAL_COMPONENT_ALARM_PROCEDURE &&
+ action != E_CAL_COMPONENT_ALARM_UNKNOWN) {
+ cal_obj_uid_list_free (uids);
+ return TRUE;
+ }
+ }
+ }
+
+ cal_obj_uid_list_free (uids);
+
+ return FALSE;
+}
+
/**
* send_component_dialog:
*
@@ -40,11 +73,14 @@
* Return value: TRUE if the user clicked Yes, FALSE otherwise.
**/
gboolean
-send_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gboolean new)
+send_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gboolean new, gboolean *strip_alarms)
{
ECalComponentVType vtype;
const char *id;
+ if (strip_alarms)
+ *strip_alarms = TRUE;
+
if (e_cal_get_save_schedules (client))
return FALSE;
@@ -72,10 +108,32 @@
return FALSE;
}
- if (e_error_run (parent, id, NULL) == GTK_RESPONSE_YES)
- return TRUE;
- else
- return FALSE;
+ if (strip_alarms && have_nonprocedural_alarm (comp)) {
+ GtkWidget *dialog, *checkbox, *align;
+ gboolean res;
+
+ dialog = e_error_new (parent, id, NULL);
+ checkbox = gtk_check_button_new_with_label (_("Send my alarms with this event"));
+ align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
+ gtk_container_add (GTK_CONTAINER (align), checkbox);
+ gtk_widget_show (checkbox);
+ gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dialog)->vbox), align, TRUE, TRUE, 6);
+ gtk_widget_show (align);
+
+ res = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES;
+
+ if (res)
+ *strip_alarms = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox));
+
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+
+ return res;
+ } else {
+ if (e_error_run (parent, id, NULL) == GTK_RESPONSE_YES)
+ return TRUE;
+ else
+ return FALSE;
+ }
}
gboolean
Modified: trunk/calendar/gui/dialogs/send-comp.h
==============================================================================
--- trunk/calendar/gui/dialogs/send-comp.h (original)
+++ trunk/calendar/gui/dialogs/send-comp.h Mon Jan 19 13:56:42 2009
@@ -28,7 +28,7 @@
#include <libecal/e-cal.h>
#include <libecal/e-cal-component.h>
-gboolean send_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gboolean new);
+gboolean send_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gboolean new, gboolean *strip_alarms);
gboolean send_component_prompt_subject (GtkWindow *parent, ECal *client, ECalComponent *comp);
#endif
Modified: trunk/calendar/gui/dialogs/task-editor.c
==============================================================================
--- trunk/calendar/gui/dialogs/task-editor.c (original)
+++ trunk/calendar/gui/dialogs/task-editor.c Mon Jan 19 13:56:42 2009
@@ -88,7 +88,7 @@
"</ui>";
static void task_editor_edit_comp (CompEditor *editor, ECalComponent *comp);
-static gboolean task_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method);
+static gboolean task_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboolean strip_alarms);
G_DEFINE_TYPE (TaskEditor, task_editor, TYPE_COMP_EDITOR)
@@ -446,7 +446,7 @@
}
static gboolean
-task_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method)
+task_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboolean strip_alarms)
{
TaskEditorPrivate *priv;
ECalComponent *comp = NULL;
@@ -465,7 +465,7 @@
client = e_meeting_store_get_e_cal (priv->model);
result = itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp,
- client, NULL, NULL, NULL);
+ client, NULL, NULL, NULL, strip_alarms);
g_object_unref (comp);
if (!result)
@@ -474,7 +474,7 @@
parent:
if (COMP_EDITOR_CLASS (task_editor_parent_class)->send_comp)
- return COMP_EDITOR_CLASS (task_editor_parent_class)->send_comp (editor, method);
+ return COMP_EDITOR_CLASS (task_editor_parent_class)->send_comp (editor, method, strip_alarms);
return FALSE;
}
Modified: trunk/calendar/gui/e-cal-model-calendar.c
==============================================================================
--- trunk/calendar/gui/e-cal-model-calendar.c (original)
+++ trunk/calendar/gui/e-cal-model-calendar.c Mon Jan 19 13:56:42 2009
@@ -382,8 +382,10 @@
}
if (e_cal_modify_object (comp_data->client, comp_data->icalcomp, mod, NULL)) {
+ gboolean strip_alarms = TRUE;
+
if (itip_organizer_is_user (comp, comp_data->client) &&
- send_component_dialog (NULL, comp_data->client, comp, FALSE)) {
+ send_component_dialog (NULL, comp_data->client, comp, FALSE, &strip_alarms)) {
ECalComponent *send_comp = NULL;
if (mod == CALOBJ_MOD_ALL && e_cal_component_is_instance (comp)) {
@@ -403,7 +405,7 @@
}
itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, send_comp ? send_comp : comp,
- comp_data->client, NULL, NULL, NULL);
+ comp_data->client, NULL, NULL, NULL, strip_alarms);
if (send_comp)
g_object_unref (send_comp);
Modified: trunk/calendar/gui/e-calendar-table.c
==============================================================================
--- trunk/calendar/gui/e-calendar-table.c (original)
+++ trunk/calendar/gui/e-calendar-table.c Mon Jan 19 13:56:42 2009
@@ -1438,7 +1438,7 @@
comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
- itip_send_comp (E_CAL_COMPONENT_METHOD_PUBLISH, comp, comp_data->client, NULL, NULL, NULL);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_PUBLISH, comp, comp_data->client, NULL, NULL, NULL, TRUE);
g_object_unref (comp);
}
Modified: trunk/calendar/gui/e-calendar-view.c
==============================================================================
--- trunk/calendar/gui/e-calendar-view.c (original)
+++ trunk/calendar/gui/e-calendar-view.c Mon Jan 19 13:56:42 2009
@@ -376,6 +376,8 @@
/* FIXME Error handling */
uid = NULL;
if (e_cal_create_object (client, e_cal_component_get_icalcomponent (comp), &uid, NULL)) {
+ gboolean strip_alarms = TRUE;
+
if (uid) {
e_cal_component_set_uid (comp, uid);
g_free (uid);
@@ -383,9 +385,9 @@
if ((itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp)) &&
send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)),
- client, comp, TRUE)) {
+ client, comp, TRUE, &strip_alarms)) {
itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp,
- client, NULL, NULL, NULL);
+ client, NULL, NULL, NULL, strip_alarms);
}
} else {
g_message (G_STRLOC ": Could not create the object!");
@@ -685,7 +687,7 @@
&& cancel_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)),
event->comp_data->client, comp, TRUE))
itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp,
- event->comp_data->client, NULL, NULL, NULL);
+ event->comp_data->client, NULL, NULL, NULL, TRUE);
e_cal_component_get_uid (comp, &uid);
if (e_cal_component_is_instance (comp)) {
@@ -1029,7 +1031,7 @@
event->comp_data->client,
comp, TRUE))
itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp,
- event->comp_data->client, NULL, NULL, NULL);
+ event->comp_data->client, NULL, NULL, NULL, TRUE);
e_cal_component_get_uid (comp, &uid);
if (!uid || !*uid) {
@@ -1178,7 +1180,7 @@
e_cal_component_free_datetime (&range.datetime);
}
- itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, event->comp_data->client, NULL, NULL, NULL);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, event->comp_data->client, NULL, NULL, NULL, TRUE);
}
if (is_instance)
@@ -1582,7 +1584,7 @@
comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
- itip_send_comp (E_CAL_COMPONENT_METHOD_PUBLISH, comp, event->comp_data->client, NULL, NULL, NULL);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_PUBLISH, comp, event->comp_data->client, NULL, NULL, NULL, TRUE);
g_list_free (selected);
g_object_unref (comp);
@@ -2136,8 +2138,10 @@
gboolean new)
{
if (e_cal_modify_object (client, e_cal_component_get_icalcomponent (comp), mod, NULL)) {
+ gboolean strip_alarms = TRUE;
+
if ((itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp)) &&
- send_component_dialog (toplevel, client, comp, new)) {
+ send_component_dialog (toplevel, client, comp, new, &strip_alarms)) {
ECalComponent *send_comp = NULL;
if (mod == CALOBJ_MOD_ALL && e_cal_component_is_instance (comp)) {
@@ -2156,7 +2160,7 @@
}
}
- itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, send_comp ? send_comp : comp, client, NULL, NULL, NULL);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, send_comp ? send_comp : comp, client, NULL, NULL, NULL, strip_alarms);
if (send_comp)
g_object_unref (send_comp);
Modified: trunk/calendar/gui/e-itip-control.c
==============================================================================
--- trunk/calendar/gui/e-itip-control.c (original)
+++ trunk/calendar/gui/e-itip-control.c Mon Jan 19 13:56:42 2009
@@ -2097,7 +2097,7 @@
comp = get_real_item (itip);
if (comp != NULL) {
- itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp, priv->current_ecal, NULL, NULL, NULL);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp, priv->current_ecal, NULL, NULL, NULL, TRUE);
g_object_unref (comp);
dialog = gtk_message_dialog_new (
NULL, 0,
@@ -2152,7 +2152,7 @@
for (l = comp_list; l; l = l->next) {
ECalComponent *comp = E_CAL_COMPONENT (l->data);
- itip_send_comp (E_CAL_COMPONENT_METHOD_REPLY, comp, priv->current_ecal, NULL, NULL, NULL);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_REPLY, comp, priv->current_ecal, NULL, NULL, NULL, TRUE);
g_object_unref (comp);
}
@@ -2598,7 +2598,7 @@
g_slist_free (list);
e_cal_component_rescan (comp);
- itip_send_comp (E_CAL_COMPONENT_METHOD_REPLY, comp, priv->current_ecal, priv->top_level, NULL, NULL);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_REPLY, comp, priv->current_ecal, priv->top_level, NULL, NULL, TRUE);
g_object_unref (comp);
}
Modified: trunk/calendar/gui/e-memo-table.c
==============================================================================
--- trunk/calendar/gui/e-memo-table.c (original)
+++ trunk/calendar/gui/e-memo-table.c Mon Jan 19 13:56:42 2009
@@ -884,7 +884,7 @@
comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
- itip_send_comp (E_CAL_COMPONENT_METHOD_PUBLISH, comp, comp_data->client, NULL, NULL, NULL);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_PUBLISH, comp, comp_data->client, NULL, NULL, NULL, TRUE);
g_object_unref (comp);
}
Modified: trunk/calendar/gui/itip-utils.c
==============================================================================
--- trunk/calendar/gui/itip-utils.c (original)
+++ trunk/calendar/gui/itip-utils.c Mon Jan 19 13:56:42 2009
@@ -1024,7 +1024,7 @@
}
static ECalComponent *
-comp_compliant (ECalComponentItipMethod method, ECalComponent *comp, ECal *client, icalcomponent *zones)
+comp_compliant (ECalComponentItipMethod method, ECalComponent *comp, ECal *client, icalcomponent *zones, gboolean strip_alarms)
{
ECalComponent *clone, *temp_clone;
struct icaltimetype itt;
@@ -1081,8 +1081,31 @@
e_cal_component_free_recur_list (rrule_list);
}
- /* We delete incoming alarms anyhow, and this helps with outlook */
- e_cal_component_remove_all_alarms (clone);
+ /* We delete incoming alarms if requested, even this helps with outlook */
+ if (strip_alarms) {
+ e_cal_component_remove_all_alarms (clone);
+ } else {
+ /* Always strip procedure alarms, because of security */
+ GList *uids, *l;
+
+ uids = e_cal_component_get_alarm_uids (clone);
+
+ for (l = uids; l; l = l->next) {
+ ECalComponentAlarm *alarm;
+ ECalComponentAlarmAction action = E_CAL_COMPONENT_ALARM_UNKNOWN;
+
+ alarm = e_cal_component_get_alarm (clone, (const char *)l->data);
+ if (alarm) {
+ e_cal_component_alarm_get_action (alarm, &action);
+ e_cal_component_alarm_free (alarm);
+
+ if (action == E_CAL_COMPONENT_ALARM_PROCEDURE)
+ e_cal_component_remove_alarm (clone, (const char *)l->data);
+ }
+ }
+
+ cal_obj_uid_list_free (uids);
+ }
/* Strip X-LIC-ERROR stuff */
e_cal_component_strip_errors (clone);
@@ -1165,7 +1188,7 @@
gboolean
itip_send_comp (ECalComponentItipMethod method, ECalComponent *send_comp,
- ECal *client, icalcomponent *zones, GSList *attachments_list, GList *users)
+ ECal *client, icalcomponent *zones, GSList *attachments_list, GList *users, gboolean strip_alarms)
{
EMsgComposer *composer;
EComposerHeaderTable *table;
@@ -1198,7 +1221,7 @@
}
/* Tidy up the comp */
- comp = comp_compliant (method, send_comp, client, zones);
+ comp = comp_compliant (method, send_comp, client, zones, strip_alarms);
if (comp == NULL)
goto cleanup;
@@ -1314,7 +1337,7 @@
gboolean retval = FALSE;
/* Tidy up the comp */
- comp = comp_compliant (method, send_comp, client, zones);
+ comp = comp_compliant (method, send_comp, client, zones, TRUE);
if (comp == NULL)
goto cleanup;
Modified: trunk/calendar/gui/itip-utils.h
==============================================================================
--- trunk/calendar/gui/itip-utils.h (original)
+++ trunk/calendar/gui/itip-utils.h Mon Jan 19 13:56:42 2009
@@ -58,7 +58,7 @@
char *itip_get_comp_attendee (ECalComponent *comp, ECal *client);
gboolean itip_send_comp (ECalComponentItipMethod method, ECalComponent *comp,
- ECal *client, icalcomponent *zones, GSList *attachments_list, GList *users);
+ ECal *client, icalcomponent *zones, GSList *attachments_list, GList *users, gboolean strip_alarms);
gboolean itip_publish_comp (ECal *client, gchar* uri, gchar* username,
gchar* password, ECalComponent **pub_comp);
Modified: trunk/calendar/gui/tasks-control.c
==============================================================================
--- trunk/calendar/gui/tasks-control.c (original)
+++ trunk/calendar/gui/tasks-control.c Mon Jan 19 13:56:42 2009
@@ -531,7 +531,7 @@
ECalComponent *comp;
comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
- itip_send_comp (E_CAL_COMPONENT_METHOD_PUBLISH, comp, comp_data->client, NULL, NULL, NULL);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_PUBLISH, comp, comp_data->client, NULL, NULL, NULL, TRUE);
g_object_unref (comp);
}
}
Modified: trunk/plugins/itip-formatter/itip-formatter.c
==============================================================================
--- trunk/plugins/itip-formatter/itip-formatter.c (original)
+++ trunk/plugins/itip-formatter/itip-formatter.c Mon Jan 19 13:56:42 2009
@@ -630,6 +630,16 @@
if (!pitip->current_ecal && e_cal_get_object (ecal, fd->uid, fd->rid, &icalcomp, NULL)) {
+ if ((pitip->method == ICAL_METHOD_PUBLISH || pitip->method == ICAL_METHOD_REQUEST) &&
+ (icalcomponent_get_first_component (icalcomp, ICAL_VALARM_COMPONENT) ||
+ icalcomponent_get_first_component (icalcomp, ICAL_XAUDIOALARM_COMPONENT) ||
+ icalcomponent_get_first_component (icalcomp, ICAL_XDISPLAYALARM_COMPONENT) ||
+ icalcomponent_get_first_component (icalcomp, ICAL_XPROCEDUREALARM_COMPONENT) ||
+ icalcomponent_get_first_component (icalcomp, ICAL_XEMAILALARM_COMPONENT)))
+ itip_view_set_show_keep_alarm_check (ITIP_VIEW (pitip->view), TRUE);
+ else
+ itip_view_set_show_keep_alarm_check (ITIP_VIEW (pitip->view), FALSE);
+
icalcomponent_free (icalcomp);
pitip->current_ecal = ecal;
@@ -652,7 +662,8 @@
_("Found the appointment in the calendar '%s'"), e_source_peek_name (source));
set_buttons_sensitive (pitip);
- }
+ } else if (!pitip->current_ecal)
+ itip_view_set_show_keep_alarm_check (ITIP_VIEW (pitip->view), FALSE);
if (pitip->current_ecal) {
if (e_cal_get_static_capability (pitip->current_ecal, CAL_STATIC_CAPABILITY_RECURRENCES_NO_MASTER)) {
@@ -991,6 +1002,19 @@
icalcomponent_add_component (pitip->top_level, clone);
icalcomponent_set_method (pitip->top_level, pitip->method);
+ if (!itip_view_get_inherit_alarm_check_state (ITIP_VIEW (pitip->view))) {
+ icalcomponent *alarm_comp;
+ icalcompiter alarm_iter;
+
+ alarm_iter = icalcomponent_begin_component (clone, ICAL_VALARM_COMPONENT);
+ while ((alarm_comp = icalcompiter_deref (&alarm_iter)) != NULL) {
+ icalcompiter_next (&alarm_iter);
+
+ icalcomponent_remove_component (clone, alarm_comp);
+ icalcomponent_free (alarm_comp);
+ }
+ }
+
clone_comp = e_cal_component_new ();
if (!e_cal_component_set_icalcomponent (clone_comp, clone)) {
itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_ERROR, _("Unable to parse item"));
@@ -999,6 +1023,35 @@
}
source = e_cal_get_source (pitip->current_ecal);
+ if (itip_view_get_keep_alarm_check_state (ITIP_VIEW (pitip->view))) {
+ ECalComponent *real_comp;
+ GList *alarms, *l;
+ ECalComponentAlarm *alarm;
+
+ real_comp = get_real_item (pitip);
+ if (real_comp != NULL) {
+ alarms = e_cal_component_get_alarm_uids (real_comp);
+
+ for (l = alarms; l; l = l->next) {
+ alarm = e_cal_component_get_alarm (real_comp, (const char *)l->data);
+
+ if (alarm) {
+ ECalComponentAlarm *aclone = e_cal_component_alarm_clone (alarm);
+
+ if (aclone) {
+ e_cal_component_add_alarm (clone_comp, aclone);
+ e_cal_component_alarm_free (aclone);
+ }
+
+ e_cal_component_alarm_free (alarm);
+ }
+ }
+
+ cal_obj_uid_list_free (alarms);
+ g_object_unref (real_comp);
+ }
+ }
+
if ((response != ITIP_VIEW_RESPONSE_CANCEL)
&& (response != ITIP_VIEW_RESPONSE_DECLINE)){
GSList *attachments = NULL, *new_attachments = NULL, *l;
@@ -1160,7 +1213,7 @@
}
/* FIXME send the attachments in the request */
- status = itip_send_comp (method, send_comp, client, NULL, NULL, NULL);
+ status = itip_send_comp (method, send_comp, client, NULL, NULL, NULL, TRUE);
g_object_unref (send_comp);
@@ -1310,7 +1363,7 @@
if (itip_view_get_update (ITIP_VIEW (pitip->view))) {
e_cal_component_commit_sequence (comp);
- itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp, pitip->current_ecal, NULL, NULL, NULL);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp, pitip->current_ecal, NULL, NULL, NULL, TRUE);
}
if (!e_cal_modify_object (pitip->current_ecal, icalcomp, rid ? CALOBJ_MOD_THIS : CALOBJ_MOD_ALL, &error)) {
@@ -1340,7 +1393,7 @@
comp = get_real_item (pitip);
if (comp != NULL) {
- itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp, pitip->current_ecal, NULL, NULL, NULL);
+ itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp, pitip->current_ecal, NULL, NULL, NULL, TRUE);
g_object_unref (comp);
switch (pitip->type) {
@@ -1421,7 +1474,7 @@
}
static gboolean
-extract_itip_data (struct _itip_puri *pitip, GtkContainer *container)
+extract_itip_data (struct _itip_puri *pitip, GtkContainer *container, gboolean *have_alarms)
{
icalproperty *prop;
icalcomponent_kind kind = ICAL_NO_COMPONENT;
@@ -1581,14 +1634,24 @@
prop = icalcomponent_get_next_property (pitip->ical_comp, ICAL_X_PROPERTY);
}
- /* Strip out alarms for security purposes */
+ /* Strip out procedural alarms for security purposes */
alarm_iter = icalcomponent_begin_component (pitip->ical_comp, ICAL_VALARM_COMPONENT);
while ((alarm_comp = icalcompiter_deref (&alarm_iter)) != NULL) {
+ icalproperty *p;
+
icalcompiter_next (&alarm_iter);
- icalcomponent_remove_component (pitip->ical_comp, alarm_comp);
+ p = icalcomponent_get_first_property (alarm_comp, ICAL_ACTION_PROPERTY);
+ if (icalproperty_get_action (p) == ICAL_ACTION_PROCEDURE)
+ icalcomponent_remove_component (pitip->ical_comp, alarm_comp);
+
icalcomponent_free (alarm_comp);
}
+
+ if (have_alarms) {
+ alarm_iter = icalcomponent_begin_component (pitip->ical_comp, ICAL_VALARM_COMPONENT);
+ *have_alarms = icalcompiter_deref (&alarm_iter) != NULL;
+ }
}
pitip->comp = e_cal_component_new ();
@@ -1911,7 +1974,7 @@
}
e_cal_component_rescan (comp);
- if (itip_send_comp (E_CAL_COMPONENT_METHOD_REPLY, comp, pitip->current_ecal, pitip->top_level, NULL, NULL)) {
+ if (itip_send_comp (E_CAL_COMPONENT_METHOD_REPLY, comp, pitip->current_ecal, pitip->top_level, NULL, NULL, TRUE)) {
camel_folder_set_message_flags (pitip->folder, pitip->uid, CAMEL_MESSAGE_ANSWERED, CAMEL_MESSAGE_ANSWERED);
}
@@ -1974,6 +2037,7 @@
const char *string, *org;
int i;
gboolean response_enabled;
+ gboolean have_alarms = FALSE;
info = (struct _itip_puri *) em_format_find_puri((EMFormat *)efh, pobject->classid);
@@ -1991,7 +2055,7 @@
}
/* FIXME Handle multiple VEVENTS with the same UID, ie detached instances */
- if (!extract_itip_data (info, GTK_CONTAINER (eb)))
+ if (!extract_itip_data (info, GTK_CONTAINER (eb), &have_alarms))
return TRUE;
info->view = itip_view_new ();
@@ -2003,6 +2067,8 @@
if (!response_enabled) {
itip_view_set_mode (ITIP_VIEW (info->view), ITIP_VIEW_MODE_HIDE_ALL);
} else {
+ itip_view_set_show_inherit_alarm_check (ITIP_VIEW (info->view), have_alarms && (info->method == ICAL_METHOD_PUBLISH || info->method == ICAL_METHOD_REQUEST));
+
switch (info->method) {
case ICAL_METHOD_PUBLISH:
case ICAL_METHOD_REQUEST:
Modified: trunk/plugins/itip-formatter/itip-view.c
==============================================================================
--- trunk/plugins/itip-formatter/itip-view.c (original)
+++ trunk/plugins/itip-formatter/itip-view.c Mon Jan 19 13:56:42 2009
@@ -121,6 +121,8 @@
GtkWidget *options_box;
GtkWidget *free_time_check;
+ GtkWidget *keep_alarm_check;
+ GtkWidget *inherit_alarm_check;
GtkWidget *button_box;
gboolean buttons_sensitive;
@@ -947,6 +949,18 @@
itip_view_set_mode (view, priv->mode);
}
+/*
+ alarm_check_toggled_cb
+ check1 was changed, so make the second available based on state of the first check.
+*/
+static void
+alarm_check_toggled_cb (GtkWidget *check1, GtkWidget *check2)
+{
+ g_return_if_fail (check1 != NULL);
+ g_return_if_fail (check2 != NULL);
+
+ gtk_widget_set_sensitive (check2, !(GTK_WIDGET_VISIBLE (check1) && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check1))));
+}
static void
itip_view_init (ItipView *view)
@@ -1119,6 +1133,17 @@
priv->free_time_check = gtk_check_button_new_with_mnemonic (_("Show time as _free"));
gtk_box_pack_start (GTK_BOX (priv->options_box), priv->free_time_check, FALSE, FALSE, 0);
+ priv->keep_alarm_check = gtk_check_button_new_with_mnemonic (_("_Preserve my reminder"));
+ /* default value is to keep user's alarms */
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (view->priv->keep_alarm_check), TRUE);
+ gtk_box_pack_start (GTK_BOX (priv->options_box), priv->keep_alarm_check, FALSE, FALSE, 0);
+
+ priv->inherit_alarm_check = gtk_check_button_new_with_mnemonic (_("_Inherit reminder"));
+ gtk_box_pack_start (GTK_BOX (priv->options_box), priv->inherit_alarm_check, FALSE, FALSE, 0);
+
+ g_signal_connect (priv->keep_alarm_check, "toggled", G_CALLBACK (alarm_check_toggled_cb), priv->inherit_alarm_check);
+ g_signal_connect (priv->inherit_alarm_check, "toggled", G_CALLBACK (alarm_check_toggled_cb), priv->keep_alarm_check);
+
/* The buttons for actions */
priv->button_box = gtk_hbutton_box_new ();
gtk_button_box_set_layout (GTK_BUTTON_BOX (priv->button_box), GTK_BUTTONBOX_START);
@@ -2118,7 +2143,7 @@
if (show)
gtk_widget_show (view->priv->recur_check);
- else {
+ else {
gtk_widget_hide (view->priv->recur_check);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (view->priv->recur_check), FALSE);
}
@@ -2132,7 +2157,7 @@
if (show)
gtk_widget_show (view->priv->free_time_check);
- else {
+ else {
gtk_widget_hide (view->priv->free_time_check);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (view->priv->free_time_check), FALSE);
}
@@ -2145,3 +2170,51 @@
return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (view->priv->free_time_check));
}
+
+void
+itip_view_set_show_keep_alarm_check (ItipView *view, gboolean show)
+{
+ g_return_if_fail (view != NULL);
+ g_return_if_fail (ITIP_IS_VIEW (view));
+
+ if (show)
+ gtk_widget_show (view->priv->keep_alarm_check);
+ else
+ gtk_widget_hide (view->priv->keep_alarm_check);
+
+ /* and update state of the second check */
+ alarm_check_toggled_cb (view->priv->keep_alarm_check, view->priv->inherit_alarm_check);
+}
+
+gboolean
+itip_view_get_keep_alarm_check_state (ItipView *view)
+{
+ g_return_val_if_fail (view != NULL, FALSE);
+
+ return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (view->priv->keep_alarm_check));
+}
+
+void
+itip_view_set_show_inherit_alarm_check (ItipView *view, gboolean show)
+{
+ g_return_if_fail (view != NULL);
+ g_return_if_fail (ITIP_IS_VIEW (view));
+
+ if (show)
+ gtk_widget_show (view->priv->inherit_alarm_check);
+ else {
+ gtk_widget_hide (view->priv->inherit_alarm_check);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (view->priv->inherit_alarm_check), FALSE);
+ }
+
+ /* and update state of the second check */
+ alarm_check_toggled_cb (view->priv->inherit_alarm_check, view->priv->keep_alarm_check);
+}
+
+gboolean
+itip_view_get_inherit_alarm_check_state (ItipView *view)
+{
+ g_return_val_if_fail (view != NULL, FALSE);
+
+ return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (view->priv->inherit_alarm_check));
+}
Modified: trunk/plugins/itip-formatter/itip-view.h
==============================================================================
--- trunk/plugins/itip-formatter/itip-view.h (original)
+++ trunk/plugins/itip-formatter/itip-view.h Mon Jan 19 13:56:42 2009
@@ -180,6 +180,12 @@
void itip_view_set_show_free_time_check (ItipView *view, gboolean show);
gboolean itip_view_get_free_time_check_state (ItipView *view);
+void itip_view_set_show_keep_alarm_check (ItipView *view, gboolean show);
+gboolean itip_view_get_keep_alarm_check_state (ItipView *view);
+
+void itip_view_set_show_inherit_alarm_check (ItipView *view, gboolean show);
+gboolean itip_view_get_inherit_alarm_check_state (ItipView *view);
+
G_END_DECLS
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]