static void compose_create_header_entry (Compose *compose);
static void compose_add_header_entry (Compose *compose, gchar *header, gchar *text);
static void compose_update_priority_menu_item(Compose * compose);
-
+#if USE_ASPELL
+static void compose_spell_menu_changed (void *data);
+#endif
static void compose_add_field_list ( Compose *compose,
GList *listAddress );
compose->gtkaspell)
gtkaspell_change_dict(compose->gtkaspell,
item->prefs->default_dictionary);
+ compose_spell_menu_changed(compose);
#endif
if (account->auto_sig)
compose_destroy(compose);
return NULL;
}
+
+ compose->sig_str = compose_get_signature_str(compose);
+
return compose;
}
GtkTextMark *mark;
GtkTextIter iter, iter_end;
gint cur_pos;
+ gchar *search = NULL;
gboolean prev_autowrap;
+ gboolean found = FALSE, shift = FALSE;
g_return_if_fail(compose->account != NULL);
gtk_text_buffer_get_end_iter(buffer, &iter);
- if (replace && compose->sig_str) {
- gboolean found;
+ search = compose->sig_str;
+again:
+ if (replace && search) {
GtkTextIter first_iter, start_iter, end_iter;
gtk_text_buffer_get_start_iter(buffer, &first_iter);
found = FALSE;
else
found = gtk_text_iter_forward_search(&first_iter,
- compose->sig_str,
+ search,
GTK_TEXT_SEARCH_TEXT_ONLY,
&start_iter, &end_iter,
NULL);
gtk_text_buffer_delete(buffer, &start_iter, &end_iter);
iter = start_iter;
}
+ }
+ if (replace && !found && search && strlen(search) > 2
+ && search[0] == '\n' && search[1] == '\n') {
+ search ++;
+ shift = TRUE;
+ goto again;
}
g_free(compose->sig_str);
compose->sig_str = g_strdup("");
cur_pos = gtk_text_iter_get_offset(&iter);
- gtk_text_buffer_insert(buffer, &iter, compose->sig_str, -1);
+ if (shift && found)
+ gtk_text_buffer_insert(buffer, &iter, compose->sig_str + 1, -1);
+ else
+ gtk_text_buffer_insert(buffer, &iter, compose->sig_str, -1);
/* skip \n\n */
gtk_text_buffer_get_iter_at_offset(buffer, &iter, cur_pos);
gtk_text_iter_forward_char(&iter);
{"http://", strcasestr, get_uri_part, make_uri_string},
{"https://", strcasestr, get_uri_part, make_uri_string},
{"ftp://", strcasestr, get_uri_part, make_uri_string},
+ {"sftp://", 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}
activate_privacy_system(compose, account, FALSE);
- if (!init && compose->mode != COMPOSE_REDIRECT)
+ if (!init && compose->mode != COMPOSE_REDIRECT) {
+ undo_block(compose->undostruct);
compose_insert_sig(compose, TRUE);
+ undo_unblock(compose->undostruct);
+ }
}
gboolean compose_check_for_valid_recipient(Compose *compose) {
alertpanel_error(_("Could not queue message for sending:\n\n"
"Charset conversion failed."));
} else if (val == -3) {
+ if (privacy_peek_error())
alertpanel_error(_("Could not queue message for sending:\n\n"
"Signature failed: %s"), privacy_get_error());
} else if (val == -2 && errno != 0) {
} else if (val == -2) {
alertpanel_error(_("Could not queue message:\n\n%s."), strerror(errno));
} else if (val == -3) {
+ if (privacy_peek_error())
alertpanel_error(_("Could not queue message for sending:\n\n"
"Signature failed: %s"), privacy_get_error());
} else if (val == -4) {
{
Compose *compose = (Compose *)user_data;
GList *list, *tmp;
- AlertValue val = G_ALERTDEFAULT;
-
- switch (prefs_common.compose_dnd_mode) {
- case COMPOSE_DND_ASK:
- val = alertpanel_full(_("Insert or attach?"),
- _("Do you want to insert the contents of the file(s) "
- "into the message body, or attach it to the email?"),
- GTK_STOCK_CANCEL, _("+_Insert"), _("_Attach"),
- TRUE, NULL, ALERT_QUESTION, G_ALERTALTERNATE);
- break;
- case COMPOSE_DND_INSERT:
- val = G_ALERTALTERNATE;
- break;
- case COMPOSE_DND_ATTACH:
- val = G_ALERTOTHER;
- break;
- default:
- /* unexpected case */
- g_warning("error: unexpected compose_dnd_mode option value in compose_insert_drag_received_cb()");
- }
-
- if (val & G_ALERTDISABLE) {
- val &= ~G_ALERTDISABLE;
- /* remember what action to perform by default, only if we don't click Cancel */
- if (val == G_ALERTALTERNATE)
- prefs_common.compose_dnd_mode = COMPOSE_DND_INSERT;
- else
- if (val == G_ALERTOTHER)
- prefs_common.compose_dnd_mode = COMPOSE_DND_ATTACH;
- }
-
- if (val == G_ALERTDEFAULT) {
- gtk_drag_finish(drag_context, FALSE, FALSE, time);
- return;
- } else if (val == G_ALERTOTHER) {
- compose_attach_drag_received_cb(widget, drag_context, x, y, data, info, time, user_data);
- return;
- }
/* strangely, testing data->type == gdk_atom_intern("text/uri-list", TRUE)
* does not work */
if (gdk_atom_name(data->type) && !strcmp(gdk_atom_name(data->type), "text/uri-list")) {
+ AlertValue val = G_ALERTDEFAULT;
+
+ switch (prefs_common.compose_dnd_mode) {
+ case COMPOSE_DND_ASK:
+ val = alertpanel_full(_("Insert or attach?"),
+ _("Do you want to insert the contents of the file(s) "
+ "into the message body, or attach it to the email?"),
+ GTK_STOCK_CANCEL, _("+_Insert"), _("_Attach"),
+ TRUE, NULL, ALERT_QUESTION, G_ALERTALTERNATE);
+ break;
+ case COMPOSE_DND_INSERT:
+ val = G_ALERTALTERNATE;
+ break;
+ case COMPOSE_DND_ATTACH:
+ val = G_ALERTOTHER;
+ break;
+ default:
+ /* unexpected case */
+ g_warning("error: unexpected compose_dnd_mode option value in compose_insert_drag_received_cb()");
+ }
+
+ if (val & G_ALERTDISABLE) {
+ val &= ~G_ALERTDISABLE;
+ /* remember what action to perform by default, only if we don't click Cancel */
+ if (val == G_ALERTALTERNATE)
+ prefs_common.compose_dnd_mode = COMPOSE_DND_INSERT;
+ else if (val == G_ALERTOTHER)
+ prefs_common.compose_dnd_mode = COMPOSE_DND_ATTACH;
+ }
+
+ if (val == G_ALERTDEFAULT || val == G_ALERTCANCEL) {
+ gtk_drag_finish(drag_context, FALSE, FALSE, time);
+ return;
+ } else if (val == G_ALERTOTHER) {
+ compose_attach_drag_received_cb(widget, drag_context, x, y, data, info, time, user_data);
+ return;
+ }
list = uri_list_extract_filenames((const gchar *)data->data);
for (tmp = list; tmp != NULL; tmp = tmp->next) {
compose_insert_file(compose, (const gchar *)tmp->data);