From a6cac3f275db19342e57f2d96141ccfbbf13a8ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Vr=C3=A1til?= Date: Fri, 8 Jun 2012 11:30:03 +0200 Subject: Bug #670876 - Missing mnemonics for buttons for vcard attached to email --- .../vcard-inline/e-mail-formatter-vcard-inline.c | 39 ++++++++++++++++------ modules/vcard-inline/e-mail-parser-vcard-inline.c | 33 +++++++++++++++--- 2 files changed, 57 insertions(+), 15 deletions(-) (limited to 'modules/vcard-inline') diff --git a/modules/vcard-inline/e-mail-formatter-vcard-inline.c b/modules/vcard-inline/e-mail-formatter-vcard-inline.c index 25cdacb116..54d095fc31 100644 --- a/modules/vcard-inline/e-mail-formatter-vcard-inline.c +++ b/modules/vcard-inline/e-mail-formatter-vcard-inline.c @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -93,6 +94,7 @@ emfe_vcard_inline_format (EMailFormatterExtension *extension, const gchar *label = NULL; EABContactDisplayMode mode; const gchar *info = NULL; + gchar *html_label, *access_key; length = g_slist_length (vcard_part->contact_list); if (length < 1) @@ -113,33 +115,50 @@ emfe_vcard_inline_format (EMailFormatterExtension *extension, mode = eab_contact_formatter_get_display_mode (vcard_part->formatter); if (mode == EAB_CONTACT_DISPLAY_RENDER_COMPACT) { mode = EAB_CONTACT_DISPLAY_RENDER_NORMAL; - label =_("Show Full vCard"); + label = _("Show F_ull vCard"); } else { mode = EAB_CONTACT_DISPLAY_RENDER_COMPACT; - label = _("Show Compact vCard"); + label = _("Show Com_pact vCard"); } str = g_strdup_printf ( - "
" + "
", part->id); + camel_stream_write_string (stream, str, cancellable, NULL); + g_free (str); + + html_label = e_mail_formatter_parse_html_mnemonics ( + label, &access_key); + str = g_strdup_printf ( "" + "value=\"%d\" " + "accesskey=\"%s\">%s", + mode, access_key, html_label); + camel_stream_write_string (stream, str, cancellable, NULL); + g_free (str); + g_free (html_label); + if (access_key) + g_free (access_key); + + html_label = e_mail_formatter_parse_html_mnemonics ( + _("Save _To Addressbook"), &access_key); + str = g_strdup_printf ( "
" + "value=\"%s\" " + "accesskey=\"%s\">%s
" "" "
", - part->id, - mode, label, - part->id, _("Save To Addressbook"), + part->id, access_key, html_label, uri, part->id); - camel_stream_write_string (stream, str, cancellable, NULL); - g_free (str); + g_free (html_label); + if (access_key) + g_free (access_key); if (length == 2) { diff --git a/modules/vcard-inline/e-mail-parser-vcard-inline.c b/modules/vcard-inline/e-mail-parser-vcard-inline.c index 562ca75c72..e4827d0709 100644 --- a/modules/vcard-inline/e-mail-parser-vcard-inline.c +++ b/modules/vcard-inline/e-mail-parser-vcard-inline.c @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include @@ -191,21 +191,44 @@ display_mode_toggle_cb (WebKitDOMEventTarget *button, { EABContactDisplayMode mode; gchar *uri; + gchar *html_label, *access_key; mode = eab_contact_formatter_get_display_mode (vcard_part->formatter); if (mode == EAB_CONTACT_DISPLAY_RENDER_NORMAL) { mode = EAB_CONTACT_DISPLAY_RENDER_COMPACT; - webkit_dom_html_element_set_inner_text ( + html_label = e_mail_formatter_parse_html_mnemonics ( + _("Show F_ull vCard"), &access_key); + + webkit_dom_html_element_set_inner_html ( WEBKIT_DOM_HTML_ELEMENT (button), - _("Show Full vCard"), NULL); + html_label, NULL); + if (access_key) { + webkit_dom_html_element_set_access_key ( + WEBKIT_DOM_HTML_ELEMENT (button), + access_key); + g_free (access_key); + } + + g_free (html_label); } else { mode = EAB_CONTACT_DISPLAY_RENDER_NORMAL; - webkit_dom_html_element_set_inner_text ( + html_label = e_mail_formatter_parse_html_mnemonics ( + _("Show Com_pact vCard"), &access_key); + + webkit_dom_html_element_set_inner_html ( WEBKIT_DOM_HTML_ELEMENT (button), - _("Show Compact vCard"), NULL); + html_label, NULL); + if (access_key) { + webkit_dom_html_element_set_access_key ( + WEBKIT_DOM_HTML_ELEMENT (button), + access_key); + g_free (access_key); + } + + g_free (html_label); } eab_contact_formatter_set_display_mode (vcard_part->formatter, mode); -- cgit v1.2.3