/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2006 Hiroyuki Yamamoto and the Claws Mail team
+ * Copyright (C) 1999-2007 Hiroyuki Yamamoto and the Claws Mail team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
COMPOSE_INSERT_NO_FILE
} ComposeInsertResult;
-typedef enum
-{
- COMPOSE_QUIT_EDITING,
- COMPOSE_KEEP_EDITING,
- COMPOSE_AUTO_SAVE
-} ComposeDraftAction;
-
typedef enum
{
COMPOSE_WRITE_FOR_SEND,
static GList *compose_list = NULL;
-Compose *compose_generic_new (PrefsAccount *account,
+static Compose *compose_generic_new (PrefsAccount *account,
const gchar *to,
FolderItem *item,
GPtrArray *attach_files,
ComposeMode mode,
gboolean batch);
+static void compose_entry_mark_default_to (Compose *compose,
+ const gchar *address);
+static Compose *compose_followup_and_reply_to (MsgInfo *msginfo,
+ gboolean quote,
+ gboolean to_all,
+ gboolean to_sender,
+ const gchar *body);
+static Compose *compose_forward_multiple (PrefsAccount *account,
+ GSList *msginfo_list);
+static Compose *compose_reply (MsgInfo *msginfo,
+ gboolean quote,
+ gboolean to_all,
+ gboolean to_ml,
+ gboolean to_sender,
+ const gchar *body);
+static Compose *compose_reply_mode (ComposeMode mode,
+ GSList *msginfo_list,
+ gchar *body);
+static void compose_template_apply_fields(Compose *compose, Template *tmpl);
+static void compose_update_privacy_systems_menu(Compose *compose);
+
static GtkWidget *compose_account_option_menu_create
(Compose *compose);
static void compose_set_out_encoding (Compose *compose);
static gboolean compose_check_for_valid_recipient
(Compose *compose);
static gboolean compose_check_entries (Compose *compose,
- gboolean check_subject);
+ gboolean check_everything);
static gint compose_write_to_file (Compose *compose,
FILE *fp,
gint action,
const gchar *file);
static gint compose_remove_reedit_target (Compose *compose,
gboolean force);
-void compose_remove_draft (Compose *compose);
+static void compose_remove_draft (Compose *compose);
static gint compose_queue_sub (Compose *compose,
gint *msgnum,
FolderItem **item,
gboolean followup_and_reply_to,
const gchar *body);
-gboolean compose_headerentry_changed_cb (GtkWidget *entry,
+static gboolean compose_headerentry_changed_cb (GtkWidget *entry,
ComposeHeaderEntry *headerentry);
-gboolean compose_headerentry_key_press_event_cb(GtkWidget *entry,
+static gboolean compose_headerentry_key_press_event_cb(GtkWidget *entry,
GdkEventKey *event,
ComposeHeaderEntry *headerentry);
static MsgInfo *compose_msginfo_new_from_compose(Compose *compose);
+#ifdef USE_ASPELL
+static void compose_set_dictionaries_from_folder_prefs(Compose *compose,
+ FolderItem *folder_item);
+#endif
+
static GtkItemFactoryEntry compose_popup_entries[] =
{
{N_("/_Add..."), NULL, compose_attach_cb, 0, NULL},
static GtkItemFactoryEntry compose_entries[] =
{
{N_("/_Message"), NULL, NULL, 0, "<Branch>"},
- {N_("/_Message/_Send"), "<control>Return",
+ {N_("/_Message/S_end"), "<control>Return",
compose_send_cb, 0, NULL},
{N_("/_Message/Send _later"), "<shift><control>S",
compose_send_later_cb, 0, NULL},
undo_block(compose->undostruct);
#ifdef USE_ASPELL
- if (item && item->prefs && item->prefs->enable_default_dictionary &&
- compose->gtkaspell) {
- gtkaspell_change_dict(compose->gtkaspell,
- item->prefs->default_dictionary);
- compose_spell_menu_changed(compose);
- }
+ compose_set_dictionaries_from_folder_prefs(compose, item);
#endif
if (account->auto_sig)
}
}
if (privacy != NULL) {
- compose->privacy_system = g_strdup(privacy);
+ if (compose->privacy_system == NULL)
+ compose->privacy_system = g_strdup(privacy);
compose_update_privacy_system_menu_item(compose, FALSE);
compose_use_encryption(compose, TRUE);
}
}
}
if (privacy != NULL) {
- compose->privacy_system = g_strdup(privacy);
+ if (compose->privacy_system == NULL)
+ compose->privacy_system = g_strdup(privacy);
compose_update_privacy_system_menu_item(compose, FALSE);
compose_use_signing(compose, TRUE);
}
}
-Compose *compose_reply_mode(ComposeMode mode, GSList *msginfo_list, gchar *body)
+static Compose *compose_reply_mode(ComposeMode mode, GSList *msginfo_list, gchar *body)
{
MsgInfo *msginfo;
guint list_len;
return compose;
}
-Compose *compose_reply(MsgInfo *msginfo, gboolean quote, gboolean to_all,
+static Compose *compose_reply(MsgInfo *msginfo, gboolean quote, gboolean to_all,
gboolean to_ml, gboolean to_sender,
const gchar *body)
{
to_sender, FALSE, body);
}
-Compose *compose_followup_and_reply_to(MsgInfo *msginfo, gboolean quote,
+static Compose *compose_followup_and_reply_to(MsgInfo *msginfo, gboolean quote,
gboolean to_all,
gboolean to_sender,
const gchar *body)
undo_block(compose->undostruct);
#ifdef USE_ASPELL
- if (msginfo->folder && msginfo->folder->prefs &&
- msginfo->folder->prefs &&
- msginfo->folder->prefs->enable_default_dictionary &&
- compose->gtkaspell) {
- gtkaspell_change_dict(compose->gtkaspell,
- msginfo->folder->prefs->default_dictionary);
- compose_spell_menu_changed(compose);
- }
+ compose_set_dictionaries_from_folder_prefs(compose, msginfo->folder);
#endif
if (quote) {
#undef INSERT_FW_HEADER
-Compose *compose_forward_multiple(PrefsAccount *account, GSList *msginfo_list)
+static Compose *compose_forward_multiple(PrefsAccount *account, GSList *msginfo_list)
{
Compose *compose;
GtkTextView *textview;
gint id, param;
/* Select Account from queue headers */
+ if (!procheader_get_header_from_msginfo(msginfo, queueheader_buf,
+ sizeof(queueheader_buf), "X-Claws-Account-Id:")) {
+ id = atoi(&queueheader_buf[strlen("X-Claws-Account-Id:")]);
+ account = account_find_from_id(id);
+ }
if (!procheader_get_header_from_msginfo(msginfo, queueheader_buf,
sizeof(queueheader_buf), "X-Sylpheed-Account-Id:")) {
id = atoi(&queueheader_buf[strlen("X-Sylpheed-Account-Id:")]);
sizeof(queueheader_buf), "S:")) {
account = account_find_from_address(queueheader_buf);
}
+ if (!procheader_get_header_from_msginfo(msginfo, queueheader_buf,
+ sizeof(queueheader_buf), "X-Claws-Sign:")) {
+ param = atoi(&queueheader_buf[strlen("X-Claws-Sign:")]);
+ use_signing = param;
+
+ }
if (!procheader_get_header_from_msginfo(msginfo, queueheader_buf,
sizeof(queueheader_buf), "X-Sylpheed-Sign:")) {
param = atoi(&queueheader_buf[strlen("X-Sylpheed-Sign:")]);
use_signing = param;
}
+ if (!procheader_get_header_from_msginfo(msginfo, queueheader_buf,
+ sizeof(queueheader_buf), "X-Claws-Encrypt:")) {
+ param = atoi(&queueheader_buf[strlen("X-Claws-Encrypt:")]);
+ use_encryption = param;
+ }
if (!procheader_get_header_from_msginfo(msginfo, queueheader_buf,
sizeof(queueheader_buf), "X-Sylpheed-Encrypt:")) {
param = atoi(&queueheader_buf[strlen("X-Sylpheed-Encrypt:")]);
use_encryption = param;
}
+ if (!procheader_get_header_from_msginfo(msginfo, queueheader_buf,
+ sizeof(queueheader_buf), "X-Claws-Privacy-System:")) {
+ privacy_system = g_strdup(&queueheader_buf[strlen("X-Claws-Privacy-System:")]);
+ }
if (!procheader_get_header_from_msginfo(msginfo, queueheader_buf,
sizeof(queueheader_buf), "X-Sylpheed-Privacy-System:")) {
privacy_system = g_strdup(&queueheader_buf[strlen("X-Sylpheed-Privacy-System:")]);
}
}
-void compose_entry_mark_default_to(Compose *compose, const gchar *mailto)
+static void compose_entry_mark_default_to(Compose *compose, const gchar *mailto)
{
static GdkColor yellow;
static GdkColor black;
msginfo->from ? msginfo->from : "",
COMPOSE_TO);
else if (!to_all && !to_sender) {
- /* reply to the last list of recipients */
- compose_entry_append(compose,
- msginfo->from ? msginfo->from : "",
- COMPOSE_TO);
- compose_entry_append(compose,
- msginfo->cc ? msginfo->cc : "",
- COMPOSE_CC);
+ if (!folder_has_parent_of_type(msginfo->folder, F_QUEUE) &&
+ !folder_has_parent_of_type(msginfo->folder, F_OUTBOX) &&
+ !folder_has_parent_of_type(msginfo->folder, F_DRAFT)) {
+ compose_entry_append(compose,
+ msginfo->from ? msginfo->from : "",
+ COMPOSE_TO);
+ } else {
+ /* replying to own mail, use original recp */
+ compose_entry_append(compose,
+ msginfo->to ? msginfo->to : "",
+ COMPOSE_TO);
+ compose_entry_append(compose,
+ msginfo->cc ? msginfo->cc : "",
+ COMPOSE_CC);
+ }
}
}
} else {
to_table = g_hash_table_new(g_str_hash, g_str_equal);
if (replyto)
- g_hash_table_insert(to_table, g_strdup(replyto), GINT_TO_POINTER(1));
- if (compose->account)
- g_hash_table_insert(to_table, g_strdup(compose->account->address),
+ g_hash_table_insert(to_table, g_utf8_strdown(replyto, -1), GINT_TO_POINTER(1));
+ if (compose->account) {
+ g_hash_table_insert(to_table, g_utf8_strdown(compose->account->address, -1),
GINT_TO_POINTER(1));
-
+ }
/* remove address on To: and that of current account */
for (cur = cc_list; cur != NULL; ) {
GSList *next = cur->next;
gchar *addr;
- addr = g_strdup(cur->data);
+ addr = g_utf8_strdown(cur->data, -1);
extract_address(addr);
if (GPOINTER_TO_INT(g_hash_table_lookup(to_table, addr)) == 1)
gboolean has_binary = FALSE;
if (!is_file_exist(file)) {
+ gchar *file_from_uri = g_filename_from_uri(file, NULL, NULL);
+ gboolean result = FALSE;
+ if (file_from_uri && is_file_exist(file_from_uri)) {
+ result = compose_attach_append(
+ compose, file_from_uri,
+ filename,
+ content_type);
+ }
+ g_free(file_from_uri);
+ if (result)
+ return TRUE;
alertpanel_error("File %s doesn't exist\n", filename);
return FALSE;
}
child = (MimeInfo *) mimeinfo->node->children->data;
while (child != NULL) {
+ gint err;
+
if (child == encrypted) {
/* skip this part of tree */
NEXT_PART_NOT_CHILD(child);
}
outfile = procmime_get_tmp_file_name(child);
- if (procmime_get_part(outfile, child) < 0)
- g_warning("Can't get the part of multipart message.");
+ if ((err = procmime_get_part(outfile, child)) < 0)
+ g_warning("Can't get the part of multipart message. (%s)", strerror(-err));
else {
gchar *content_type;
/* if we meet a pgp signature, we don't attach it, but
* we force signing. */
- if (strcmp(content_type, "application/pgp-signature")) {
+ if (strcmp(content_type, "application/pgp-signature") &&
+ strcmp(content_type, "application/pkcs7-signature") &&
+ strcmp(content_type, "application/x-pkcs7-signature")) {
partname = procmime_mimeinfo_get_parameter(child, "filename");
if (partname == NULL)
partname = procmime_mimeinfo_get_parameter(child, "name");
compose_insert_sig(compose, TRUE);
undo_unblock(compose->undostruct);
}
+
+#ifdef USE_ASPELL
+ /* use account's dict info if set */
+ if (compose->gtkaspell) {
+ if (account->enable_default_dictionary)
+ gtkaspell_change_dict(compose->gtkaspell,
+ account->default_dictionary, FALSE);
+ if (account->enable_default_alt_dictionary)
+ gtkaspell_change_alt_dict(compose->gtkaspell,
+ account->default_alt_dictionary);
+ if (account->enable_default_dictionary
+ || account->enable_default_alt_dictionary)
+ compose_spell_menu_changed(compose);
+ }
+#endif
}
gboolean compose_check_for_valid_recipient(Compose *compose) {
return TRUE;
}
-static gboolean compose_check_entries(Compose *compose, gboolean check_subject)
+static gboolean compose_check_entries(Compose *compose, gboolean check_everything)
{
const gchar *str;
if (!compose->batch) {
str = gtk_entry_get_text(GTK_ENTRY(compose->subject_entry));
- if (*str == '\0' && check_subject == TRUE) {
+ if (*str == '\0' && check_everything == TRUE &&
+ compose->mode != COMPOSE_REDIRECT) {
AlertValue aval;
aval = alertpanel(_("Send"),
}
}
- if (hooks_invoke(COMPOSE_CHECK_BEFORE_SEND_HOOKLIST, compose))
+ if (check_everything && hooks_invoke(COMPOSE_CHECK_BEFORE_SEND_HOOKLIST, compose))
return FALSE;
return TRUE;
gchar *errstr = NULL;
gchar *tmsgid = NULL;
MainWindow *mainwin = mainwindow_get_mainwindow();
+ gboolean queued_removed = FALSE;
if (prefs_common.send_dialog_mode != SEND_DIALOG_ALWAYS
|| compose->batch == TRUE)
}
if (msgpath == NULL) {
msgpath = folder_item_fetch_msg(folder, msgnum);
- val = procmsg_send_message_queue(msgpath, &errstr, folder, msgnum);
+ val = procmsg_send_message_queue(msgpath, &errstr, folder, msgnum, &queued_removed);
g_free(msgpath);
} else {
- val = procmsg_send_message_queue(msgpath, &errstr, folder, msgnum);
+ val = procmsg_send_message_queue(msgpath, &errstr, folder, msgnum, &queued_removed);
g_unlink(msgpath);
g_free(msgpath);
}
compose->sending = FALSE;
compose_allow_user_actions (compose, TRUE);
if (val != 0) {
- folder_item_remove_msg(folder, msgnum);
+ if (!queued_removed)
+ folder_item_remove_msg(folder, msgnum);
folder_item_scan(folder);
if (tmsgid) {
/* make sure we delete that */
}
if (val == 0) {
- folder_item_remove_msg(folder, msgnum);
+ if (!queued_removed)
+ folder_item_remove_msg(folder, msgnum);
folder_item_scan(folder);
if (tmsgid) {
/* make sure we delete that */
"SSH:", "R:", "MAID:",
"NAID:", "RMID:", "FMID:",
"SCF:", "RRCPT:", "NG:",
+ "X-Claws-Privacy", "X-Claws-Sign:", "X-Claws-Encrypt",
+ "X-Claws-End-Special-Headers:", "X-Claws-Account-Id:",
"X-Sylpheed-Privacy", "X-Sylpheed-Sign:", "X-Sylpheed-Encrypt",
- "X-Sylpheed-End-Special-Headers:",
+ "X-Sylpheed-End-Special-Headers:", "X-Sylpheed-Account-Id:",
NULL
};
if ((fp = g_fopen(compose->redirect_filename, "rb")) == NULL) {
return 0;
}
-void compose_remove_draft(Compose *compose)
+static void compose_remove_draft(Compose *compose)
{
FolderItem *drafts;
MsgInfo *msginfo = compose->targetinfo;
if (compose->privacy_system != NULL) {
- fprintf(fp, "X-Sylpheed-Privacy-System:%s\n", compose->privacy_system);
- fprintf(fp, "X-Sylpheed-Sign:%d\n", compose->use_signing);
+ fprintf(fp, "X-Claws-Privacy-System:%s\n", compose->privacy_system);
+ fprintf(fp, "X-Claws-Sign:%d\n", compose->use_signing);
if (compose->use_encryption) {
gchar *encdata;
if (mailac && mailac->encrypt_to_self) {
}
if (encdata != NULL) {
if (strcmp(encdata, "_DONT_ENCRYPT_")) {
- fprintf(fp, "X-Sylpheed-Encrypt:%d\n", compose->use_encryption);
- fprintf(fp, "X-Sylpheed-Encrypt-Data:%s\n",
+ fprintf(fp, "X-Claws-Encrypt:%d\n", compose->use_encryption);
+ fprintf(fp, "X-Claws-Encrypt-Data:%s\n",
encdata);
} /* else we finally dont want to encrypt */
} else {
- fprintf(fp, "X-Sylpheed-Encrypt:%d\n", compose->use_encryption);
+ fprintf(fp, "X-Claws-Encrypt:%d\n", compose->use_encryption);
/* and if encdata was null, it means there's been a problem in
* key selection */
lock = FALSE;
}
/* end of headers */
- fprintf(fp, "X-Sylpheed-End-Special-Headers: 1\n");
+ fprintf(fp, "X-Claws-End-Special-Headers: 1\n");
if (compose->redirect_filename != NULL) {
if (compose_redirect_write_to_file(compose, fp) < 0) {
return header_scrolledwin ;
}
-GtkWidget *compose_create_attach(Compose *compose)
+static GtkWidget *compose_create_attach(Compose *compose)
{
GtkWidget *attach_scrwin;
GtkWidget *attach_clist;
compose->tooltips = gtk_tooltips_new();
- window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "compose");
gtk_window_set_resizable(GTK_WINDOW(window), TRUE);
gtk_widget_set_size_request(window, -1, prefs_common.compose_height);
gtk_box_pack_start(GTK_BOX(subject_hbox), subject_frame, TRUE, TRUE, 0);
gtk_widget_show(subject_frame);
- subject = gtk_hbox_new(FALSE, 0);
+ subject = gtk_hbox_new(FALSE, HSPACING_NARROW);
gtk_container_set_border_width(GTK_CONTAINER(subject), 0);
gtk_widget_show(subject);
strcmp(prefs_common.dictionary, "")) {
gtkaspell = gtkaspell_new(prefs_common.aspell_path,
prefs_common.dictionary,
+ prefs_common.alt_dictionary,
conv_get_locale_charset_str(),
prefs_common.misspelled_col,
prefs_common.check_while_typing,
prefs_common.recheck_when_changing_dict,
prefs_common.use_alternate,
+ prefs_common.use_both_dicts,
GTK_TEXT_VIEW(text),
GTK_WINDOW(compose->window),
compose_spell_menu_changed,
action_update_compose_menu(ifactory, "/Tools/Actions", compose);
}
-void compose_update_privacy_systems_menu(Compose *compose)
+static void compose_update_privacy_systems_menu(Compose *compose)
{
static gchar *branch_path = "/Options/Privacy System";
GtkItemFactory *ifactory;
compose_changed_cb(NULL, compose);
}
-void compose_template_apply_fields(Compose *compose, Template *tmpl)
+static void compose_template_apply_fields(Compose *compose, Template *tmpl)
{
MsgInfo* dummyinfo = NULL;
MsgInfo *msginfo = NULL;
buf = quote_fmt_get_buffer();
if (buf == NULL) {
- alertpanel_error(_("Message To format error."));
+ alertpanel_error(_("Template To format error."));
} else {
compose_entry_append(compose, buf, COMPOSE_TO);
}
buf = quote_fmt_get_buffer();
if (buf == NULL) {
- alertpanel_error(_("Message Cc format error."));
+ alertpanel_error(_("Template Cc format error."));
} else {
compose_entry_append(compose, buf, COMPOSE_CC);
}
buf = quote_fmt_get_buffer();
if (buf == NULL) {
- alertpanel_error(_("Message Bcc format error."));
+ alertpanel_error(_("Template Bcc format error."));
} else {
compose_entry_append(compose, buf, COMPOSE_BCC);
}
buf = quote_fmt_get_buffer();
if (buf == NULL) {
- alertpanel_error(_("Message subject format error."));
+ alertpanel_error(_("Template subject format error."));
} else {
gtk_entry_set_text(GTK_ENTRY(compose->subject_entry), buf);
}
debug_print("Creating attach_property window...\n");
- window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "compose_attach_property");
gtk_widget_set_size_request(window, 480, -1);
gtk_container_set_border_width(GTK_CONTAINER(window), 8);
gtk_window_set_title(GTK_WINDOW(window), _("Properties"));
toolbar_main_set_sensitive(mainwindow_get_mainwindow());
}
-void compose_draft (gpointer data)
+void compose_draft (gpointer data, guint action)
+{
+ compose_draft_cb(data, action, NULL);
+}
+
+#define DRAFTED_AT_EXIT "drafted_at_exit"
+void compose_clear_exit_drafts(void)
+{
+ gchar *filepath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
+ DRAFTED_AT_EXIT, NULL);
+ if (is_file_exist(filepath))
+ g_unlink(filepath);
+
+ g_free(filepath);
+}
+
+static void compose_register_draft(MsgInfo *info)
{
- compose_draft_cb(data, COMPOSE_QUIT_EDITING, NULL);
+ gchar *filepath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
+ DRAFTED_AT_EXIT, NULL);
+ FILE *fp = fopen(filepath, "ab");
+
+ if (fp) {
+ fprintf(fp, "%s\t%d\n", folder_item_get_identifier(info->folder),
+ info->msgnum);
+ fclose(fp);
+ }
+
+ g_free(filepath);
+}
+
+void compose_reopen_exit_drafts(void)
+{
+ gchar *filepath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
+ DRAFTED_AT_EXIT, NULL);
+ FILE *fp = fopen(filepath, "rb");
+ gchar buf[1024];
+
+ if (fp) {
+ while (fgets(buf, sizeof(buf), fp)) {
+ gchar **parts = g_strsplit(buf, "\t", 2);
+ const gchar *folder = parts[0];
+ int msgnum = parts[1] ? atoi(parts[1]):-1;
+
+ if (folder && *folder && msgnum > -1) {
+ FolderItem *item = folder_find_item_from_identifier(folder);
+ MsgInfo *info = folder_item_get_msginfo(item, msgnum);
+ if (info)
+ compose_reedit(info, FALSE);
+ }
+ g_strfreev(parts);
+ }
+ fclose(fp);
+ }
+ g_free(filepath);
+ compose_clear_exit_drafts();
}
static void compose_draft_cb(gpointer data, guint action, GtkWidget *widget)
}
/* Save draft infos */
- fprintf(fp, "X-Sylpheed-Account-Id:%d\n", compose->account->account_id);
+ fprintf(fp, "X-Claws-Account-Id:%d\n", compose->account->account_id);
fprintf(fp, "S:%s\n", compose->account->address);
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(compose->savemsg_checkbtn))) {
fprintf(fp, "RRCPT:1\n");
}
if (compose->privacy_system) {
- fprintf(fp, "X-Sylpheed-Sign:%d\n", compose->use_signing);
- fprintf(fp, "X-Sylpheed-Encrypt:%d\n", compose->use_encryption);
- fprintf(fp, "X-Sylpheed-Privacy-System:%s\n", compose->privacy_system);
+ fprintf(fp, "X-Claws-Sign:%d\n", compose->use_signing);
+ fprintf(fp, "X-Claws-Encrypt:%d\n", compose->use_encryption);
+ fprintf(fp, "X-Claws-Privacy-System:%s\n", compose->privacy_system);
}
/* Message-ID of message replying to */
}
/* end of headers */
- fprintf(fp, "X-Sylpheed-End-Special-Headers: 1\n");
+ fprintf(fp, "X-Claws-End-Special-Headers: 1\n");
if (compose_write_to_file(compose, fp, COMPOSE_WRITE_FOR_STORE, action != COMPOSE_AUTO_SAVE) < 0) {
fclose(fp);
procmsg_msginfo_set_flags(newmsginfo, 0,
MSG_HAS_ATTACHMENT);
+ if (action == COMPOSE_DRAFT_FOR_EXIT) {
+ compose_register_draft(newmsginfo);
+ }
procmsg_msginfo_free(newmsginfo);
}
folder_item_scan(draft);
- if (action == COMPOSE_QUIT_EDITING) {
+ if (action == COMPOSE_QUIT_EDITING || action == COMPOSE_DRAFT_FOR_EXIT) {
lock = FALSE;
g_mutex_unlock(compose->mutex); /* must be done before closing */
compose_close(compose);
compose->remove_references = FALSE;
}
-gboolean compose_headerentry_key_press_event_cb(GtkWidget *entry,
+static gboolean compose_headerentry_key_press_event_cb(GtkWidget *entry,
GdkEventKey *event,
ComposeHeaderEntry *headerentry)
{
return FALSE;
}
-gboolean compose_headerentry_changed_cb(GtkWidget *entry,
+static gboolean compose_headerentry_changed_cb(GtkWidget *entry,
ComposeHeaderEntry *headerentry)
{
if (strlen(gtk_entry_get_text(GTK_ENTRY(entry))) != 0) {
return newmsginfo;
}
+#ifdef USE_ASPELL
+/* update compose's dictionaries from folder dict settings */
+static void compose_set_dictionaries_from_folder_prefs(Compose *compose,
+ FolderItem *folder_item)
+{
+ g_return_if_fail(compose != NULL);
+
+ if (compose->gtkaspell && folder_item && folder_item->prefs) {
+ FolderItemPrefs *prefs = folder_item->prefs;
+
+ if (prefs->enable_default_dictionary)
+ gtkaspell_change_dict(compose->gtkaspell,
+ prefs->default_dictionary, FALSE);
+ if (folder_item->prefs->enable_default_alt_dictionary)
+ gtkaspell_change_alt_dict(compose->gtkaspell,
+ prefs->default_alt_dictionary);
+ if (prefs->enable_default_dictionary
+ || prefs->enable_default_alt_dictionary)
+ compose_spell_menu_changed(compose);
+ }
+}
+#endif
+
/*
* End of Source.
*/