diff options
author | Dan Winship <danw@src.gnome.org> | 2001-03-29 01:48:08 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2001-03-29 01:48:08 +0800 |
commit | 4eef2ce98d250137b69ae4a551c2997bb4b0cc8d (patch) | |
tree | 1a737881b18b009ac711b3d64d3e2bf4e3937127 | |
parent | b38a35a5187475b13210474cea7140025793b502 (diff) | |
download | gsoc2013-evolution-4eef2ce98d250137b69ae4a551c2997bb4b0cc8d.tar.gz gsoc2013-evolution-4eef2ce98d250137b69ae4a551c2997bb4b0cc8d.tar.zst gsoc2013-evolution-4eef2ce98d250137b69ae4a551c2997bb4b0cc8d.zip |
Use the drafts folder specified by the account, if possible. Also, fix the
* e-msg-composer.c (save_draft): Use the drafts folder specified
by the account, if possible. Also, fix the setting of "send_html"
after saving the draft in case the user plans to keep editting...
svn path=/trunk/; revision=8992
-rw-r--r-- | composer/ChangeLog | 6 | ||||
-rw-r--r-- | composer/e-msg-composer.c | 58 |
2 files changed, 60 insertions, 4 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog index 73e39d72df..d723dab631 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,9 @@ +2001-03-28 Dan Winship <danw@ximian.com> + + * e-msg-composer.c (save_draft): Use the drafts folder specified + by the account, if possible. Also, fix the setting of "send_html" + after saving the draft in case the user plans to keep editting... + 2001-03-27 Larry Ewing <lewing@ximian.com> * e-msg-composer.c (e_msg_composer_set_send_html): set the diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 1b5aeb003b..1080453391 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -55,6 +55,7 @@ #include "mail/mail-crypto.h" #include "mail/mail-tools.h" #include "mail/mail-ops.h" +#include "mail/mail-mt.h" #include "e-util/e-html-utils.h" #include <gal/widgets/e-gui-utils.h> @@ -762,16 +763,65 @@ save_done (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *info, i g_free (si); } +extern CamelFolder *drafts_folder; +extern char *default_drafts_folder_uri; + +static void +use_default_drafts_cb (gint reply, gpointer data) +{ + CamelFolder **folder = data; + + if (reply == 0) + *folder = drafts_folder; +} + +static void +save_folder (char *uri, CamelFolder *folder, gpointer data) +{ + CamelFolder **save = data; + + if (folder) { + *save = folder; + camel_object_ref (CAMEL_OBJECT (folder)); + } +} + static void save_draft (EMsgComposer *composer, int quitok) { CamelMimeMessage *msg; CamelMessageInfo *info; - extern CamelFolder *drafts_folder; + const MailConfigAccount *account; struct _save_info *si; - - composer->send_html = TRUE; /* always save drafts as HTML to keep formatting */ + gboolean old_send_html; + CamelFolder *folder = NULL; + + account = e_msg_composer_get_preferred_account (composer); + if (account && account->drafts_folder_uri && + strcmp (account->drafts_folder_uri, default_drafts_folder_uri) != 0) { + int id; + + id = mail_get_folder (account->drafts_folder_uri, save_folder, &folder); + mail_msg_wait (id); + + if (!folder) { + GtkWidget *dialog; + + dialog = gnome_ok_cancel_dialog_parented (_("Unable to open the drafts folder for this account.\n" + "Would you like to use the default drafts folder?"), + use_default_drafts_cb, &folder, GTK_WINDOW (composer)); + gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); + if (!folder) + return; + } + } else + folder = drafts_folder; + + /* always save drafts as HTML to keep formatting */ + old_send_html = composer->send_html; + composer->send_html = TRUE; msg = e_msg_composer_get_message (composer); + composer->send_html = old_send_html; info = g_new0 (CamelMessageInfo, 1); info->flags = CAMEL_MESSAGE_DRAFT; @@ -781,7 +831,7 @@ save_draft (EMsgComposer *composer, int quitok) gtk_object_ref (GTK_OBJECT (composer)); si->quitok = quitok; - mail_append_mail (drafts_folder, msg, info, save_done, si); + mail_append_mail (folder, msg, info, save_done, si); camel_object_unref (CAMEL_OBJECT (msg)); } |