#include "privacy.h"
#include "timing.h"
#include "autofaces.h"
+#include "spell_entry.h"
enum
{
(Compose *compose);
static void compose_set_out_encoding (Compose *compose);
static void compose_set_template_menu (Compose *compose);
-static void compose_template_apply (Compose *compose,
- Template *tmpl,
- gboolean replace);
static void compose_destroy (Compose *compose);
static void compose_entries_set (Compose *compose,
gchar **msgpath,
gboolean check_subject,
gboolean remove_reedit_target);
-static void compose_add_attachments (Compose *compose,
+static int compose_add_attachments (Compose *compose,
MimeInfo *parent);
static gchar *compose_get_header (Compose *compose);
static void compose_attach_remove_selected (GtkAction *action,
gpointer data);
+static void compose_template_apply (Compose *compose,
+ Template *tmpl,
+ gboolean replace);
static void compose_attach_property (GtkAction *action,
gpointer data);
static void compose_attach_property_create (gboolean *cancelled);
static void compose_update_priority_menu_item(Compose * compose);
#if USE_ENCHANT
static void compose_spell_menu_changed (void *data);
+static void compose_dict_changed (void *data);
#endif
static void compose_add_field_list ( Compose *compose,
GList *listAddress );
static gboolean compose_headerentry_key_press_event_cb(GtkWidget *entry,
GdkEventKey *event,
ComposeHeaderEntry *headerentry);
+static gboolean compose_headerentry_button_clicked_cb (GtkWidget *button,
+ ComposeHeaderEntry *headerentry);
static void compose_show_first_last_header (Compose *compose, gboolean show_first);
/* if no account prefs set, fallback to the current one */
if (!account) account = cur_account;
- g_return_val_if_fail(account != NULL, NULL);
+ cm_return_val_if_fail(account != NULL, NULL);
compose = compose_create(account, item, COMPOSE_NEW, FALSE);
if (mailto && *mailto != '\0') {
compose_entries_set(compose, mailto, COMPOSE_TO);
- } else if (item && item->prefs->enable_default_to) {
- compose_entry_append(compose, item->prefs->default_to, COMPOSE_TO);
- compose_entry_mark_default_to(compose, item->prefs->default_to);
+ } else if (item && item->prefs) {
+ if (item->prefs->enable_default_bcc) {
+ compose_entry_append(compose, item->prefs->default_bcc, COMPOSE_BCC);
+ }
+ if (item->prefs->enable_default_cc) {
+ compose_entry_append(compose, item->prefs->default_cc, COMPOSE_CC);
+ }
+ if (item->prefs->enable_default_replyto) {
+ compose_entry_append(compose, item->prefs->default_replyto, COMPOSE_REPLYTO);
+ }
+ if (item->prefs->enable_default_to) {
+ compose_entry_append(compose, item->prefs->default_to, COMPOSE_TO);
+ compose_entry_mark_default_to(compose, item->prefs->default_to);
+ }
}
if (item && item->ret_rcpt) {
cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/RequestRetRcpt", TRUE);
compose_quote_fmt(compose, dummyinfo,
body_format,
NULL, tmp, FALSE, TRUE,
- _("New message body format error at line %d."));
+ _("The body of the \"New message\" template has an error at line %d."));
compose_attach_from_list(compose, quote_fmt_get_attachments_list(), FALSE);
quote_fmt_reset_vartable();
{
const gchar *privacy = NULL;
- g_return_if_fail(compose != NULL);
- g_return_if_fail(account != NULL);
+ cm_return_if_fail(compose != NULL);
+ cm_return_if_fail(account != NULL);
if (override_pref == FALSE && account->default_encrypt_reply == FALSE)
return;
static void compose_force_signing(Compose *compose, PrefsAccount *account, const gchar *system)
{
- gchar *privacy = NULL;
+ const gchar *privacy = NULL;
if (system)
privacy = system;
guint list_len;
Compose *compose = NULL;
- g_return_val_if_fail(msginfo_list != NULL, NULL);
+ cm_return_val_if_fail(msginfo_list != NULL, NULL);
msginfo = (MsgInfo*)g_slist_nth_data(msginfo_list, 0);
- g_return_val_if_fail(msginfo != NULL, NULL);
+ cm_return_val_if_fail(msginfo != NULL, NULL);
list_len = g_slist_length(msginfo_list);
const gchar *body_fmt = NULL;
gchar *s_system = NULL;
START_TIMING("");
- g_return_val_if_fail(msginfo != NULL, NULL);
- g_return_val_if_fail(msginfo->folder != NULL, NULL);
+ cm_return_val_if_fail(msginfo != NULL, NULL);
+ cm_return_val_if_fail(msginfo->folder != NULL, NULL);
account = account_get_reply_account(msginfo, prefs_common.reply_account_autosel);
- g_return_val_if_fail(account != NULL, NULL);
+ cm_return_val_if_fail(account != NULL, NULL);
compose = compose_create(account, msginfo->folder, COMPOSE_REPLY, FALSE);
buf = quote_fmt_get_buffer();
if (buf == NULL)
- alertpanel_error(_("Message reply From format error."));
+ alertpanel_error(_("The \"From\" field of the \"Reply\" template contains an invalid email address."));
else
gtk_entry_set_text(GTK_ENTRY(compose->from_name), buf);
quote_fmt_reset_vartable();
qmark = "> ";
compose_quote_fmt(compose, compose->replyinfo,
body_fmt, qmark, body, FALSE, TRUE,
- _("Message reply format error at line %d."));
+ _("The body of the \"Reply\" template has an error at line %d."));
compose_attach_from_list(compose, quote_fmt_get_attachments_list(), FALSE);
quote_fmt_reset_vartable();
}
GtkTextBuffer *textbuf;
GtkTextIter iter;
- g_return_val_if_fail(msginfo != NULL, NULL);
- g_return_val_if_fail(msginfo->folder != NULL, NULL);
+ cm_return_val_if_fail(msginfo != NULL, NULL);
+ cm_return_val_if_fail(msginfo->folder != NULL, NULL);
if (!account &&
!(account = compose_guess_forward_account_from_msginfo
buf = quote_fmt_get_buffer();
if (buf == NULL)
- alertpanel_error(_("Message forward From format error."));
+ alertpanel_error(_("The \"From\" field of the \"Forward\" template contains an invalid email address."));
else
gtk_entry_set_text(GTK_ENTRY(compose->from_name), buf);
quote_fmt_reset_vartable();
compose_quote_fmt(compose, full_msginfo,
body_fmt, qmark, body, FALSE, TRUE,
- _("Message forward format error at line %d."));
+ _("The body of the \"Forward\" template has an error at line %d."));
compose_attach_from_list(compose, quote_fmt_get_attachments_list(), FALSE);
quote_fmt_reset_vartable();
compose_attach_parts(compose, msginfo);
gchar *msgfile;
gboolean single_mail = TRUE;
- g_return_val_if_fail(msginfo_list != NULL, NULL);
+ cm_return_val_if_fail(msginfo_list != NULL, NULL);
if (g_slist_length(msginfo_list) > 1)
single_mail = FALSE;
(msginfo_list->data)))
account = cur_account;
- g_return_val_if_fail(account != NULL, NULL);
+ cm_return_val_if_fail(account != NULL, NULL);
for (msginfo = msginfo_list; msginfo != NULL; msginfo = msginfo->next) {
- MSG_UNSET_PERM_FLAGS(((MsgInfo *)msginfo->data)->flags, MSG_REPLIED);
- MSG_SET_PERM_FLAGS(((MsgInfo *)msginfo->data)->flags, MSG_FORWARDED);
+ if (msginfo->data) {
+ MSG_UNSET_PERM_FLAGS(((MsgInfo *)msginfo->data)->flags, MSG_REPLIED);
+ MSG_SET_PERM_FLAGS(((MsgInfo *)msginfo->data)->flags, MSG_FORWARDED);
+ }
+ }
+
+ if (msginfo_list == NULL || msginfo_list->data == NULL) {
+ g_warning("no msginfo_list");
+ return NULL;
}
compose = compose_create(account, ((MsgInfo *)msginfo_list->data)->folder, COMPOSE_FORWARD, FALSE);
buf = quote_fmt_get_buffer();
if (buf == NULL)
- alertpanel_error(_("Message forward From format error."));
+ alertpanel_error(_("The \"From\" field of the \"Forward\" template contains an invalid email address."));
else
gtk_entry_set_text(GTK_ENTRY(compose->from_name), buf);
quote_fmt_reset_vartable();
gboolean autowrap = prefs_common.autowrap;
gboolean autoindent = prefs_common.auto_indent;
- g_return_val_if_fail(msginfo != NULL, NULL);
- g_return_val_if_fail(msginfo->folder != NULL, NULL);
+ cm_return_val_if_fail(msginfo != NULL, NULL);
+ cm_return_val_if_fail(msginfo->folder != NULL, NULL);
if (compose_put_existing_to_front(msginfo)) {
return NULL;
if (!account) {
account = cur_account;
}
- g_return_val_if_fail(account != NULL, NULL);
+ cm_return_val_if_fail(account != NULL, NULL);
compose = compose_create(account, msginfo->folder, COMPOSE_REEDIT, batch);
gchar *filename;
FolderItem *item;
- g_return_val_if_fail(msginfo != NULL, NULL);
+ cm_return_val_if_fail(msginfo != NULL, NULL);
if (!account)
account = account_get_reply_account(msginfo,
prefs_common.reply_account_autosel);
- g_return_val_if_fail(account != NULL, NULL);
+ cm_return_val_if_fail(account != NULL, NULL);
compose = compose_create(account, msginfo->folder, COMPOSE_REDIRECT, batch);
gtk_editable_set_editable(GTK_EDITABLE(compose->subject_entry), FALSE);
compose_quote_fmt(compose, msginfo, "%M", NULL, NULL, FALSE, FALSE,
- _("Message redirect format error at line %d."));
+ _("The body of the \"Redirect\" template has an error at line %d."));
quote_fmt_reset_vartable();
gtk_text_view_set_editable(GTK_TEXT_VIEW(compose->text), FALSE);
ToolbarItem *toolbar_item = (ToolbarItem*)data;
Compose *compose = (Compose*)toolbar_item->parent;
- g_return_if_fail(compose != NULL);
+ cm_return_if_fail(compose != NULL);
switch(action) {
case A_SEND:
FILE *fp;
- g_return_val_if_fail(msginfo != NULL, -1);
+ cm_return_val_if_fail(msginfo != NULL, -1);
if ((fp = procmsg_open_message(msginfo)) == NULL) return -1;
procheader_get_header_fields(fp, hentry);
buf = quote_fmt_get_buffer();
if (buf == NULL)
- alertpanel_error(_("Quote mark format error."));
+ alertpanel_error(_("The \"Quotation mark\" of the template is invalid."));
else
Xstrdup_a(quote_str, buf, goto error)
}
gboolean reply_to_ml = FALSE;
gboolean default_reply_to = FALSE;
- g_return_if_fail(compose->account != NULL);
- g_return_if_fail(msginfo != NULL);
+ cm_return_if_fail(compose->account != NULL);
+ cm_return_if_fail(msginfo != NULL);
reply_to_ml = to_ml && compose->ml_post;
msginfo->folder->prefs->enable_default_reply_to;
if (compose->account->protocol != A_NNTP) {
+ if (msginfo && msginfo->folder && msginfo->folder->prefs) {
+ if (msginfo->folder->prefs->enable_default_replyto) {
+ compose_entry_append(compose, msginfo->folder->prefs->default_replyto, COMPOSE_REPLYTO);
+ }
+ if (msginfo->folder->prefs->enable_default_bcc) {
+ compose_entry_append(compose, msginfo->folder->prefs->default_bcc, COMPOSE_BCC);
+ }
+ if (msginfo->folder->prefs->enable_default_cc) {
+ compose_entry_append(compose, msginfo->folder->prefs->default_cc, COMPOSE_CC);
+ }
+ }
if (reply_to_ml && !default_reply_to) {
gboolean is_subscr = is_subscription(compose->ml_post,
static void compose_reedit_set_entry(Compose *compose, MsgInfo *msginfo)
{
- g_return_if_fail(msginfo != NULL);
+ cm_return_if_fail(msginfo != NULL);
SET_ENTRY(subject_entry, msginfo->subject);
SET_ENTRY(from_name, msginfo->from);
gboolean found = FALSE;
gboolean exists = FALSE;
- g_return_if_fail(compose->account != NULL);
+ cm_return_if_fail(compose->account != NULL);
BLOCK_WRAP();
gboolean prev_autowrap;
gboolean badtxt = FALSE;
- g_return_val_if_fail(file != NULL, COMPOSE_INSERT_NO_FILE);
+ cm_return_val_if_fail(file != NULL, COMPOSE_INSERT_NO_FILE);
if ((fp = g_fopen(file, "rb")) == NULL) {
FILE_OP_ERROR(file, "fopen");
while (child && child->node->children && (child->type == MIMETYPE_MULTIPART))
child = (MimeInfo *)child->node->children->data;
- if (child->type == MIMETYPE_TEXT) {
- firsttext = child;
- debug_print("First text part found\n");
- } else if (compose->mode == COMPOSE_REEDIT &&
- child->type == MIMETYPE_APPLICATION &&
- !g_ascii_strcasecmp(child->subtype, "pgp-encrypted")) {
- encrypted = (MimeInfo *)child->node->parent->data;
+ if (child) {
+ if (child->type == MIMETYPE_TEXT) {
+ firsttext = child;
+ debug_print("First text part found\n");
+ } else if (compose->mode == COMPOSE_REEDIT &&
+ child->type == MIMETYPE_APPLICATION &&
+ !g_ascii_strcasecmp(child->subtype, "pgp-encrypted")) {
+ encrypted = (MimeInfo *)child->node->parent->data;
+ }
}
-
child = (MimeInfo *) mimeinfo->node->children->data;
while (child != NULL) {
gint err;
can_break = TRUE;
}
- debug_print("compose_get_line_break_pos(): do_break = %d, pos = %d, col = %d\n", do_break, pos, col);
+// debug_print("compose_get_line_break_pos(): do_break = %d, pos = %d, col = %d\n", do_break, pos, col);
g_free(attrs);
g_free(str);
{"https://", strcasestr, get_uri_part, make_uri_string},
{"ftp://", strcasestr, get_uri_part, make_uri_string},
{"sftp://", strcasestr, get_uri_part, make_uri_string},
+ {"gopher://",strcasestr, get_uri_part, make_uri_string},
{"www.", strcasestr, get_uri_part, make_http_string},
{"mailto:", strcasestr, get_uri_part, make_uri_string},
{"@", strcasestr, get_email_part, make_email_string}
quote_str = compose_get_quote_str(buffer, &iter, "e_len);
if (quote_str) {
- debug_print("compose_beautify_paragraph(): quote_str = '%s'\n", quote_str);
+// debug_print("compose_beautify_paragraph(): quote_str = '%s'\n", quote_str);
if (startq_offset == -1)
startq_offset = gtk_text_iter_get_offset(&iter);
quotelevel = get_quote_level(quote_str, prefs_common.quote_chars);
}
}
if (!modified) {
- debug_print("not modified, out after %d lines\n", lines);
+// debug_print("not modified, out after %d lines\n", lines);
goto end;
}
}
- debug_print("modified, out after %d lines\n", lines);
+// debug_print("modified, out after %d lines\n", lines);
end:
g_free(itemized_chars);
if (par_iter)
static void compose_select_account(Compose *compose, PrefsAccount *account,
gboolean init)
{
- gchar *from = NULL;
+ gchar *from = NULL, *header;
+ ComposeHeaderEntry *header_entry;
- g_return_if_fail(account != NULL);
+ cm_return_if_fail(account != NULL);
compose->account = account;
compose_insert_sig(compose, TRUE);
undo_unblock(compose->undostruct);
}
-
+
+ header_entry = (ComposeHeaderEntry *) compose->header_list->data;
+ header = gtk_combo_box_get_active_text(GTK_COMBO_BOX(header_entry->combo));
+
+ if (header && !strlen(gtk_entry_get_text(GTK_ENTRY(header_entry->entry)))) {
+ if (account->protocol == A_NNTP) {
+ if (!strcmp(header, _("To:")))
+ combobox_select_by_text(
+ GTK_COMBO_BOX(header_entry->combo),
+ _("Newsgroups:"));
+ } else {
+ if (!strcmp(header, _("Newsgroups:")))
+ combobox_select_by_text(
+ GTK_COMBO_BOX(header_entry->combo),
+ _("To:"));
+ }
+
+ }
+ g_free(header);
+
#ifdef USE_ENCHANT
/* use account's dict info if set */
if (compose->gtkaspell) {
/* struct utsname utsbuf; */
gboolean err = FALSE;
- g_return_val_if_fail(fp != NULL, -1);
- g_return_val_if_fail(compose->account != NULL, -1);
- g_return_val_if_fail(compose->account->address != NULL, -1);
+ cm_return_val_if_fail(fp != NULL, -1);
+ cm_return_val_if_fail(compose->account != NULL, -1);
+ cm_return_val_if_fail(compose->account->address != NULL, -1);
/* Resent-Date */
get_rfc822_date(buf, sizeof(buf));
g_node_append(mimempart->node, mimetext->node);
g_node_append(mimemsg->node, mimempart->node);
- compose_add_attachments(compose, mimempart);
+ if (compose_add_attachments(compose, mimempart) < 0)
+ return -1;
} else
g_node_append(mimemsg->node, mimetext->node);
FolderItem *item;
MsgInfo *msginfo = compose->targetinfo;
- g_return_val_if_fail(compose->mode == COMPOSE_REEDIT, -1);
+ cm_return_val_if_fail(compose->mode == COMPOSE_REEDIT, -1);
if (!msginfo) return -1;
if (!force && MSG_IS_LOCKED(msginfo->flags))
return 0;
item = msginfo->folder;
- g_return_val_if_fail(item != NULL, -1);
+ cm_return_val_if_fail(item != NULL, -1);
if (procmsg_msg_exist(msginfo) &&
(folder_has_parent_of_type(item, F_QUEUE) ||
gboolean err = FALSE;
debug_print("queueing message...\n");
- g_return_val_if_fail(compose->account != NULL, -1);
+ cm_return_val_if_fail(compose->account != NULL, -1);
lock = TRUE;
if (compose->newsgroup_list) {
if (compose->account->protocol == A_NNTP)
newsac = compose->account;
- else if (!newsac->protocol != A_NNTP) {
+ else {
lock = FALSE;
- alertpanel_error(_("No account for posting news available!"));
+ alertpanel_error(_("Selected account isn't NNTP: Posting is impossible."));
return -1;
}
}
return 0;
}
-static void compose_add_attachments(Compose *compose, MimeInfo *parent)
+static int compose_add_attachments(Compose *compose, MimeInfo *parent)
{
AttachInfo *ainfo;
GtkTreeView *tree_view = GTK_TREE_VIEW(compose->attach_clist);
model = gtk_tree_view_get_model(tree_view);
if (!gtk_tree_model_get_iter_first(model, &iter))
- return;
+ return 0;
do {
gtk_tree_model_get(model, &iter,
COL_DATA, &ainfo,
-1);
-
+
+ if (!is_file_exist(ainfo->file)) {
+ gchar *msg = g_strdup_printf(_("Attachment %s doesn't exist anymore. Ignore?"), ainfo->file);
+ AlertValue val = alertpanel_full(_("Warning"), msg, _("Cancel sending"), _("Ignore attachment"),
+ NULL, FALSE, NULL, ALERT_WARNING, G_ALERTDEFAULT);
+ g_free(msg);
+ if (val == G_ALERTDEFAULT) {
+ return -1;
+ }
+ continue;
+ }
mimepart = procmime_mimeinfo_new();
mimepart->content = MIMECONTENT_FILE;
mimepart->data.filename = g_strdup(ainfo->file);
g_node_append(parent->node, mimepart->node);
} while (gtk_tree_model_iter_next(model, &iter));
+
+ return 0;
}
#define IS_IN_CUSTOM_HEADER(header) \
gchar *from_name = NULL, *from_address = NULL;
gchar *tmp;
- g_return_val_if_fail(compose->account != NULL, NULL);
- g_return_val_if_fail(compose->account->address != NULL, NULL);
+ cm_return_val_if_fail(compose->account != NULL, NULL);
+ cm_return_val_if_fail(compose->account->address != NULL, NULL);
header = g_string_sized_new(64);
gchar *tmpstr = NULL;
const gchar *out_codeset = NULL;
- g_return_if_fail(src != NULL);
- g_return_if_fail(dest != NULL);
+ cm_return_if_fail(src != NULL);
+ cm_return_if_fail(dest != NULL);
if (len < 1) return;
{
gchar *address;
- g_return_if_fail(user_data != NULL);
+ cm_return_if_fail(user_data != NULL);
address = g_strdup(gtk_entry_get_text(GTK_ENTRY(user_data)));
g_strstrip(address);
GtkWidget *menuitem;
gchar *address;
- g_return_if_fail(menu != NULL);
- g_return_if_fail(GTK_IS_MENU_SHELL(menu));
+ cm_return_if_fail(menu != NULL);
+ cm_return_if_fail(GTK_IS_MENU_SHELL(menu));
menuitem = gtk_separator_menu_item_new();
gtk_menu_shell_prepend(GTK_MENU_SHELL(menu), menuitem);
GtkWidget *combo;
GtkWidget *entry;
+ GtkWidget *button;
+ GtkWidget *hbox;
gchar **string;
const gchar *header = NULL;
ComposeHeaderEntry *headerentry;
gtk_table_attach(GTK_TABLE(compose->header_table), combo, 0, 1,
compose->header_nextrow, compose->header_nextrow+1,
GTK_SHRINK, GTK_FILL, 0, 0);
- if (compose->header_last) {
+ if (compose->header_last && (compose->draft_timeout_tag != -2)) {
const gchar *last_header_entry = gtk_entry_get_text(
GTK_ENTRY(gtk_bin_get_child(GTK_BIN((compose->header_last->combo)))));
string = headers;
while (*string != NULL) {
- if (!strcmp(*string, last_header_entry))
+ if (!strcmp(prefs_common_translated_header_name(*string), last_header_entry))
standard_header = TRUE;
string++;
}
g_signal_connect_after(G_OBJECT(gtk_bin_get_child(GTK_BIN((combo)))), "grab_focus",
G_CALLBACK(compose_grab_focus_cb), compose);
- /* Entry field */
+ /* Entry field with cleanup button */
+#if GTK_CHECK_VERSION(2, 8, 0)
+ button = gtk_button_new();
+ gtk_button_set_image(GTK_BUTTON(button),
+ gtk_image_new_from_stock(GTK_STOCK_CLEAR, GTK_ICON_SIZE_MENU));
+#else
+ button = gtk_button_new_with_label(_("Clear"));
+#endif
+ gtk_widget_show(button);
+ CLAWS_SET_TIP(button,
+ _("Delete entry contents"));
entry = gtk_entry_new();
gtk_widget_show(entry);
CLAWS_SET_TIP(entry,
_("Use <tab> to autocomplete from addressbook"));
- gtk_table_attach(GTK_TABLE(compose->header_table), entry, 1, 2,
+ hbox = gtk_hbox_new (FALSE, 0);
+ gtk_widget_show(hbox);
+ gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
+ gtk_table_attach(GTK_TABLE(compose->header_table), hbox, 1, 2,
compose->header_nextrow, compose->header_nextrow+1,
GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
headerentry);
g_signal_connect_after(G_OBJECT(entry), "grab_focus",
G_CALLBACK(compose_grab_focus_cb), compose);
+
+ g_signal_connect(G_OBJECT(button), "clicked",
+ G_CALLBACK(compose_headerentry_button_clicked_cb),
+ headerentry);
/* email dnd */
gtk_drag_dest_set(entry, GTK_DEST_DEFAULT_ALL, compose_mime_types,
headerentry->compose = compose;
headerentry->combo = combo;
headerentry->entry = entry;
+ headerentry->button = button;
+ headerentry->hbox = hbox;
headerentry->headernum = compose->header_nextrow;
compose->header_nextrow++;
(ComposeHeaderEntry *)list->data;
gtk_widget_destroy(headerentry->combo);
gtk_widget_destroy(headerentry->entry);
+ gtk_widget_destroy(headerentry->button);
+ gtk_widget_destroy(headerentry->hbox);
g_free(headerentry);
}
compose->header_last = NULL;
g_slist_free(spell_menu);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(parent_item), GTK_WIDGET(menu));
-
+ gtk_widget_show(parent_item);
+}
+
+static void compose_dict_changed(void *data)
+{
+ Compose *compose = (Compose *) data;
+
+ if(compose->gtkaspell->recheck_when_changing_dict == FALSE)
+ return;
+
+ gtkaspell_highlight_all(compose->gtkaspell);
+ claws_spell_entry_recheck_all(CLAWS_SPELL_ENTRY(compose->subject_entry));
}
#endif
static GdkGeometry geometry;
- g_return_val_if_fail(account != NULL, NULL);
+ cm_return_val_if_fail(account != NULL, NULL);
debug_print("Creating compose window...\n");
compose = g_new0(Compose, 1);
gtk_box_pack_start(GTK_BOX(subject), label, FALSE, FALSE, 0);
gtk_widget_show(label);
+#ifdef USE_ENCHANT
+ subject_entry = claws_spell_entry_new();
+#else
subject_entry = gtk_entry_new();
+#endif
gtk_box_pack_start(GTK_BOX(subject), subject_entry, TRUE, TRUE, 0);
g_signal_connect_after(G_OBJECT(subject_entry), "grab_focus",
G_CALLBACK(compose_grab_focus_cb), compose);
prefs_common.use_both_dicts,
GTK_TEXT_VIEW(text),
GTK_WINDOW(compose->window),
+ compose_dict_changed,
compose_spell_menu_changed,
compose);
if (!gtkaspell) {
}
compose->gtkaspell = gtkaspell;
compose_spell_menu_changed(compose);
+ claws_spell_entry_set_gtkaspell(CLAWS_SPELL_ENTRY(subject_entry), gtkaspell);
#endif
compose_select_account(compose, account, TRUE);
gint num = 0, def_menu = 0;
accounts = account_get_list();
- g_return_val_if_fail(accounts != NULL, NULL);
+ cm_return_val_if_fail(accounts != NULL, NULL);
optmenubox = gtk_event_box_new();
optmenu = gtkut_sc_combobox_create(optmenubox, FALSE);
gboolean all = FALSE, ml = FALSE, sender = FALSE, followup = FALSE;
- g_return_if_fail(compose->replyinfo != NULL);
+ cm_return_if_fail(compose->replyinfo != NULL);
if (action == COMPOSE_REPLY && prefs_common.default_reply_list)
ml = TRUE;
gchar *systemid;
gboolean can_sign = FALSE, can_encrypt = FALSE;
- g_return_if_fail(GTK_IS_CHECK_MENU_ITEM(widget));
+ cm_return_if_fail(GTK_IS_CHECK_MENU_ITEM(widget));
if (!GTK_CHECK_MENU_ITEM(widget)->active)
return;
gchar *systemid;
menuitem = gtk_menu_item_get_submenu(GTK_MENU_ITEM(
gtk_ui_manager_get_widget(compose->ui_manager, branch_path)));
- g_return_if_fail(menuitem != NULL);
+ cm_return_if_fail(menuitem != NULL);
amenu = GTK_MENU_SHELL(menuitem)->children;
menuitem = NULL;
{
const gchar *qmark = NULL;
- g_return_val_if_fail(compose != NULL, NULL);
+ cm_return_val_if_fail(compose != NULL, NULL);
switch (compose->mode) {
/* use forward-specific quote char */
const gchar *qmark;
gchar *parsed_str = NULL;
gint cursor_pos = 0;
- const gchar *err_msg = _("Template body format error at line %d.");
+ const gchar *err_msg = _("The body of the template has an error at line %d.");
if (!tmpl) return;
/* process the body */
if (event && event->keyval == GDK_Return) {
*cancelled = FALSE;
gtk_main_quit();
+ return TRUE;
}
return FALSE;
}
gchar **cmdline;
pid_t pid;
- g_return_val_if_fail(file != NULL, -1);
+ cm_return_val_if_fail(file != NULL, -1);
if ((pid = fork()) < 0) {
perror("fork");
gtk_tree_model_get(menu, &iter, 1, &account_id, -1);
ac = account_find_from_id(account_id);
- g_return_if_fail(ac != NULL);
+ cm_return_if_fail(ac != NULL);
if (ac != compose->account)
compose_select_account(compose, ac, FALSE);
gint val;
inc_lock();
+ compose_allow_user_actions(compose, FALSE);
val = compose_queue_sub(compose, NULL, NULL, NULL, TRUE, TRUE);
+ compose_allow_user_actions(compose, TRUE);
inc_unlock();
if (!val) {
return TRUE;
draft = account_get_special_folder(compose->account, F_DRAFT);
- g_return_val_if_fail(draft != NULL, FALSE);
+ cm_return_val_if_fail(draft != NULL, FALSE);
if (!g_mutex_trylock(compose->mutex)) {
/* we don't want to lock the mutex once it's available,
AlertValue val;
tmpl = g_object_get_data(G_OBJECT(widget), "template");
- g_return_if_fail(tmpl != NULL);
+ cm_return_if_fail(tmpl != NULL);
msg = g_strdup_printf(_("Do you want to apply the template '%s' ?"),
tmpl->name);
GtkTextMark *mark;
GtkTextIter ins;
- g_return_if_fail(GTK_IS_TEXT_VIEW(text));
+ cm_return_if_fail(GTK_IS_TEXT_VIEW(text));
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
mark = gtk_text_buffer_get_insert(buffer);
GtkTextMark *mark;
GtkTextIter ins;
- g_return_if_fail(GTK_IS_TEXT_VIEW(text));
+ cm_return_if_fail(GTK_IS_TEXT_VIEW(text));
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
mark = gtk_text_buffer_get_insert(buffer);
GtkTextMark *mark;
GtkTextIter ins;
- g_return_if_fail(GTK_IS_TEXT_VIEW(text));
+ cm_return_if_fail(GTK_IS_TEXT_VIEW(text));
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
mark = gtk_text_buffer_get_insert(buffer);
GtkTextIter ins;
gint count;
- g_return_if_fail(GTK_IS_TEXT_VIEW(text));
+ cm_return_if_fail(GTK_IS_TEXT_VIEW(text));
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
mark = gtk_text_buffer_get_insert(buffer);
GtkTextIter ins;
gint count;
- g_return_if_fail(GTK_IS_TEXT_VIEW(text));
+ cm_return_if_fail(GTK_IS_TEXT_VIEW(text));
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
mark = gtk_text_buffer_get_insert(buffer);
GtkTextMark *mark;
GtkTextIter ins;
- g_return_if_fail(GTK_IS_TEXT_VIEW(text));
+ cm_return_if_fail(GTK_IS_TEXT_VIEW(text));
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
mark = gtk_text_buffer_get_insert(buffer);
GtkTextIter ins;
gint offset;
- g_return_if_fail(GTK_IS_TEXT_VIEW(text));
+ cm_return_if_fail(GTK_IS_TEXT_VIEW(text));
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
mark = gtk_text_buffer_get_insert(buffer);
GtkTextIter ins;
gint offset;
- g_return_if_fail(GTK_IS_TEXT_VIEW(text));
+ cm_return_if_fail(GTK_IS_TEXT_VIEW(text));
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
mark = gtk_text_buffer_get_insert(buffer);
GtkTextMark *mark;
GtkTextIter ins, end_iter;
- g_return_if_fail(GTK_IS_TEXT_VIEW(text));
+ cm_return_if_fail(GTK_IS_TEXT_VIEW(text));
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
mark = gtk_text_buffer_get_insert(buffer);
GtkTextMark *mark;
GtkTextIter ins, end_iter;
- g_return_if_fail(GTK_IS_TEXT_VIEW(text));
+ cm_return_if_fail(GTK_IS_TEXT_VIEW(text));
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
mark = gtk_text_buffer_get_insert(buffer);
GtkTextMark *mark;
GtkTextIter ins, end_iter;
- g_return_if_fail(GTK_IS_TEXT_VIEW(text));
+ cm_return_if_fail(GTK_IS_TEXT_VIEW(text));
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
mark = gtk_text_buffer_get_insert(buffer);
GtkTextMark *mark;
GtkTextIter ins, end_iter;
- g_return_if_fail(GTK_IS_TEXT_VIEW(text));
+ cm_return_if_fail(GTK_IS_TEXT_VIEW(text));
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
mark = gtk_text_buffer_get_insert(buffer);
GtkTextMark *mark;
GtkTextIter ins, start_iter, end_iter;
- g_return_if_fail(GTK_IS_TEXT_VIEW(text));
+ cm_return_if_fail(GTK_IS_TEXT_VIEW(text));
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
mark = gtk_text_buffer_get_insert(buffer);
GtkTextMark *mark;
GtkTextIter ins, end_iter;
- g_return_if_fail(GTK_IS_TEXT_VIEW(text));
+ cm_return_if_fail(GTK_IS_TEXT_VIEW(text));
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
mark = gtk_text_buffer_get_insert(buffer);
static void compose_changed_cb(GtkTextBuffer *textbuf, Compose *compose)
{
compose->modified = TRUE;
+// compose_beautify_paragraph(compose, NULL, TRUE);
#ifndef GENERIC_UMPC
compose_set_title(compose);
#endif
/* strangely, testing data->type == gdk_atom_intern("text/uri-list", TRUE)
* does not work */
- debug_print("drop: %s (%s)\n", gdk_atom_name(data->type)?gdk_atom_name(data->type):"nul",
- (gchar *)(data->data?data->data:"nul"));
#ifndef G_OS_WIN32
if (gdk_atom_name(data->type) && !strcmp(gdk_atom_name(data->type), "text/uri-list")) {
#else
AlertValue val = G_ALERTDEFAULT;
list = uri_list_extract_filenames((const gchar *)data->data);
- debug_print("list: %p (%s)\n", list,
- (gchar *)(data->data?data->data:"nul"));
if (list == NULL && strstr((gchar *)(data->data), "://")) {
/* Assume a list of no files, and data has ://, is a remote link */
gchar *tmpdata = g_strstrip(g_strdup((const gchar *)data->data));
compose->remove_references = FALSE;
}
+static gboolean compose_headerentry_button_clicked_cb (GtkWidget *button,
+ ComposeHeaderEntry *headerentry)
+{
+ gtk_entry_set_text(GTK_ENTRY(headerentry->entry), "");
+ return FALSE;
+}
+
static gboolean compose_headerentry_key_press_event_cb(GtkWidget *entry,
GdkEventKey *event,
ComposeHeaderEntry *headerentry)
{
GtkAdjustment *vadj;
- g_return_if_fail(compose);
- g_return_if_fail(GTK_IS_WIDGET(compose->header_table));
- g_return_if_fail(GTK_IS_VIEWPORT(compose->header_table->parent));
+ cm_return_if_fail(compose);
+ cm_return_if_fail(GTK_IS_WIDGET(compose->header_table));
+ cm_return_if_fail(GTK_IS_VIEWPORT(compose->header_table->parent));
vadj = gtk_viewport_get_vadjustment(GTK_VIEWPORT(compose->header_table->parent));
gtk_adjustment_set_value(vadj, (show_first ? vadj->lower : vadj->upper));
(G_OBJECT(compose->text), "paste_as_quotation"));
GtkTextMark *mark;
- g_return_if_fail(text != NULL);
+ cm_return_if_fail(text != NULL);
g_signal_handlers_block_by_func(G_OBJECT(buffer),
G_CALLBACK(text_inserted),
static void compose_check_all(GtkAction *action, gpointer data)
{
Compose *compose = (Compose *)data;
- if (compose->gtkaspell)
+ if (!compose->gtkaspell)
+ return;
+
+ if (GTK_WIDGET_HAS_FOCUS(compose->subject_entry))
+ claws_spell_entry_check_all(
+ CLAWS_SPELL_ENTRY(compose->subject_entry));
+ else
gtkaspell_check_all(compose->gtkaspell);
}
static void compose_highlight_all(GtkAction *action, gpointer data)
{
Compose *compose = (Compose *)data;
- if (compose->gtkaspell)
+ if (compose->gtkaspell) {
+ claws_spell_entry_recheck_all(
+ CLAWS_SPELL_ENTRY(compose->subject_entry));
gtkaspell_highlight_all(compose->gtkaspell);
+ }
}
static void compose_check_backwards(GtkAction *action, gpointer data)
{
Compose *compose = (Compose *)data;
- if (compose->gtkaspell)
- gtkaspell_check_backwards(compose->gtkaspell);
- else {
+ if (!compose->gtkaspell) {
cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Spelling", FALSE);
+ return;
}
+
+ if (GTK_WIDGET_HAS_FOCUS(compose->subject_entry))
+ claws_spell_entry_check_backwards(
+ CLAWS_SPELL_ENTRY(compose->subject_entry));
+ else
+ gtkaspell_check_backwards(compose->gtkaspell);
}
static void compose_check_forwards_go(GtkAction *action, gpointer data)
{
Compose *compose = (Compose *)data;
- if (compose->gtkaspell)
- gtkaspell_check_forwards_go(compose->gtkaspell);
- else {
+ if (!compose->gtkaspell) {
cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Spelling", FALSE);
+ return;
}
+
+ if (GTK_WIDGET_HAS_FOCUS(compose->subject_entry))
+ claws_spell_entry_check_forwards_go(
+ CLAWS_SPELL_ENTRY(compose->subject_entry));
+ else
+ gtkaspell_check_forwards_go(compose->gtkaspell);
}
#endif
{
PrefsAccount *account = NULL;
- g_return_val_if_fail(msginfo, NULL);
- g_return_val_if_fail(msginfo->folder, NULL);
- g_return_val_if_fail(msginfo->folder->prefs, NULL);
+ cm_return_val_if_fail(msginfo, NULL);
+ cm_return_val_if_fail(msginfo->folder, NULL);
+ cm_return_val_if_fail(msginfo->folder->prefs, NULL);
if (msginfo->folder->prefs->enable_default_account)
account = account_find_from_id(msginfo->folder->prefs->default_account);
g_timeout_add (500, (GSourceFunc) compose_close, compose);
return FALSE;
}
- g_return_val_if_fail(compose, FALSE);
+ cm_return_val_if_fail(compose, FALSE);
gtkut_widget_get_uposition(compose->window, &x, &y);
if (!compose->batch) {
prefs_common.compose_x = x;
Compose *compose = NULL;
gchar *s_system = NULL;
- g_return_if_fail(msgview != NULL);
+ cm_return_if_fail(msgview != NULL);
- g_return_if_fail(msginfo_list != NULL);
+ cm_return_if_fail(msginfo_list != NULL);
if (g_slist_length(msginfo_list) == 1 && !opening_multiple) {
MimeInfo *mimeinfo = messageview_get_selected_mime_part(msgview);
tmp_msginfo->folder = orig_msginfo->folder;
tmp_msginfo->msgnum = orig_msginfo->msgnum;
- if (orig_msginfo->tags)
+ if (orig_msginfo->tags) {
tmp_msginfo->tags = g_slist_copy(orig_msginfo->tags);
+ tmp_msginfo->folder->tags_dirty = TRUE;
+ }
}
}
}
GSList *list;
gchar buf[BUFFSIZE];
- g_return_val_if_fail( compose != NULL, NULL );
+ cm_return_val_if_fail( compose != NULL, NULL );
newmsginfo = procmsg_msginfo_new();
static void compose_set_dictionaries_from_folder_prefs(Compose *compose,
FolderItem *folder_item)
{
- g_return_if_fail(compose != NULL);
+ cm_return_if_fail(compose != NULL);
if (compose->gtkaspell && folder_item && folder_item->prefs) {
FolderItemPrefs *prefs = folder_item->prefs;