diff options
author | Dan Vrátil <dvratil@redhat.com> | 2012-06-08 17:30:03 +0800 |
---|---|---|
committer | Dan Vrátil <dvratil@redhat.com> | 2012-06-08 17:30:44 +0800 |
commit | a6cac3f275db19342e57f2d96141ccfbbf13a8ec (patch) | |
tree | e2274b05feb669fae22f3ef03a2ee504ffed3d21 /em-format | |
parent | b3c57ed8e5f1bcbda9ec0fa37a252aeb5313f279 (diff) | |
download | gsoc2013-evolution-a6cac3f275db19342e57f2d96141ccfbbf13a8ec.tar.gz gsoc2013-evolution-a6cac3f275db19342e57f2d96141ccfbbf13a8ec.tar.zst gsoc2013-evolution-a6cac3f275db19342e57f2d96141ccfbbf13a8ec.zip |
Bug #670876 - Missing mnemonics for buttons for vcard attached to email
Diffstat (limited to 'em-format')
-rw-r--r-- | em-format/e-mail-formatter-utils.c | 40 | ||||
-rw-r--r-- | em-format/e-mail-formatter-utils.h | 6 |
2 files changed, 45 insertions, 1 deletions
diff --git a/em-format/e-mail-formatter-utils.c b/em-format/e-mail-formatter-utils.c index 12ee042c90..7f2108eb38 100644 --- a/em-format/e-mail-formatter-utils.c +++ b/em-format/e-mail-formatter-utils.c @@ -432,3 +432,43 @@ e_mail_formatter_find_rfc822_end_iter (GSList *iter) g_free (end); return iter; } + +gchar * +e_mail_formatter_parse_html_mnemonics (const gchar *label, + gchar **access_key) +{ + const gchar *pos = NULL; + gchar ak = 0; + GString *html_label = NULL; + + pos = strstr (label, "_"); + if (pos != NULL) { + ak = pos[1]; + + /* Convert to uppercase */ + if (ak >= 'a') + ak = ak - 32; + + html_label = g_string_new (""); + g_string_append_len (html_label, label, pos - label); + g_string_append_printf (html_label, "<u>%c</u>", pos[1]); + g_string_append (html_label, &pos[2]); + + if (access_key) { + if (ak) { + *access_key = g_strdup_printf ("%c", ak); + } else { + *access_key = NULL; + } + } + + } else { + html_label = g_string_new (label); + + if (access_key) { + *access_key = NULL; + } + } + + return g_string_free (html_label, FALSE); +} diff --git a/em-format/e-mail-formatter-utils.h b/em-format/e-mail-formatter-utils.h index 59d8e43257..e89c3f42b4 100644 --- a/em-format/e-mail-formatter-utils.h +++ b/em-format/e-mail-formatter-utils.h @@ -48,9 +48,13 @@ gchar * e_mail_formatter_format_address (EMailFormatter *formatter, void e_mail_formatter_canon_header_name (gchar *name); -GSList * e_mail_formatter_find_rfc822_end_iter +GSList * e_mail_formatter_find_rfc822_end_iter (GSList *rfc822_start_iter); +gchar * e_mail_formatter_parse_html_mnemonics + (const gchar *label, + gchar **access_key); + G_END_DECLS #endif /* E_MAIL_FORMATTER_UTILS_H_ */ |