(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 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);
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();
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();
}
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);
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();
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);
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)
}
{"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}
static void compose_select_account(Compose *compose, PrefsAccount *account,
gboolean init)
{
- gchar *from = NULL;
+ gchar *from = NULL, *header;
+ ComposeHeaderEntry *header_entry;
cm_return_if_fail(account != NULL);
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) {
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);
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) \
GtkWidget *combo;
GtkWidget *entry;
+ GtkWidget *button;
+ GtkWidget *hbox;
gchar **string;
const gchar *header = NULL;
ComposeHeaderEntry *headerentry;
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;
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;
}
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)
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;
+ }
}
}
}