aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-05-21 00:02:30 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-05-21 00:56:55 +0800
commita1f287ca6bf35d27e5dcb9b89a10f76e9abbd057 (patch)
treecfc2fe1694a379a53e533d19edcf1205e55d54e5 /mail
parentacabcb0be8e3c983e3400d7f7436f618e0000cfe (diff)
downloadgsoc2013-evolution-a1f287ca6bf35d27e5dcb9b89a10f76e9abbd057.tar.gz
gsoc2013-evolution-a1f287ca6bf35d27e5dcb9b89a10f76e9abbd057.tar.zst
gsoc2013-evolution-a1f287ca6bf35d27e5dcb9b89a10f76e9abbd057.zip
Bug 274117 – Difficult to post a new message to newsgroups
Completely rewrite how composer headers are managed. There's now two sets of headers (with some overlap): one set is for sending an email message, the other is for posting to a newsgroup. The correct set of headers is chosen on-the-fly based on the currently selected account type. The user's "view" preferences for these two sets are stored separately, so that switching between an email account and a news account will no longer stomp on your preferences. This also eliminates the need for the "Post New Message to Folder" and "Post a Reply" actions, so they've been removed. Usenet users can now just highlight a newsgroup in the folder tree and click New or Reply, and the composer window will show the correct set of headers with the Post-To field filled in automatically. Comment #6 in the bug discusses other standard news reader behaviors we still don't get right, particularly the missing "Followup To" header. These will be dealt with separately.
Diffstat (limited to 'mail')
-rw-r--r--mail/em-composer-utils.c220
-rw-r--r--mail/em-composer-utils.h4
-rw-r--r--mail/em-folder-browser.c9
-rw-r--r--mail/em-folder-view.c16
-rw-r--r--mail/evolution-mail.schemas.in62
5 files changed, 52 insertions, 259 deletions
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 0f9945b7d7..f427feca6d 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -660,13 +660,18 @@ create_new_composer (const char *subject, const char *fromuri, gboolean use_defa
EAccount *account = NULL;
composer = e_msg_composer_new ();
- if (composer == NULL)
- return NULL;
+ table = e_msg_composer_get_header_table (composer);
+
+ if (fromuri != NULL) {
+ GList *list;
- if (fromuri)
account = mail_config_get_account_by_source_url(fromuri);
- table = e_msg_composer_get_header_table (composer);
+ list = g_list_prepend (NULL, (gpointer) fromuri);
+ e_composer_header_table_set_post_to_list (table, list);
+ g_list_free (list);
+ }
+
e_composer_header_table_set_account (table, account);
e_composer_header_table_set_subject (table, subject);
@@ -729,82 +734,6 @@ em_utils_compose_new_message_with_mailto (const char *url, const char *fromuri)
gdk_window_raise (((GtkWidget *) composer)->window);
}
-/**
- * em_utils_post_to_folder:
- * @folder: folder
- *
- * Opens a new composer window as a child window of @parent's toplevel
- * window. If @folder is non-NULL, the composer will default to posting
- * mail to the folder specified by @folder.
- **/
-void
-em_utils_post_to_folder (CamelFolder *folder)
-{
- EMsgComposer *composer;
- EComposerHeaderTable *table;
- EAccount *account;
-
- composer = e_msg_composer_new_with_type (E_MSG_COMPOSER_POST);
- table = e_msg_composer_get_header_table (composer);
-
- if (folder != NULL) {
- char *url = mail_tools_folder_to_url (folder);
- GList *list = g_list_prepend (NULL, url);
-
- e_composer_header_table_set_post_to_list (table, list);
-
- g_list_free (list);
- g_free (url);
-
- url = camel_url_to_string (CAMEL_SERVICE (folder->parent_store)->url, CAMEL_URL_HIDE_ALL);
- account = mail_config_get_account_by_source_url (url);
- g_free (url);
-
- if (account)
- e_composer_header_table_set_account_name (
- table, account->name);
- }
-
- em_composer_utils_setup_default_callbacks (composer);
-
- composer_set_no_change (composer, TRUE, TRUE);
-
- gtk_widget_show ((GtkWidget *) composer);
- gdk_window_raise (((GtkWidget *) composer)->window);
-}
-
-/**
- * em_utils_post_to_url:
- * @url: mailto url
- *
- * Opens a new composer window as a child window of @parent's toplevel
- * window. If @url is non-NULL, the composer will default to posting
- * mail to the folder specified by @url.
- **/
-void
-em_utils_post_to_url (const char *url)
-{
- EMsgComposer *composer;
- EComposerHeaderTable *table;
-
- composer = e_msg_composer_new_with_type (E_MSG_COMPOSER_POST);
- table = e_msg_composer_get_header_table (composer);
-
- if (url != NULL) {
- GList *list = NULL;
-
- list = g_list_prepend (list, (gpointer) url);
- e_composer_header_table_set_post_to_list (table, list);
- g_list_free (list);
- }
-
- em_composer_utils_setup_default_callbacks (composer);
-
- composer_set_no_change (composer, TRUE, TRUE);
-
- gtk_widget_show ((GtkWidget *) composer);
-}
-
/* Editing messages... */
static void
@@ -1763,18 +1692,12 @@ reply_get_composer (CamelMimeMessage *message, EAccount *account,
g_return_val_if_fail (to == NULL || CAMEL_IS_INTERNET_ADDRESS (to), NULL);
g_return_val_if_fail (cc == NULL || CAMEL_IS_INTERNET_ADDRESS (cc), NULL);
+ composer = e_msg_composer_new ();
+
/* construct the tov/ccv */
tov = em_utils_camel_address_to_destination (to);
ccv = em_utils_camel_address_to_destination (cc);
- if (tov || ccv) {
- if (postto && camel_address_length((CamelAddress *)postto))
- composer = e_msg_composer_new_with_type (E_MSG_COMPOSER_MAIL_POST);
- else
- composer = e_msg_composer_new_with_type (E_MSG_COMPOSER_MAIL);
- } else
- composer = e_msg_composer_new_with_type (E_MSG_COMPOSER_POST);
-
/* Set the subject of the new message. */
if ((subject = (char *) camel_mime_message_get_subject (message))) {
if (g_ascii_strncasecmp (subject, "Re: ", 4) != 0)
@@ -2403,124 +2326,3 @@ em_utils_reply_to_message(CamelFolder *folder, const char *uid, CamelMimeMessage
gtk_widget_show (GTK_WIDGET (composer));
}
-
-/* Posting replies... */
-
-static void
-post_reply_to_message (CamelFolder *folder, const char *uid, CamelMimeMessage *message, void *user_data)
-{
- /* FIXME: would be nice if this shared more code with reply_get_composer() */
- const char *message_id, *references;
- CamelInternetAddress *to;
- EDestination **tov = NULL;
- CamelFolder *real_folder;
- EMsgComposer *composer;
- EComposerHeaderTable *table;
- char *subject, *url;
- EAccount *account;
- char *real_uid;
- guint32 flags;
- GList *list = NULL;
-
- if (message == NULL)
- return;
-
- if (CAMEL_IS_VEE_FOLDER (folder)) {
- CamelMessageInfo *info;
-
- info = camel_folder_get_message_info (folder, uid);
- real_folder = camel_vee_folder_get_location ((CamelVeeFolder *) folder, (struct _CamelVeeMessageInfo *) info, &real_uid);
- camel_folder_free_message_info (folder, info);
- } else {
- real_folder = folder;
- camel_object_ref (folder);
- real_uid = g_strdup (uid);
- }
-
- account = guess_account (message, real_folder);
- flags = CAMEL_MESSAGE_ANSWERED | CAMEL_MESSAGE_SEEN;
-
- to = camel_internet_address_new();
- get_reply_sender (message, to, NULL);
-
- composer = e_msg_composer_new_with_type (E_MSG_COMPOSER_MAIL_POST);
-
- /* construct the tov/ccv */
- tov = em_utils_camel_address_to_destination (to);
-
- /* Set the subject of the new message. */
- if ((subject = (char *) camel_mime_message_get_subject (message))) {
- if (g_ascii_strncasecmp (subject, "Re: ", 4) != 0)
- subject = g_strdup_printf ("Re: %s", subject);
- else
- subject = g_strdup (subject);
- } else {
- subject = g_strdup ("");
- }
-
- table = e_msg_composer_get_header_table (composer);
- e_composer_header_table_set_account (table, account);
- e_composer_header_table_set_subject (table, subject);
- e_composer_header_table_set_destinations_to (table, tov);
-
- g_free (subject);
-
- url = mail_tools_folder_to_url (real_folder);
- list = g_list_prepend (list, url);
-
- e_composer_header_table_set_post_to_list (table, list);
-
- g_list_free (list);
- g_free (url);
-
- /* Add In-Reply-To and References. */
- message_id = camel_medium_get_header (CAMEL_MEDIUM (message), "Message-Id");
- references = camel_medium_get_header (CAMEL_MEDIUM (message), "References");
- if (message_id) {
- char *reply_refs;
-
- e_msg_composer_add_header (composer, "In-Reply-To", message_id);
-
- if (references)
- reply_refs = g_strdup_printf ("%s %s", references, message_id);
- else
- reply_refs = g_strdup (message_id);
-
- e_msg_composer_add_header (composer, "References", reply_refs);
- g_free (reply_refs);
- } else if (references) {
- e_msg_composer_add_header (composer, "References", references);
- }
-
- e_msg_composer_add_message_attachments (composer, message, TRUE);
-
- composer_set_body (composer, message, NULL);
-
- em_composer_utils_setup_callbacks (composer, real_folder, real_uid, flags, flags, NULL, NULL);
-
- composer_set_no_change (composer, TRUE, FALSE);
-
- gtk_widget_show (GTK_WIDGET (composer));
-
- camel_object_unref (real_folder);
- camel_object_unref(to);
- g_free (real_uid);
-}
-
-/**
- * em_utils_post_reply_to_message_by_uid:
- * @folder: folder containing message to reply to
- * @uid: message uid
- * @mode: reply mode
- *
- * Creates a new composer (post mode) ready to reply to the message
- * referenced by @folder and @uid.
- **/
-void
-em_utils_post_reply_to_message_by_uid (CamelFolder *folder, const char *uid)
-{
- g_return_if_fail (CAMEL_IS_FOLDER (folder));
- g_return_if_fail (uid != NULL);
-
- mail_get_message (folder, uid, post_reply_to_message, NULL, mail_msg_unordered_push);
-}
diff --git a/mail/em-composer-utils.h b/mail/em-composer-utils.h
index d17a98caa3..c46f808879 100644
--- a/mail/em-composer-utils.h
+++ b/mail/em-composer-utils.h
@@ -50,8 +50,6 @@ void em_utils_compose_new_message (const char *fromuri);
/* FIXME: mailto? url? should make up its mind what its called. imho use 'uri' */
void em_utils_compose_new_message_with_mailto (const char *url, const char *fromuri);
-void em_utils_post_to_folder (struct _CamelFolder *folder);
-void em_utils_post_to_url (const char *url);
void em_utils_edit_message (struct _CamelMimeMessage *message, struct _CamelFolder *folder);
void em_utils_edit_messages (struct _CamelFolder *folder, GPtrArray *uids, gboolean replace);
@@ -79,8 +77,6 @@ enum {
void em_utils_reply_to_message (struct _CamelFolder *, const char *uid, struct _CamelMimeMessage *message, int mode, struct _EMFormat *source);
-void em_utils_post_reply_to_message_by_uid (struct _CamelFolder *folder, const char *uid);
-
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c
index 7a3e690e2b..9a80a0c254 100644
--- a/mail/em-folder-browser.c
+++ b/mail/em-folder-browser.c
@@ -164,7 +164,6 @@ static const EMFolderViewEnable emfb_enable_map[] = {
{ "FolderRename", EM_POPUP_SELECT_FOLDER },
{ "FolderRefresh", EM_POPUP_SELECT_FOLDER },
{ "ChangeFolderProperties", EM_POPUP_SELECT_FOLDER },
- { "MailPost", EM_POPUP_SELECT_FOLDER },
{ "MessageMarkAllAsRead", EM_POPUP_SELECT_FOLDER },
{ "ViewHideSelected", EM_POPUP_SELECT_MANY },
{ "ViewThreadsCollapseAll", EM_FOLDER_VIEW_SELECT_THREADED},
@@ -1694,13 +1693,6 @@ emfb_mail_stop(BonoboUIComponent *uid, void *data, const char *path)
}
static void
-emfb_mail_post(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderView *emfv = data;
- em_utils_post_to_folder (emfv->folder);
-}
-
-static void
emfb_tools_filters(BonoboUIComponent *uid, void *data, const char *path)
{
EMFolderBrowser *emfb = data;
@@ -1779,7 +1771,6 @@ static BonoboUIVerb emfb_verbs[] = {
BONOBO_UI_UNSAFE_VERB ("FolderCreate", emfb_folder_create),
BONOBO_UI_UNSAFE_VERB ("HelpDebug", emfb_help_debug),
- BONOBO_UI_UNSAFE_VERB ("MailPost", emfb_mail_post),
BONOBO_UI_UNSAFE_VERB ("MailStop", emfb_mail_stop),
BONOBO_UI_UNSAFE_VERB ("ToolsFilters", emfb_tools_filters),
BONOBO_UI_UNSAFE_VERB ("ToolsSubscriptions", emfb_tools_subscriptions),
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index 42037b5a33..e31d8d727c 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -185,7 +185,6 @@ static const EMFolderViewEnable emfv_enable_map[] = {
{ "MessageFollowUpClear", EM_POPUP_SELECT_MANY|EM_POPUP_SELECT_FLAG_CLEAR },
{ "MessageMove", EM_POPUP_SELECT_MANY },
{ "MessageOpen", EM_POPUP_SELECT_MANY },
- { "MessagePostReply", EM_POPUP_SELECT_ONE },
{ "MessageReplyAll", EM_POPUP_SELECT_ONE },
{ "MessageReplyList", EM_POPUP_SELECT_ONE|EM_POPUP_SELECT_MAILING_LIST },
{ "MessageReplySender", EM_POPUP_SELECT_ONE },
@@ -1726,20 +1725,6 @@ emfv_message_redirect (BonoboUIComponent *uic, void *data, const char *path)
em_utils_redirect_message_by_uid (emfv->folder, emfv->list->cursor_uid);
}
-static void
-emfv_message_post_reply (BonoboUIComponent *uic, void *data, const char *path)
-{
- EMFolderView *emfv = data;
-
- if (emfv->list->cursor_uid == NULL)
- return;
-
- if (!em_utils_check_user_can_send_mail ((GtkWidget *) emfv))
- return;
-
- em_utils_post_reply_to_message_by_uid (emfv->folder, emfv->list->cursor_uid);
-}
-
static gboolean
html_contains_nonwhitespace (const char *html, gint len)
{
@@ -2073,7 +2058,6 @@ static BonoboUIVerb emfv_message_verbs[] = {
BONOBO_UI_UNSAFE_VERB ("MessageFollowUpClear", emfv_message_followup_clear),
BONOBO_UI_UNSAFE_VERB ("MessageMove", emfv_message_move),
BONOBO_UI_UNSAFE_VERB ("MessageOpen", emfv_message_open),
- BONOBO_UI_UNSAFE_VERB ("MessagePostReply", emfv_message_post_reply),
BONOBO_UI_UNSAFE_VERB ("MessageReplyAll", emfv_message_reply_all),
BONOBO_UI_UNSAFE_VERB ("MessageReplyList", emfv_message_reply_list),
BONOBO_UI_UNSAFE_VERB ("MessageReplySender", emfv_message_reply_sender),
diff --git a/mail/evolution-mail.schemas.in b/mail/evolution-mail.schemas.in
index e63d9eec4a..fbc23eb746 100644
--- a/mail/evolution-mail.schemas.in
+++ b/mail/evolution-mail.schemas.in
@@ -116,71 +116,91 @@
</schema>
<schema>
- <key>/schemas/apps/evolution/mail/composer/view/From</key>
- <applyto>/apps/evolution/mail/composer/view/From</applyto>
+ <key>/schemas/apps/evolution/mail/composer/show_mail_bcc</key>
+ <applyto>/apps/evolution/mail/composer/show_mail_bcc</applyto>
+ <owner>evolution-mail</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Show "Bcc" field when sending a mail message</short>
+ <long>
+ Show the "Bcc" field when sending a mail message. This is
+ controlled from the View menu when a mail account is chosen.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/evolution/mail/composer/show_mail_cc</key>
+ <applyto>/apps/evolution/mail/composer/show_mail_cc</applyto>
<owner>evolution-mail</owner>
<type>bool</type>
<default>true</default>
<locale name="C">
- <short>View/From menu item is checked</short>
+ <short>Show "Cc" field when sending a mail message</short>
<long>
- View/From menu item is checked.
+ Show the "Cc" field when sending a mail message. This is
+ controlled from the View menu when a mail account is chosen.
</long>
</locale>
</schema>
<schema>
- <key>/schemas/apps/evolution/mail/composer/view/PostTo</key>
- <applyto>/apps/evolution/mail/composer/view/PostTo</applyto>
+ <key>/schemas/apps/evolution/mail/composer/show_mail_from</key>
+ <applyto>/apps/evolution/mail/composer/show_mail_from</applyto>
<owner>evolution-mail</owner>
<type>bool</type>
<default>true</default>
<locale name="C">
- <short>View/PostTo menu item is checked</short>
+ <short>Show "From" field when sending a mail message</short>
<long>
- View/PostTo menu item is checked.
+ Show the "From" field when sending a mail message. This is
+ controlled from the View menu when a mail account is chosen.
</long>
</locale>
</schema>
<schema>
- <key>/schemas/apps/evolution/mail/composer/view/ReplyTo</key>
- <applyto>/apps/evolution/mail/composer/view/ReplyTo</applyto>
+ <key>/schemas/apps/evolution/mail/composer/show_mail_reply_to</key>
+ <applyto>/apps/evolution/mail/composer/show_mail_reply_to</applyto>
<owner>evolution-mail</owner>
<type>bool</type>
<default>false</default>
<locale name="C">
- <short>View/ReplyTo menu item is checked</short>
+ <short>Show "Reply To" field when sending a mail message</short>
<long>
- View/ReplyTo menu item is checked.
+ Show the "Reply To" field when sending a mail message. This
+ is controlled from the View menu when a mail account is chosen.
</long>
</locale>
</schema>
<schema>
- <key>/schemas/apps/evolution/mail/composer/view/Cc</key>
- <applyto>/apps/evolution/mail/composer/view/Cc</applyto>
+ <key>/schemas/apps/evolution/mail/composer/show_post_from</key>
+ <applyto>/apps/evolution/mail/composer/show_post_from</applyto>
<owner>evolution-mail</owner>
<type>bool</type>
- <default>false</default>
+ <default>true</default>
<locale name="C">
- <short>View/Cc menu item is checked</short>
+ <short>Show "From" field when posting to a newsgroup</short>
<long>
- View/Cc menu item is checked.
+ Show the "From" field when posting to a newsgroup. This is
+ controlled from the View menu when a news account is chosen.
</long>
</locale>
</schema>
<schema>
- <key>/schemas/apps/evolution/mail/composer/view/Bcc</key>
- <applyto>/apps/evolution/mail/composer/view/Bcc</applyto>
+ <key>/schemas/apps/evolution/mail/composer/show_post_reply_to</key>
+ <applyto>/apps/evolution/mail/composer/show_post_reply_to</applyto>
<owner>evolution-mail</owner>
<type>bool</type>
<default>false</default>
<locale name="C">
- <short>View/Bcc menu item is checked</short>
+ <short>Show "Reply To" field when posting to a newsgroup</short>
<long>
- View/Bcc menu item is checked.
+ Show the "Reply To" field when posting to a newsgroup. This
+ is controlled from the View menu when a news account is chosen.
</long>
</locale>
</schema>