#include "privacy.h"
#include "timing.h"
#include "autofaces.h"
+#include "spell_entry.h"
enum
{
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 void compose_force_encryption(Compose *compose, PrefsAccount *account,
- gboolean override_pref)
+ gboolean override_pref, const gchar *system)
{
- gchar *privacy = NULL;
+ const gchar *privacy = NULL;
g_return_if_fail(compose != NULL);
g_return_if_fail(account != NULL);
if (override_pref == FALSE && account->default_encrypt_reply == FALSE)
return;
- if (account->default_privacy_system
+ if (system)
+ privacy = system;
+ else if (account->default_privacy_system
&& strlen(account->default_privacy_system)) {
privacy = account->default_privacy_system;
} else {
}
}
if (privacy != NULL) {
+ if (system) {
+ g_free(compose->privacy_system);
+ compose->privacy_system = NULL;
+ }
if (compose->privacy_system == NULL)
compose->privacy_system = g_strdup(privacy);
else if (*(compose->privacy_system) == '\0') {
}
}
-static void compose_force_signing(Compose *compose, PrefsAccount *account)
+static void compose_force_signing(Compose *compose, PrefsAccount *account, const gchar *system)
{
gchar *privacy = NULL;
- if (account->default_privacy_system
+ if (system)
+ privacy = system;
+ else if (account->default_privacy_system
&& strlen(account->default_privacy_system)) {
privacy = account->default_privacy_system;
} else {
privacy = (gchar *)(privacy_avail->data);
}
}
+
if (privacy != NULL) {
+ if (system) {
+ g_free(compose->privacy_system);
+ compose->privacy_system = NULL;
+ }
if (compose->privacy_system == NULL)
compose->privacy_system = g_strdup(privacy);
compose_update_privacy_system_menu_item(compose, FALSE);
gboolean quote = FALSE;
const gchar *qmark = NULL;
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);
}
if (MSG_IS_ENCRYPTED(compose->replyinfo->flags)) {
- compose_force_encryption(compose, account, FALSE);
+ compose_force_encryption(compose, account, FALSE, s_system);
}
- privacy_msginfo_get_signed_state(compose->replyinfo);
+ privacy_msginfo_get_signed_state(compose->replyinfo, &s_system);
if (MSG_IS_SIGNED(compose->replyinfo->flags) && account->default_sign_reply) {
- compose_force_signing(compose, account);
+ compose_force_signing(compose, account, s_system);
}
+ g_free(s_system);
SIGNAL_BLOCK(textbuf);
if (MSG_IS_ENCRYPTED(msginfo->flags)) {
fp = procmime_get_first_encrypted_text_content(msginfo);
if (fp) {
- compose_force_encryption(compose, account, TRUE);
+ compose_force_encryption(compose, account, TRUE, NULL);
}
} else {
fp = procmime_get_first_text_content(msginfo);
compose_attach_append(compose, outfile,
partname, content_type);
} else {
- compose_force_signing(compose, compose->account);
+ compose_force_signing(compose, compose->account, NULL);
}
g_free(content_type);
}
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);
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)
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
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 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) {
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",
- data->data?data->data:"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
list = uri_list_extract_filenames((const gchar *)data->data);
debug_print("list: %p (%s)\n", list,
- data->data?data->data:"nul");
+ (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));
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
gboolean originally_enc = FALSE;
gboolean originally_sig = FALSE;
Compose *compose = NULL;
+ gchar *s_system = NULL;
g_return_if_fail(msgview != NULL);
new_msglist = g_slist_append(NULL, tmp_msginfo);
originally_enc = MSG_IS_ENCRYPTED(orig_msginfo->flags);
- privacy_msginfo_get_signed_state(orig_msginfo);
+ privacy_msginfo_get_signed_state(orig_msginfo, &s_system);
originally_sig = MSG_IS_SIGNED(orig_msginfo->flags);
tmp_msginfo->folder = orig_msginfo->folder;
compose = compose_reply_mode((ComposeMode)action, msginfo_list, body);
if (compose && originally_enc) {
- compose_force_encryption(compose, compose->account, FALSE);
+ compose_force_encryption(compose, compose->account, FALSE, s_system);
}
if (compose && originally_sig && compose->account->default_sign_reply) {
- compose_force_signing(compose, compose->account);
+ compose_force_signing(compose, compose->account, s_system);
}
-
+ g_free(s_system);
g_free(body);
}