[evolution] Bug 742607 - Pick identity from recipients with 'Edit as New Message'



commit 2e6c266024094e0c8a59195ae4dc7c345fa64ea1
Author: Milan Crha <mcrha redhat com>
Date:   Mon Feb 9 15:49:43 2015 +0100

    Bug 742607 - Pick identity from recipients with 'Edit as New Message'
    
    Also unset internal flag to 'set_signature_from_message', to make sure
    that the user's changes in the signature combo will be reflected from
    the beginning, not for the second and more tries.

 composer/e-composer-private.c |   10 ++++++++--
 composer/e-msg-composer.c     |   10 +++++++++-
 2 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/composer/e-composer-private.c b/composer/e-composer-private.c
index 05753d9..4ab817a 100644
--- a/composer/e-composer-private.c
+++ b/composer/e-composer-private.c
@@ -1163,10 +1163,13 @@ insert:
                 * signature id in signature combo box otherwise no signature will be
                 * added but we have to do it just once when the composer opens */
                if (is_message_from_edit_as_new && composer->priv->set_signature_from_message) {
-                       gchar *name = webkit_dom_element_get_attribute (WEBKIT_DOM_ELEMENT (signature), 
"name");
+                       gchar *name;
+
+                       composer->priv->set_signature_from_message = FALSE;
+
+                       name = webkit_dom_element_get_attribute (WEBKIT_DOM_ELEMENT (signature), "name");
                        gtk_combo_box_set_active_id (GTK_COMBO_BOX (combo_box), name);
                        g_free (name);
-                       composer->priv->set_signature_from_message = FALSE;
                }
 
                if (id && (strlen (id) == 1) && (*id == '1')) {
@@ -1236,6 +1239,9 @@ insert:
        composer_move_caret (composer);
 
 exit:
+       /* Make sure the flag will be unset and won't influence user's choice */
+       composer->priv->set_signature_from_message = FALSE;
+
        g_object_unref (composer);
 }
 
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 3645807..72bc687 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -45,6 +45,8 @@
 
 #include <shell/e-shell.h>
 
+#include <libemail-engine/libemail-engine.h>
+
 typedef struct _AsyncContext AsyncContext;
 
 struct _AsyncContext {
@@ -3293,7 +3295,13 @@ e_msg_composer_new_with_message (EShell *shell,
                identity_uid = (gchar *) camel_medium_get_header (
                        CAMEL_MEDIUM (message), "X-Evolution-Account");
        }
-       if (identity_uid != NULL) {
+       if (!identity_uid) {
+               source = em_utils_guess_mail_identity_with_recipients (
+                       e_shell_get_registry (shell), message, NULL, NULL);
+               if (source)
+                       identity_uid = e_source_dup_uid (source);
+       }
+       if (identity_uid != NULL && !source) {
                identity_uid = g_strstrip (g_strdup (identity_uid));
                source = e_composer_header_table_ref_source (
                        table, identity_uid);


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