[evolution/gnome-3-30] I#123 - Reply to part of encrypted mail is unencrypted by default



commit 10ca689802925a5526116083dd6e5e27750c57a9
Author: Milan Crha <mcrha redhat com>
Date:   Tue Sep 11 10:28:58 2018 +0200

    I#123 - Reply to part of encrypted mail is unencrypted by default
    
    Closes https://gitlab.gnome.org/GNOME/evolution/issues/123

 src/mail/e-mail-reader-utils.c | 16 +++++++++++++---
 src/mail/em-composer-utils.c   | 13 ++++---------
 2 files changed, 17 insertions(+), 12 deletions(-)
---
diff --git a/src/mail/e-mail-reader-utils.c b/src/mail/e-mail-reader-utils.c
index 8ca02eeea9..1b3f9e1ba4 100644
--- a/src/mail/e-mail-reader-utils.c
+++ b/src/mail/e-mail-reader-utils.c
@@ -2576,9 +2576,15 @@ mail_reader_reply_to_message_composer_created_cb (GObject *source_object,
 
                if (ccd->validity_pgp_sum != 0 || ccd->validity_smime_sum != 0) {
                        GtkToggleAction *action;
+                       GSettings *settings;
+                       gboolean sign_reply;
+
+                       settings = e_util_ref_settings ("org.gnome.evolution.mail");
+                       sign_reply = g_settings_get_boolean (settings, "composer-sign-reply-if-signed");
+                       g_object_unref (settings);
 
                        if ((ccd->validity_pgp_sum & E_MAIL_PART_VALIDITY_PGP) != 0) {
-                               if ((ccd->validity_pgp_sum & E_MAIL_PART_VALIDITY_SIGNED) != 0) {
+                               if (sign_reply && (ccd->validity_pgp_sum & E_MAIL_PART_VALIDITY_SIGNED) != 0) 
{
                                        action = GTK_TOGGLE_ACTION (E_COMPOSER_ACTION_PGP_SIGN (composer));
                                        gtk_toggle_action_set_active (action, TRUE);
                                }
@@ -2590,7 +2596,7 @@ mail_reader_reply_to_message_composer_created_cb (GObject *source_object,
                        }
 
                        if ((ccd->validity_smime_sum & E_MAIL_PART_VALIDITY_SMIME) != 0) {
-                               if ((ccd->validity_smime_sum & E_MAIL_PART_VALIDITY_SIGNED) != 0) {
+                               if (sign_reply && (ccd->validity_smime_sum & E_MAIL_PART_VALIDITY_SIGNED) != 
0) {
                                        action = GTK_TOGGLE_ACTION (E_COMPOSER_ACTION_SMIME_SIGN (composer));
                                        gtk_toggle_action_set_active (action, TRUE);
                                }
@@ -2738,7 +2744,7 @@ e_mail_reader_reply_to_message (EMailReader *reader,
        } else if (camel_content_type_is (content_type, "text", "html")) {
                selection = e_web_view_get_selection_content_html_sync (E_WEB_VIEW (display), NULL, NULL);
                src_is_text_html = TRUE;
-       } else if (camel_content_type_is (content_type, "multipart", "*")) {
+       } else {
                selection = e_mail_display_get_selection_content_multipart_sync (display, &src_is_text_html, 
NULL, NULL);
        }
 
@@ -2792,6 +2798,8 @@ e_mail_reader_reply_to_message (EMailReader *reader,
        ccd->reply_type = reply_type;
        ccd->reply_style = reply_style;
        ccd->address = address ? g_object_ref (address) : NULL;
+       ccd->validity_pgp_sum = validity_pgp_sum;
+       ccd->validity_smime_sum = validity_smime_sum;
 
        e_msg_composer_new (shell, mail_reader_reply_to_message_composer_created_cb, ccd);
 
@@ -2837,6 +2845,8 @@ whole_message:
                ccd->reply_style = reply_style;
                ccd->part_list = part_list ? g_object_ref (part_list) : NULL;
                ccd->address = address ? g_object_ref (address) : NULL;
+               ccd->validity_pgp_sum = validity_pgp_sum;
+               ccd->validity_smime_sum = validity_smime_sum;
 
                e_msg_composer_new (shell, mail_reader_reply_to_message_composer_created_cb, ccd);
        }
diff --git a/src/mail/em-composer-utils.c b/src/mail/em-composer-utils.c
index 19318299db..13f572ef34 100644
--- a/src/mail/em-composer-utils.c
+++ b/src/mail/em-composer-utils.c
@@ -2303,22 +2303,17 @@ emu_update_composers_security (EMsgComposer *composer,
 {
        GtkAction *action;
        GSettings *settings;
-       gboolean sign_by_default;
+       gboolean sign_reply;
 
        g_return_if_fail (composer != NULL);
 
        settings = e_util_ref_settings ("org.gnome.evolution.mail");
-
-       sign_by_default =
-               (validity_found & E_MAIL_PART_VALIDITY_SIGNED) != 0 &&
-               /* FIXME This should be an EMsgComposer property. */
-               g_settings_get_boolean (
-                       settings, "composer-sign-reply-if-signed");
-
+       sign_reply = (validity_found & E_MAIL_PART_VALIDITY_SIGNED) != 0 &&
+                    g_settings_get_boolean (settings, "composer-sign-reply-if-signed");
        g_object_unref (settings);
 
        /* Pre-set only for encrypted messages, not for signed */
-       if (sign_by_default) {
+       if (sign_reply) {
                action = NULL;
 
                if (validity_found & E_MAIL_PART_VALIDITY_SMIME) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]