diff options
author | Milan Crha <mcrha@redhat.com> | 2008-01-21 18:21:29 +0800 |
---|---|---|
committer | Milan Crha <mcrha@src.gnome.org> | 2008-01-21 18:21:29 +0800 |
commit | 2be6b60d8311b0fd537a2889f8997d3f084755b0 (patch) | |
tree | 3d867d516d19fcb3240c08d6beb3343e5110949d /addressbook/gui/widgets/eab-contact-display.c | |
parent | a63fbb553de7beeec54b6d691e80f650b3548e91 (diff) | |
download | gsoc2013-evolution-2be6b60d8311b0fd537a2889f8997d3f084755b0.tar gsoc2013-evolution-2be6b60d8311b0fd537a2889f8997d3f084755b0.tar.gz gsoc2013-evolution-2be6b60d8311b0fd537a2889f8997d3f084755b0.tar.bz2 gsoc2013-evolution-2be6b60d8311b0fd537a2889f8997d3f084755b0.tar.lz gsoc2013-evolution-2be6b60d8311b0fd537a2889f8997d3f084755b0.tar.xz gsoc2013-evolution-2be6b60d8311b0fd537a2889f8997d3f084755b0.tar.zst gsoc2013-evolution-2be6b60d8311b0fd537a2889f8997d3f084755b0.zip |
** Fix for bug #324604 inspired by patch of makuchaku (Mayank)
2008-01-21 Milan Crha <mcrha@redhat.com>
** Fix for bug #324604 inspired by patch of makuchaku (Mayank)
* gui/widgets/eab-gui-util.h:
* gui/widgets/eab-gui-util.c: (eab_parse_qp_email),
(eab_parse_qp_email_to_html): New helper functions for decoding
email addresses from RFC822 or RFC2047 form to UTF-8.
* gui/widgets/e-minicard.c: (add_email_field):
* gui/widgets/eab-contact-display.c: (render_contact_list),
(render_contact), (eab_contact_display_render_compact):
* gui/widgets/e-addressbook-table-adapter.c:
(struct _EAddressbookTableAdapterPrivate), (addressbook_dispose),
(addressbook_value_at), (addressbook_set_value_at), (remove_contacts),
(modify_contact), (model_changed), (eab_table_adapter_construct):
* gui/widgets/eab-gui-util.c: (get_email),
(eab_send_contact_list_as_attachment):
Ensure the print of the email is transformed from RFC822 or RFC2047.
svn path=/trunk/; revision=34863
Diffstat (limited to 'addressbook/gui/widgets/eab-contact-display.c')
-rw-r--r-- | addressbook/gui/widgets/eab-contact-display.c | 86 |
1 files changed, 58 insertions, 28 deletions
diff --git a/addressbook/gui/widgets/eab-contact-display.c b/addressbook/gui/widgets/eab-contact-display.c index 7510d72189..a93f86e2ea 100644 --- a/addressbook/gui/widgets/eab-contact-display.c +++ b/addressbook/gui/widgets/eab-contact-display.c @@ -488,10 +488,18 @@ render_contact_list (GtkHTMLStream *html_stream, EContact *contact) email_list = e_contact_get (contact, E_CONTACT_EMAIL); for (l = email_list; l; l = l->next) { - char *html = e_text_to_html (l->data, E_TEXT_TO_HTML_CONVERT_ADDRESSES); - gtk_html_stream_printf (html_stream, "%s<br>", html); - g_free (html); + gchar *value; + + value = eab_parse_qp_email_to_html (l->data); + + if (!value) + value = e_text_to_html (l->data, E_TEXT_TO_HTML_CONVERT_ADDRESSES); + + gtk_html_stream_printf (html_stream, "%s<br>", value); + + g_free (value); } + gtk_html_stream_printf (html_stream, "</td></tr></table>"); } @@ -542,18 +550,35 @@ render_contact (GtkHTMLStream *html_stream, EContact *contact) email_attr_list = e_contact_get_attributes (contact, E_CONTACT_EMAIL); for (l = email_list, al=email_attr_list; l && al; l = l->next, al = al->next) { -#ifdef HANDLE_MAILTO_INTERNALLY - char *html = e_text_to_html (l->data, 0); + char *html = NULL, *name = NULL, *mail = NULL; char *attr_str = (char *)get_email_location ((EVCardAttribute *) al->data); - g_string_append_printf (accum, "%s<a href=\"internal-mailto:%d\">%s</a> <font color=" HEADER_COLOR ">(%s)</font>", nl, email_num, html, attr_str?attr_str:""); - email_num ++; - g_free (html); - nl = "<br>"; +#ifdef HANDLE_MAILTO_INTERNALLY + if (!eab_parse_qp_email (l->data, &name, &mail)) + mail = e_text_to_html (l->data, 0); + + g_string_append_printf (accum, "%s%s%s<a href=\"internal-mailto:%d\">%s</a>%s <font color=" HEADER_COLOR ">(%s)</font>", + nl, + name ? name : "", + name ? " <" : "", + email_num, + mail, + name ? ">" : "", + attr_str ? attr_str : ""); + email_num ++; #else - g_string_append_printf (accum, "%s%s <font color=" HEADER_COLOR ">(%s)</font>", nl, (char*)l->data, get_email_location ((EVCardAttribute *) al->data)); - nl = "\n"; + html = eab_parse_qp_email_to_html (l->data); + + if (!html) + html = e_text_to_html (l->data, E_TEXT_TO_HTML_CONVERT_ADDRESSES); + + g_string_append_printf (accum, "%s%s <font color=" HEADER_COLOR ">(%s)</font>", nl, html, attr_str ? attr_str : ""); #endif + nl = "<br>"; + + g_free (html); + g_free (name); + g_free (mail); } g_list_foreach (email_list, (GFunc)g_free, NULL); g_list_free (email_list); @@ -821,29 +846,34 @@ eab_contact_display_render_compact (EABContactDisplay *display, EContact *contac g_free (html); } + #define print_email() { \ + html = eab_parse_qp_email_to_html (str); \ + \ + if (!html) \ + html = e_text_to_html (str, 0); \ + \ + gtk_html_stream_printf (html_stream, "%s%s", comma ? ", " : "", html); \ + g_free (html); \ + comma = TRUE; \ + } + gtk_html_stream_printf (html_stream, "<b>%s:</b> ", _("Email")); str = e_contact_get_const (contact, E_CONTACT_EMAIL_1); - if (str) { - html = e_text_to_html (str, 0); - gtk_html_stream_printf (html_stream, "%s", str); - g_free (html); - comma = TRUE; - } + if (str) + print_email (); + str = e_contact_get_const (contact, E_CONTACT_EMAIL_2); - if (str) { - html = e_text_to_html (str, 0); - gtk_html_stream_printf (html_stream, "%s%s", comma ? ", " : "", str); - g_free (html); - comma = TRUE; - } + if (str) + print_email (); + str = e_contact_get_const (contact, E_CONTACT_EMAIL_3); - if (str) { - html = e_text_to_html (str, 0); - gtk_html_stream_printf (html_stream, "%s%s", comma ? ", " : "", str); - g_free (html); - } + if (str) + print_email (); + gtk_html_stream_write (html_stream, "<br>", 4); + #undef print_email + str = e_contact_get_const (contact, E_CONTACT_HOMEPAGE_URL); if (str) { html = e_text_to_html (str, E_TEXT_TO_HTML_CONVERT_URLS); |