[evolution] I#1068 - Attached event invitation not properly displayed



commit 337d9136299298d6881aa26b0b6b091249b50102
Author: Milan Crha <mcrha redhat com>
Date:   Thu Sep 3 12:41:05 2020 +0200

    I#1068 - Attached event invitation not properly displayed
    
    Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1068

 data/webkit/e-web-view.js                     | 9 +++++++++
 src/em-format/e-mail-part-secure-button.c     | 3 ++-
 src/em-format/e-mail-part.c                   | 5 +++--
 src/em-format/e-mail-part.h                   | 6 ++++--
 src/mail/e-mail-display.c                     | 4 ++--
 src/modules/itip-formatter/e-mail-part-itip.c | 6 +++++-
 src/modules/vcard-inline/e-mail-part-vcard.c  | 3 ++-
 7 files changed, 27 insertions(+), 9 deletions(-)
---
diff --git a/data/webkit/e-web-view.js b/data/webkit/e-web-view.js
index 0b3034ff0e..9f3f1cf865 100644
--- a/data/webkit/e-web-view.js
+++ b/data/webkit/e-web-view.js
@@ -686,6 +686,15 @@ Evo.initializeAndPostContentLoaded = function(elem)
        else if (window.frameElement)
                iframe_id = window.frameElement.id;
 
+       /* Skip, when its content is not loaded yet */
+       if (iframe_id != "" && elem && elem.tagName == "IFRAME" && elem.contentDocument &&
+           (!elem.contentDocument.body || !elem.contentDocument.body.childElementCount)) {
+               if (elem.contentDocument.body) {
+                       elem.contentDocument.body.onload = function() { 
Evo.initializeAndPostContentLoaded(this); };
+               }
+               return;
+       }
+
        Evo.initialize(elem);
        window.webkit.messageHandlers.contentLoaded.postMessage(iframe_id);
 
diff --git a/src/em-format/e-mail-part-secure-button.c b/src/em-format/e-mail-part-secure-button.c
index dc3cdb621b..cdce11e37d 100644
--- a/src/em-format/e-mail-part-secure-button.c
+++ b/src/em-format/e-mail-part-secure-button.c
@@ -312,7 +312,8 @@ secure_button_details_clicked_cb (EWebView *web_view,
 
 static void
 mail_part_secure_button_content_loaded (EMailPart *mail_part,
-                                       EWebView *web_view)
+                                       EWebView *web_view,
+                                       const gchar *iframe_id)
 {
        g_return_if_fail (E_IS_MAIL_PART_SECURE_BUTTON (mail_part));
        g_return_if_fail (E_IS_WEB_VIEW (web_view));
diff --git a/src/em-format/e-mail-part.c b/src/em-format/e-mail-part.c
index 9a2e1ae179..53499f2488 100644
--- a/src/em-format/e-mail-part.c
+++ b/src/em-format/e-mail-part.c
@@ -632,7 +632,8 @@ e_mail_part_set_is_printable (EMailPart *part,
 
 void
 e_mail_part_content_loaded (EMailPart *part,
-                           EWebView *web_view)
+                           EWebView *web_view,
+                           const gchar *iframe_id)
 {
        EMailPartClass *class;
 
@@ -643,7 +644,7 @@ e_mail_part_content_loaded (EMailPart *part,
        g_return_if_fail (class != NULL);
 
        if (class->content_loaded)
-               class->content_loaded (part, web_view);
+               class->content_loaded (part, web_view, iframe_id);
 }
 
 static EMailPartValidityPair *
diff --git a/src/em-format/e-mail-part.h b/src/em-format/e-mail-part.h
index 8d2c8122c1..33e7636741 100644
--- a/src/em-format/e-mail-part.h
+++ b/src/em-format/e-mail-part.h
@@ -86,7 +86,8 @@ struct _EMailPartClass {
        GObjectClass parent_class;
 
        void            (*content_loaded)       (EMailPart *part,
-                                                EWebView *web_view);
+                                                EWebView *web_view,
+                                                const gchar *iframe_id);
 };
 
 GType          e_mail_part_get_type            (void) G_GNUC_CONST;
@@ -123,7 +124,8 @@ gboolean    e_mail_part_get_is_printable    (EMailPart *part);
 void           e_mail_part_set_is_printable    (EMailPart *part,
                                                 gboolean is_printable);
 void           e_mail_part_content_loaded      (EMailPart *part,
-                                                EWebView *web_view);
+                                                EWebView *web_view,
+                                                const gchar *iframe_id);
 void           e_mail_part_update_validity     (EMailPart *part,
                                                 CamelCipherValidity *validity,
                                                 EMailPartValidityFlags validity_type);
diff --git a/src/mail/e-mail-display.c b/src/mail/e-mail-display.c
index 20a0fb35a5..8ac3a3f72d 100644
--- a/src/mail/e-mail-display.c
+++ b/src/mail/e-mail-display.c
@@ -1314,7 +1314,7 @@ mail_display_content_loaded_cb (EWebView *web_view,
                        for (link = head; link; link = g_list_next (link)) {
                                EMailPart *part = E_MAIL_PART (link->data);
 
-                               e_mail_part_content_loaded (part, web_view);
+                               e_mail_part_content_loaded (part, web_view, NULL);
                        }
 
                        while (!g_queue_is_empty (&queue))
@@ -1325,7 +1325,7 @@ mail_display_content_loaded_cb (EWebView *web_view,
                        part = e_mail_part_list_ref_part (mail_display->priv->part_list, iframe_id);
 
                        if (part)
-                               e_mail_part_content_loaded (part, web_view);
+                               e_mail_part_content_loaded (part, web_view, iframe_id);
 
                        g_clear_object (&part);
                }
diff --git a/src/modules/itip-formatter/e-mail-part-itip.c b/src/modules/itip-formatter/e-mail-part-itip.c
index 26e1678eac..3a1777b2f0 100644
--- a/src/modules/itip-formatter/e-mail-part-itip.c
+++ b/src/modules/itip-formatter/e-mail-part-itip.c
@@ -71,13 +71,17 @@ mail_part_itip_finalize (GObject *object)
 
 static void
 mail_part_itip_content_loaded (EMailPart *part,
-                              EWebView *web_view)
+                              EWebView *web_view,
+                              const gchar *iframe_id)
 {
        EMailPartItip *pitip;
 
        g_return_if_fail (E_IS_MAIL_PART_ITIP (part));
        g_return_if_fail (E_IS_WEB_VIEW (web_view));
 
+       if (g_strcmp0 ((iframe_id && *iframe_id) ? iframe_id : NULL, e_mail_part_get_id (part)) != 0)
+               return;
+
        pitip = E_MAIL_PART_ITIP (part);
 
        if (pitip->message) {
diff --git a/src/modules/vcard-inline/e-mail-part-vcard.c b/src/modules/vcard-inline/e-mail-part-vcard.c
index 57ac2cc433..cf3ad36f1b 100644
--- a/src/modules/vcard-inline/e-mail-part-vcard.c
+++ b/src/modules/vcard-inline/e-mail-part-vcard.c
@@ -181,7 +181,8 @@ mail_part_vcard_constructed (GObject *object)
 
 static void
 mail_part_vcard_content_loaded (EMailPart *part,
-                               EWebView *web_view)
+                               EWebView *web_view,
+                               const gchar *iframe_id)
 {
        g_return_if_fail (E_IS_WEB_VIEW (web_view));
        g_return_if_fail (E_IS_MAIL_PART_VCARD (part));


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