when redirecting make encrypt and sign buttons inactive, and don't care about folder...
[claws.git] / src / compose.c
index d2ca99cfaa55a3d47dac78d329303613a066ef84..748800c0745be6e3a643fc623941413ebba71563 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2018 the Claws Mail team and Hiroyuki Yamamoto
+ * Copyright (C) 1999-2020 the Claws Mail team and Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -2520,7 +2520,6 @@ Compose *compose_redirect(PrefsAccount *account, MsgInfo *msginfo,
        cm_return_val_if_fail(account != NULL, NULL);
 
        compose = compose_create(account, msginfo->folder, COMPOSE_REDIRECT, batch);
-       compose_apply_folder_privacy_settings(compose, msginfo->folder);
 
        compose->updating = TRUE;
 
@@ -2598,6 +2597,10 @@ Compose *compose_redirect(PrefsAccount *account, MsgInfo *msginfo,
                gtk_widget_set_sensitive(compose->toolbar->linewrap_current_btn, FALSE);
        if (compose->toolbar->linewrap_all_btn)
                gtk_widget_set_sensitive(compose->toolbar->linewrap_all_btn, FALSE);
+       if (compose->toolbar->privacy_sign_btn)
+               gtk_widget_set_sensitive(compose->toolbar->privacy_sign_btn, FALSE);
+       if (compose->toolbar->privacy_encrypt_btn)
+               gtk_widget_set_sensitive(compose->toolbar->privacy_encrypt_btn, FALSE);
 
        compose->modified = FALSE;
        compose_set_title(compose);
@@ -2894,7 +2897,7 @@ static gint compose_parse_header(Compose *compose, MsgInfo *msginfo)
 
        cm_return_val_if_fail(msginfo != NULL, -1);
 
-       if ((fp = procmsg_open_message(msginfo)) == NULL) return -1;
+       if ((fp = procmsg_open_message(msginfo, FALSE)) == NULL) return -1;
        procheader_get_header_fields(fp, hentry);
        claws_fclose(fp);
 
@@ -3019,7 +3022,7 @@ static gint compose_parse_manual_headers(Compose *compose, MsgInfo *msginfo, Hea
 
        cm_return_val_if_fail(msginfo != NULL, -1);
 
-       if ((fp = procmsg_open_message(msginfo)) == NULL) return -1;
+       if ((fp = procmsg_open_message(msginfo, FALSE)) == NULL) return -1;
        procheader_get_header_fields(fp, entries);
        claws_fclose(fp);
 
@@ -5274,6 +5277,9 @@ static void _display_queue_error(ComposeQueueResult val)
                        alertpanel_error(_("Could not queue message for sending:\n\n"
                                                "Couldn't get recipient encryption key."));
                        break;
+               case COMPOSE_QUEUE_SIGNING_CANCELLED:
+                       debug_print("signing cancelled\n");
+                       break;
                default:
                        /* unhandled error */
                        debug_print("oops, unhandled compose_queue() return value %d\n",
@@ -5912,7 +5918,10 @@ static gint compose_write_to_file(Compose *compose, FILE *fp, gint action, gbool
                        compose->account, from_addr)) {
                        g_free(from_name);
                        g_free(from_addr);
-                       return COMPOSE_QUEUE_ERROR_SIGNING_FAILED;
+                       if (!privacy_peek_error())
+                               return COMPOSE_QUEUE_SIGNING_CANCELLED;
+                       else
+                               return COMPOSE_QUEUE_ERROR_SIGNING_FAILED;
        }
        g_free(from_name);
        g_free(from_addr);
@@ -6469,7 +6478,7 @@ static int compose_add_attachments(Compose *compose, MimeInfo *parent)
                if (mimepart->type == MIMETYPE_MESSAGE
                    || mimepart->type == MIMETYPE_MULTIPART)
                        ainfo->encoding = ENC_BINARY;
-               else if (compose->use_signing) {
+               else if (compose->use_signing || compose->fwdinfo != NULL) {
                        if (ainfo->encoding == ENC_7BIT)
                                ainfo->encoding = ENC_QUOTED_PRINTABLE;
                        else if (ainfo->encoding == ENC_8BIT)
@@ -9454,6 +9463,7 @@ static void compose_attach_property_create(gboolean *cancelled)
        gtk_container_set_border_width(GTK_CONTAINER(window), 8);
        gtk_window_set_title(GTK_WINDOW(window), _("Properties"));
        gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
+       gtk_window_set_type_hint(GTK_WINDOW(window), GDK_WINDOW_TYPE_HINT_DIALOG);
        g_signal_connect(G_OBJECT(window), "delete_event",
                         G_CALLBACK(attach_property_delete_event),
                         cancelled);
@@ -10898,15 +10908,15 @@ static void entry_copy_clipboard(GtkWidget *entry)
 }
 
 static void entry_paste_clipboard(Compose *compose, GtkWidget *entry, 
-                                 gboolean wrap, GdkAtom clip, GtkTextIter *insert_place)
+                                 gboolean wrap, GdkAtom clip, GtkTextIter *insert_place)
 {
-       if (GTK_IS_TEXT_VIEW(entry)) {
+       if (GTK_IS_TEXT_VIEW(entry)) {
                GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(entry));
                GtkTextMark *mark_start = gtk_text_buffer_get_insert(buffer);
                GtkTextIter start_iter, end_iter;
                gint start, end;
                gchar *contents = gtk_clipboard_wait_for_text(gtk_clipboard_get(clip));
-
                if (contents == NULL)
                        return;
        
@@ -10930,7 +10940,7 @@ static void entry_paste_clipboard(Compose *compose, GtkWidget *entry,
                        gtk_text_buffer_insert(buffer, insert_place, contents, strlen(contents));
                        if (prefs_common.primary_paste_unselects)
                                gtk_text_buffer_select_range(buffer, insert_place, insert_place);
-               }
+               }
                
                if (!wrap) {
                        /* paste unwrapped: mark the paste so it's not wrapped later */
@@ -10944,13 +10954,13 @@ static void entry_paste_clipboard(Compose *compose, GtkWidget *entry,
                        gtk_text_buffer_get_iter_at_mark(buffer, &start_iter, mark_start);
                        gtk_text_iter_backward_char(&start_iter);
                        compose_beautify_paragraph(compose, &start_iter, TRUE);
-               }
+               }
        } else if (GTK_IS_EDITABLE(entry))
                gtk_editable_paste_clipboard (GTK_EDITABLE(entry));
-
        compose->modified = TRUE;
 }
-
 static void entry_allsel(GtkWidget *entry)
 {
        if (GTK_IS_EDITABLE(entry))