#include "hooks.h"
#include "privacy.h"
#include "timing.h"
+#include "autofaces.h"
enum
{
COMPOSE_CALL_ADVANCED_ACTION_DELETE_FORWARD_WORD,
COMPOSE_CALL_ADVANCED_ACTION_DELETE_BACKWARD_WORD,
COMPOSE_CALL_ADVANCED_ACTION_DELETE_LINE,
- COMPOSE_CALL_ADVANCED_ACTION_DELETE_LINE_N,
COMPOSE_CALL_ADVANCED_ACTION_DELETE_TO_LINE_END
} ComposeCallAdvancedAction;
compose_advanced_action_cb,
COMPOSE_CALL_ADVANCED_ACTION_DELETE_LINE,
NULL},
- {N_("/_Edit/A_dvanced/Delete entire line"),
- NULL,
- compose_advanced_action_cb,
- COMPOSE_CALL_ADVANCED_ACTION_DELETE_LINE_N,
- NULL},
{N_("/_Edit/A_dvanced/Delete to end of line"),
"<control>K",
compose_advanced_action_cb,
} else {
qmark = prefs_common.quotemark;
- body_fmt = prefs_common.quotefmt;
+ body_fmt = gettext(prefs_common.quotefmt);
}
}
g_free(msgfile);
} else {
const gchar *qmark = NULL;
- const gchar *body_fmt = prefs_common.fw_quotefmt;
+ const gchar *body_fmt = gettext(prefs_common.fw_quotefmt);
MsgInfo *full_msginfo;
full_msginfo = procmsg_msginfo_get_full_info(msginfo);
} else {
qmark = prefs_common.fw_quotemark;
- body_fmt = prefs_common.fw_quotefmt;
+ body_fmt = gettext(prefs_common.fw_quotefmt);
}
/* empty quotemark is not allowed */
}
cursor_pos = quote_fmt_get_cursor_pos();
+ if (cursor_pos == -1)
+ cursor_pos = gtk_text_iter_get_offset(&iter);
compose->set_cursor_pos = cursor_pos;
- if (cursor_pos == -1) {
- cursor_pos = 0;
- }
+
gtk_text_buffer_get_start_iter(buffer, &iter);
gtk_text_buffer_get_iter_at_offset(buffer, &iter, cursor_pos);
gtk_text_buffer_place_cursor(buffer, &iter);
GtkTextBuffer *buffer = gtk_text_view_get_buffer(text);
GtkTextMark *mark;
GtkTextIter iter, iter_end;
- gint cur_pos;
+ gint cur_pos, ins_pos;
gboolean prev_autowrap;
gboolean found = FALSE;
gboolean exists = FALSE;
mark = gtk_text_buffer_get_insert(buffer);
gtk_text_buffer_get_iter_at_mark(buffer, &iter, mark);
cur_pos = gtk_text_iter_get_offset (&iter);
+ ins_pos = cur_pos;
gtk_text_buffer_get_end_iter(buffer, &iter);
if (found) {
/* include previous \n\n */
- gtk_text_iter_backward_chars(&first_iter, 2);
+ gtk_text_iter_backward_chars(&first_iter, 1);
start_iter = first_iter;
end_iter = first_iter;
/* skip re-start */
g_free(compose->sig_str);
compose->sig_str = NULL;
} else {
+ if (compose->sig_inserted == FALSE)
+ gtk_text_buffer_insert(buffer, &iter, "\n", -1);
+ compose->sig_inserted = TRUE;
+
+ cur_pos = gtk_text_iter_get_offset(&iter);
gtk_text_buffer_insert(buffer, &iter, compose->sig_str, -1);
/* remove \n\n */
gtk_text_buffer_get_iter_at_offset(buffer, &iter, cur_pos);
- gtk_text_iter_forward_chars(&iter, 2);
+ gtk_text_iter_forward_chars(&iter, 1);
gtk_text_buffer_get_end_iter(buffer, &iter_end);
gtk_text_buffer_apply_tag_by_name(buffer,"signature",&iter, &iter_end);
if (cur_pos > gtk_text_buffer_get_char_count (buffer))
cur_pos = gtk_text_buffer_get_char_count (buffer);
}
+
/* put the cursor where it should be
- * either where the quote_fmt says, either before the signature */
+ * either where the quote_fmt says, either where it was */
if (compose->set_cursor_pos < 0)
- gtk_text_buffer_get_iter_at_offset(buffer, &iter, cur_pos);
+ gtk_text_buffer_get_iter_at_offset(buffer, &iter, ins_pos);
else
gtk_text_buffer_get_iter_at_offset(buffer, &iter,
compose->set_cursor_pos);
}
if (compose->account->sig_sep) {
- sig_str = g_strconcat("\n\n", compose->account->sig_sep, "\n", sig_body,
+ sig_str = g_strconcat("\n", compose->account->sig_sep, "\n", sig_body,
NULL);
g_free(sig_body);
} else
- sig_str = g_strconcat("\n\n", sig_body, NULL);
+ sig_str = g_strconcat("\n", sig_body, NULL);
if (sig_str) {
if (g_utf8_validate(sig_str, -1, NULL) == TRUE)
ainfo->content_type = g_strdup("application/octet-stream");
}
- ainfo->size = size;
- size_text = to_human_readable(size);
+ ainfo->size = (goffset)size;
+ size_text = to_human_readable((goffset)size);
store = GTK_LIST_STORE(gtk_tree_view_get_model
(GTK_TREE_VIEW(compose->attach_clist)));
subject = gtk_editable_get_chars(
GTK_EDITABLE(compose->subject_entry), 0, -1);
-#ifndef MAEMO
+#ifndef GENERIC_UMPC
if (subject && strlen(subject))
str = g_strdup_printf(_("%s - Compose message%s"),
subject, edited);
gchar *chars;
gchar *buf;
const gchar *out_codeset;
- EncodingType encoding;
+ EncodingType encoding = ENC_UNKNOWN;
MimeInfo *mimemsg, *mimetext;
gint line;
+ const gchar *src_codeset = CS_INTERNAL;
if (action == COMPOSE_WRITE_FOR_SEND)
attach_parts = TRUE;
gtk_text_buffer_get_start_iter(buffer, &start);
gtk_text_buffer_get_end_iter(buffer, &end);
chars = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
- if (is_ascii_str(chars)) {
- buf = chars;
- chars = NULL;
+
+ out_codeset = conv_get_charset_str(compose->out_encoding);
+
+ if (!out_codeset && is_ascii_str(chars)) {
+ out_codeset = CS_US_ASCII;
+ } else if (prefs_common.outgoing_fallback_to_ascii &&
+ is_ascii_str(chars)) {
out_codeset = CS_US_ASCII;
encoding = ENC_7BIT;
- } else {
- const gchar *src_codeset = CS_INTERNAL;
+ }
+
+ if (!out_codeset) {
+ gchar *test_conv_global_out = NULL;
+ gchar *test_conv_reply = NULL;
- out_codeset = conv_get_charset_str(compose->out_encoding);
+ /* automatic mode. be automatic. */
+ codeconv_set_strict(TRUE);
- if (!out_codeset) {
- gchar *test_conv_global_out = NULL;
- gchar *test_conv_reply = NULL;
+ out_codeset = conv_get_outgoing_charset_str();
+ if (out_codeset) {
+ debug_print("trying to convert to %s\n", out_codeset);
+ test_conv_global_out = conv_codeset_strdup(chars, src_codeset, out_codeset);
+ }
- /* automatic mode. be automatic. */
- codeconv_set_strict(TRUE);
-
- out_codeset = conv_get_outgoing_charset_str();
- if (out_codeset) {
- debug_print("trying to convert to %s\n", out_codeset);
- test_conv_global_out = conv_codeset_strdup(chars, src_codeset, out_codeset);
- }
-
- if (!test_conv_global_out && compose->orig_charset
- && strcmp(compose->orig_charset, CS_US_ASCII)) {
- out_codeset = compose->orig_charset;
- debug_print("failure; trying to convert to %s\n", out_codeset);
- test_conv_reply = conv_codeset_strdup(chars, src_codeset, out_codeset);
- }
-
- if (!test_conv_global_out && !test_conv_reply) {
- /* we're lost */
- out_codeset = CS_INTERNAL;
- debug_print("failure; finally using %s\n", out_codeset);
- }
- g_free(test_conv_global_out);
- g_free(test_conv_reply);
- codeconv_set_strict(FALSE);
+ if (!test_conv_global_out && compose->orig_charset
+ && strcmp(compose->orig_charset, CS_US_ASCII)) {
+ out_codeset = compose->orig_charset;
+ debug_print("failure; trying to convert to %s\n", out_codeset);
+ test_conv_reply = conv_codeset_strdup(chars, src_codeset, out_codeset);
}
- if (!g_ascii_strcasecmp(out_codeset, CS_US_ASCII))
- out_codeset = CS_ISO_8859_1;
+ if (!test_conv_global_out && !test_conv_reply) {
+ /* we're lost */
+ out_codeset = CS_INTERNAL;
+ debug_print("failure; finally using %s\n", out_codeset);
+ }
+ g_free(test_conv_global_out);
+ g_free(test_conv_reply);
+ codeconv_set_strict(FALSE);
+ }
+ if (encoding == ENC_UNKNOWN) {
if (prefs_common.encoding_method == CTE_BASE64)
encoding = ENC_BASE64;
else if (prefs_common.encoding_method == CTE_QUOTED_PRINTABLE)
encoding = ENC_8BIT;
else
encoding = procmime_get_encoding_for_charset(out_codeset);
+ }
- debug_print("src encoding = %s, out encoding = %s, transfer encoding = %s\n",
- src_codeset, out_codeset, procmime_get_encoding_str(encoding));
-
- if (action == COMPOSE_WRITE_FOR_SEND) {
- codeconv_set_strict(TRUE);
- buf = conv_codeset_strdup(chars, src_codeset, out_codeset);
- codeconv_set_strict(FALSE);
-
- if (!buf) {
- AlertValue aval;
- gchar *msg;
+ debug_print("src encoding = %s, out encoding = %s, transfer encoding = %s\n",
+ src_codeset, out_codeset, procmime_get_encoding_str(encoding));
- msg = g_strdup_printf(_("Can't convert the character encoding of the message \n"
- "to the specified %s charset.\n"
- "Send it as %s?"), out_codeset, src_codeset);
- aval = alertpanel_full(_("Error"), msg, GTK_STOCK_CANCEL, _("+_Send"), NULL, FALSE,
- NULL, ALERT_ERROR, G_ALERTDEFAULT);
- g_free(msg);
+ if (action == COMPOSE_WRITE_FOR_SEND) {
+ codeconv_set_strict(TRUE);
+ buf = conv_codeset_strdup(chars, src_codeset, out_codeset);
+ codeconv_set_strict(FALSE);
- if (aval != G_ALERTALTERNATE) {
- g_free(chars);
- return -3;
- } else {
- buf = chars;
- out_codeset = src_codeset;
- chars = NULL;
- }
+ if (!buf) {
+ AlertValue aval;
+ gchar *msg;
+
+ msg = g_strdup_printf(_("Can't convert the character encoding of the message \n"
+ "to the specified %s charset.\n"
+ "Send it as %s?"), out_codeset, src_codeset);
+ aval = alertpanel_full(_("Error"), msg, GTK_STOCK_CANCEL, _("+_Send"), NULL, FALSE,
+ NULL, ALERT_ERROR, G_ALERTDEFAULT);
+ g_free(msg);
+
+ if (aval != G_ALERTALTERNATE) {
+ g_free(chars);
+ return -3;
+ } else {
+ buf = chars;
+ out_codeset = src_codeset;
+ chars = NULL;
}
- } else {
- buf = chars;
- out_codeset = src_codeset;
- chars = NULL;
}
+ } else {
+ buf = chars;
+ out_codeset = src_codeset;
+ chars = NULL;
}
g_free(chars);
}
}
+ /* Automatic Faces and X-Faces */
+ if (get_account_xface (buf, sizeof(buf), compose->account->account_name) == 0) {
+ g_string_append_printf(header, "X-Face: %s\n", buf);
+ }
+ else if (get_default_xface (buf, sizeof(buf)) == 0) {
+ g_string_append_printf(header, "X-Face: %s\n", buf);
+ }
+ if (get_account_face (buf, sizeof(buf), compose->account->account_name) == 0) {
+ g_string_append_printf(header, "Face: %s\n", buf);
+ }
+ else if (get_default_face (buf, sizeof(buf)) == 0) {
+ g_string_append_printf(header, "Face: %s\n", buf);
+ }
+
/* PRIORITY */
switch (compose->priority) {
case PRIORITY_HIGHEST: g_string_append_printf(header, "Importance: high\n"
gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL,
&geometry, GDK_HINT_MIN_SIZE);
-#ifndef MAEMO
+#ifndef GENERIC_UMPC
if (compose_force_window_origin)
gtk_widget_set_uposition(window, prefs_common.compose_x,
prefs_common.compose_y);
ainfo->file = file;
}
if (size)
- ainfo->size = size;
+ ainfo->size = (goffset)size;
/* update tree store */
text = to_human_readable(ainfo->size);
procmsg_msginfo_free(compose->targetinfo);
compose->targetinfo = procmsg_msginfo_new();
compose->targetinfo->msgnum = msgnum;
- compose->targetinfo->size = s.st_size;
+ compose->targetinfo->size = (goffset)s.st_size;
compose->targetinfo->mtime = s.st_mtime;
compose->targetinfo->folder = draft;
if (target_locked)
static void compose_cut_cb(Compose *compose)
{
if (compose->focused_editable
-#ifndef MAEMO
+#ifndef GENERIC_UMPC
&& GTK_WIDGET_HAS_FOCUS(compose->focused_editable)
#endif
)
static void compose_copy_cb(Compose *compose)
{
if (compose->focused_editable
-#ifndef MAEMO
+#ifndef GENERIC_UMPC
&& GTK_WIDGET_HAS_FOCUS(compose->focused_editable)
#endif
)
{
gint wrap_quote = prefs_common.linewrap_quote;
if (compose->focused_editable
-#ifndef MAEMO
+#ifndef GENERIC_UMPC
&& GTK_WIDGET_HAS_FOCUS(compose->focused_editable)
#endif
) {
GtkTextBuffer *buffer;
BLOCK_WRAP();
if (compose->focused_editable
-#ifndef MAEMO
+#ifndef GENERIC_UMPC
&& GTK_WIDGET_HAS_FOCUS(compose->focused_editable)
#endif
)
GtkTextBuffer *buffer;
BLOCK_WRAP();
if (compose->focused_editable
-#ifndef MAEMO
+#ifndef GENERIC_UMPC
&& GTK_WIDGET_HAS_FOCUS(compose->focused_editable)
#endif
)
static void compose_allsel_cb(Compose *compose)
{
if (compose->focused_editable
-#ifndef MAEMO
+#ifndef GENERIC_UMPC
&& GTK_WIDGET_HAS_FOCUS(compose->focused_editable)
#endif
)
{textview_delete_forward_word},
{textview_delete_backward_word},
{textview_delete_line},
- {NULL}, /* gtk_stext_delete_line_n */
{textview_delete_to_line_end}
};
if (GTK_IS_EDITABLE(widget) || GTK_IS_TEXT_VIEW(widget))
compose->focused_editable = widget;
-#ifdef MAEMO
+#ifdef GENERIC_UMPC
if (GTK_IS_TEXT_VIEW(widget)
&& gtk_paned_get_child1(GTK_PANED(compose->paned)) != compose->edit_vbox) {
gtk_widget_ref(compose->notebook);
static void compose_changed_cb(GtkTextBuffer *textbuf, Compose *compose)
{
compose->modified = TRUE;
-#ifndef MAEMO
+#ifndef GENERIC_UMPC
compose_set_title(compose);
#endif
}