aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/dialogs
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-01-19 21:56:42 +0800
committerMilan Crha <mcrha@src.gnome.org>2009-01-19 21:56:42 +0800
commit2be7cd3b2ab50047820da4a1e873785b53f41acd (patch)
tree50f07aacdc49a27e040e8470ad57e6fa21bdead5 /calendar/gui/dialogs
parentae26a9a5fb34beb48e4161c8f145b0fb2d3cb3a9 (diff)
downloadgsoc2013-evolution-2be7cd3b2ab50047820da4a1e873785b53f41acd.tar.gz
gsoc2013-evolution-2be7cd3b2ab50047820da4a1e873785b53f41acd.tar.zst
gsoc2013-evolution-2be7cd3b2ab50047820da4a1e873785b53f41acd.zip
** Fix for bug #225712
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. svn path=/trunk/; revision=37097
Diffstat (limited to 'calendar/gui/dialogs')
-rw-r--r--calendar/gui/dialogs/comp-editor.c23
-rw-r--r--calendar/gui/dialogs/comp-editor.h5
-rw-r--r--calendar/gui/dialogs/event-editor.c8
-rw-r--r--calendar/gui/dialogs/send-comp.c68
-rw-r--r--calendar/gui/dialogs/send-comp.h2
-rw-r--r--calendar/gui/dialogs/task-editor.c8
6 files changed, 87 insertions, 27 deletions
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index c3e0e38fed..4799895b84 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -172,7 +172,7 @@ static void comp_editor_show_help (CompEditor *editor);
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 @@ save_comp_with_send (CompEditor *editor)
CompEditorFlags flags;
gboolean send;
gboolean delegate;
+ gboolean strip_alarms = TRUE;
priv = editor->priv;
@@ -907,18 +908,18 @@ save_comp_with_send (CompEditor *editor)
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 @@ get_users_from_memo_comp (ECalComponent *comp, GList **users)
}
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 @@ real_send_comp (CompEditor *editor, ECalComponentItipMethod method)
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 @@ real_send_comp (CompEditor *editor, ECalComponentItipMethod method)
/* 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 @@ comp_editor_delete_comp (CompEditor *editor)
*
**/
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 @@ comp_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method)
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;
}
diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h
index 9289b9ced7..ab277febf7 100644
--- a/calendar/gui/dialogs/comp-editor.h
+++ b/calendar/gui/dialogs/comp-editor.h
@@ -67,7 +67,7 @@ struct _CompEditorClass {
/* 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 comp_editor_save_comp (CompEditor *editor,
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);
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c
index 161ed598b7..e3d3448f6c 100644
--- a/calendar/gui/dialogs/event-editor.c
+++ b/calendar/gui/dialogs/event-editor.c
@@ -99,7 +99,7 @@ static const gchar *ui =
"</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 @@ event_editor_edit_comp (CompEditor *editor, ECalComponent *comp)
}
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 @@ event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method)
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 @@ event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method)
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;
}
diff --git a/calendar/gui/dialogs/send-comp.c b/calendar/gui/dialogs/send-comp.c
index 11d6e74757..a7d87c47f4 100644
--- a/calendar/gui/dialogs/send-comp.c
+++ b/calendar/gui/dialogs/send-comp.c
@@ -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 @@ send_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gbo
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
diff --git a/calendar/gui/dialogs/send-comp.h b/calendar/gui/dialogs/send-comp.h
index 4a1a6c55ab..21b310947a 100644
--- a/calendar/gui/dialogs/send-comp.h
+++ b/calendar/gui/dialogs/send-comp.h
@@ -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
diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c
index ca6959640b..4b8f8698b9 100644
--- a/calendar/gui/dialogs/task-editor.c
+++ b/calendar/gui/dialogs/task-editor.c
@@ -88,7 +88,7 @@ static const gchar *ui =
"</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 @@ task_editor_edit_comp (CompEditor *editor, ECalComponent *comp)
}
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 @@ task_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method)
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 @@ task_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method)
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;
}