aboutsummaryrefslogtreecommitdiffstats
path: root/em-format
diff options
context:
space:
mode:
authorDan Vrátil <dvratil@redhat.com>2012-06-08 17:30:03 +0800
committerDan Vrátil <dvratil@redhat.com>2012-06-08 17:30:44 +0800
commita6cac3f275db19342e57f2d96141ccfbbf13a8ec (patch)
treee2274b05feb669fae22f3ef03a2ee504ffed3d21 /em-format
parentb3c57ed8e5f1bcbda9ec0fa37a252aeb5313f279 (diff)
downloadgsoc2013-evolution-a6cac3f275db19342e57f2d96141ccfbbf13a8ec.tar
gsoc2013-evolution-a6cac3f275db19342e57f2d96141ccfbbf13a8ec.tar.gz
gsoc2013-evolution-a6cac3f275db19342e57f2d96141ccfbbf13a8ec.tar.bz2
gsoc2013-evolution-a6cac3f275db19342e57f2d96141ccfbbf13a8ec.tar.lz
gsoc2013-evolution-a6cac3f275db19342e57f2d96141ccfbbf13a8ec.tar.xz
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.c40
-rw-r--r--em-format/e-mail-formatter-utils.h6
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_ */