From d7e017d1bf0c1237bcd4c94e62378a2bd6f56538 Mon Sep 17 00:00:00 2001 From: Chenthill Palanisamy Date: Thu, 10 Aug 2006 07:34:30 +0000 Subject: Fixes shared memos for File system. svn path=/trunk/; revision=32520 --- calendar/gui/dialogs/comp-editor.c | 48 +++++++++++++++++++++++++++++++++---- calendar/gui/dialogs/event-editor.c | 2 +- calendar/gui/dialogs/memo-page.c | 45 ++++++++++++++++++++++++++++++---- calendar/gui/dialogs/send-comp.c | 3 ++- calendar/gui/dialogs/task-editor.c | 2 +- 5 files changed, 88 insertions(+), 12 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 80827036f9..83a1f09d40 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -861,9 +861,12 @@ save_comp_with_send (CompEditor *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 (itip_organizer_is_user (priv->comp, priv->client)) - return comp_editor_send_comp (editor, E_CAL_COMPONENT_METHOD_REQUEST); - else { + if (itip_organizer_is_user (priv->comp, priv->client)) { + if (e_cal_component_get_vtype (priv->comp) == E_CAL_COMPONENT_JOURNAL) + return comp_editor_send_comp (editor, E_CAL_COMPONENT_METHOD_PUBLISH); + else + return comp_editor_send_comp (editor, E_CAL_COMPONENT_METHOD_REQUEST); + } else { if (!comp_editor_send_comp (editor, E_CAL_COMPONENT_METHOD_REQUEST)) return FALSE; @@ -2460,12 +2463,43 @@ set_attendees_for_delegation (ECalComponent *comp, const char *address, ECalComp } +static void +get_users_from_memo_comp (ECalComponent *comp, GList **users) +{ + icalcomponent *icalcomp; + icalproperty *icalprop; + const char *attendees = NULL; + char **emails, **iter; + + icalcomp = e_cal_component_get_icalcomponent (comp); + + for (icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY); icalprop; + icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY)) { + if (g_str_equal (icalproperty_get_x_name (icalprop), "X-EVOLUTION-RECIPIENTS")) { + break; + } + } + + if (icalprop) { + attendees = icalproperty_get_x (icalprop); + emails = g_strsplit (attendees, ";", -1); + + iter = emails; + while (*iter) { + *users = g_list_append (*users, g_strdup (*iter)); + iter++; + } + g_strfreev (emails); + } +} + static gboolean real_send_comp (CompEditor *editor, ECalComponentItipMethod method) { CompEditorPrivate *priv; ECalComponent *send_comp; char *address = NULL; + GList *users = NULL; g_return_val_if_fail (editor != NULL, FALSE); g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE); @@ -2473,6 +2507,10 @@ real_send_comp (CompEditor *editor, ECalComponentItipMethod method) priv = editor->priv; send_comp = e_cal_component_clone (priv->comp); + + if (e_cal_component_get_vtype (send_comp) == E_CAL_COMPONENT_JOURNAL) + get_users_from_memo_comp (send_comp, &users); + /* The user updates the delegated status to the Organizer, so remove all other attendees */ if ((priv->flags & COMP_EDITOR_DELEGATE)) { address = itip_get_comp_attendee (send_comp, priv->client); @@ -2483,7 +2521,7 @@ real_send_comp (CompEditor *editor, ECalComponentItipMethod method) if (!e_cal_component_has_attachments (priv->comp)) { if (itip_send_comp (method, send_comp, priv->client, - NULL, NULL)) { + NULL, NULL, users)) { g_object_unref (send_comp); return TRUE; } @@ -2504,7 +2542,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)) { + NULL, mime_attach_list, users)) { save_comp (editor); g_object_unref (send_comp); return TRUE; diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 389834180f..4869f8887a 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -767,7 +767,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); + client, NULL, NULL, NULL); g_object_unref (comp); if (!result) diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c index 42850b60b3..41d03f322b 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -485,7 +485,7 @@ fill_comp_with_recipients (ENameSelector *name_selector, ECalComponent *comp) } if (book) { - GList *contacts; + GList *contacts = NULL; EContact *n_con = NULL; char *qu; EBookQuery *query; @@ -496,7 +496,6 @@ fill_comp_with_recipients (ENameSelector *name_selector, ECalComponent *comp) if (!e_book_get_contacts (book, query, &contacts, NULL)) { g_warning ("Could not get contact from the book \n"); - return; } else { des = e_destination_new (); n_con = contacts->data; @@ -704,7 +703,7 @@ memo_page_fill_component (CompEditorPage *page, ECalComponent *comp) if (str) g_free (str); - if ((page->flags & COMP_EDITOR_PAGE_IS_SHARED) && fill_comp_with_recipients (priv->name_selector, comp)) { + if ((page->flags & COMP_EDITOR_PAGE_IS_SHARED) && (page->flags & COMP_EDITOR_PAGE_NEW_ITEM) && fill_comp_with_recipients (priv->name_selector, comp)) { ECalComponentOrganizer organizer = {NULL, NULL, NULL, NULL}; EAccount *a; @@ -732,6 +731,8 @@ memo_page_fill_component (CompEditorPage *page, ECalComponent *comp) organizer.cn = a->id->name; e_cal_component_set_organizer (comp, &organizer); + comp_editor_page_notify_needs_send (page); + g_free (addr); } @@ -899,6 +900,27 @@ widget_focus_out_cb (GtkWidget *widget, GdkEventFocus *event, gpointer data) return FALSE; } + +/* Callback used when the summary changes; we emit the notification signal. */ +static void +summary_changed_cb (GtkEditable *editable, gpointer data) +{ + MemoPage *mpage; + MemoPagePrivate *priv; + gchar *summary; + + mpage = MEMO_PAGE (data); + priv = mpage->priv; + + if (priv->updating) + return; + + summary = e_dialog_editable_get (GTK_WIDGET (editable)); + comp_editor_page_notify_summary_changed (COMP_EDITOR_PAGE (mpage), + summary); + g_free (summary); +} + static void to_button_clicked_cb (GtkButton *button, gpointer data) { @@ -925,6 +947,14 @@ init_widgets (MemoPage *mpage) priv = mpage->priv; + /* Summary */ + g_signal_connect((priv->summary_entry), "changed", + G_CALLBACK (summary_changed_cb), mpage); + g_signal_connect(priv->summary_entry, "focus-in-event", + G_CALLBACK (widget_focus_in_cb), mpage); + g_signal_connect(priv->summary_entry, "focus-out-event", + G_CALLBACK (widget_focus_out_cb), mpage); + /* Memo Content */ text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->memo_content)); @@ -942,7 +972,7 @@ init_widgets (MemoPage *mpage) /* Source selector */ g_signal_connect((priv->source_selector), "source_selected", G_CALLBACK (source_changed_cb), mpage); - + /* Connect the default signal handler to use to make sure the "changed" field gets set whenever a field is changed. */ @@ -955,6 +985,12 @@ init_widgets (MemoPage *mpage) g_signal_connect((priv->summary_entry), "changed", G_CALLBACK (field_changed_cb), mpage); + + g_signal_connect((priv->source_selector), "changed", + G_CALLBACK (field_changed_cb), mpage); + + g_signal_connect((priv->start_date), "changed", + G_CALLBACK (field_changed_cb), mpage); if (priv->name_selector) { ENameSelectorDialog *name_selector_dialog; @@ -964,6 +1000,7 @@ init_widgets (MemoPage *mpage) g_signal_connect (name_selector_dialog, "response", G_CALLBACK (response_cb), mpage); g_signal_connect ((priv->to_button), "clicked", G_CALLBACK (to_button_clicked_cb), mpage); + g_signal_connect ((priv->to_entry), "changed", G_CALLBACK (field_changed_cb), mpage); } memo_page_set_show_categories (mpage, calendar_config_get_show_categories()); diff --git a/calendar/gui/dialogs/send-comp.c b/calendar/gui/dialogs/send-comp.c index 9e88f302eb..e9f6275400 100644 --- a/calendar/gui/dialogs/send-comp.c +++ b/calendar/gui/dialogs/send-comp.c @@ -61,7 +61,8 @@ send_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gbo else id = "calendar:prompt-send-updated-task-info"; break; - + case E_CAL_COMPONENT_JOURNAL: + return TRUE; default: g_message ("send_component_dialog(): " "Cannot handle object of type %d", vtype); diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 11b6443843..482fb4ef39 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -584,7 +584,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); + client, NULL, NULL, NULL); g_object_unref (comp); if (!result) -- cgit v1.2.3