[evolution] Plain text signature is opened as an HTML one
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Plain text signature is opened as an HTML one
- Date: Fri, 11 Mar 2016 11:50:13 +0000 (UTC)
commit 4bb0067e53bde4c6d1e988c11d7a62d7481dc77c
Author: Tomas Popela <tpopela redhat com>
Date: Fri Mar 11 12:29:43 2016 +0100
Plain text signature is opened as an HTML one
After the commit cca2aa2 signatures are always saved in HTML. Remember the
editor mode to be able to switch to the right one after editing the signature
again.
Also force the font in the preview to be monospaced for the signatures that were
saved in the plain text mode.
e-util/e-html-editor-view.c | 12 ++++++++++++
e-util/e-mail-signature-editor.c | 8 ++++++--
e-util/e-mail-signature-preview.c | 19 ++++++++++++++++++-
3 files changed, 36 insertions(+), 3 deletions(-)
---
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 4245f12..fecea13 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -10357,11 +10357,23 @@ process_content_for_saving_as_draft (EHTMLEditorView *view,
if (only_inner_body) {
WebKitDOMElement *body;
+ WebKitDOMNode *first_child;
body = webkit_dom_element_query_selector (
WEBKIT_DOM_ELEMENT (document_element_clone), "body", NULL);
+
+ first_child = webkit_dom_node_get_first_child (WEBKIT_DOM_NODE (body));
+
+ if (!view->priv->html_mode)
+ webkit_dom_element_set_attribute (
+ WEBKIT_DOM_ELEMENT (first_child), "data-evo-signature-plain-text-mode", "",
NULL);
+
content = webkit_dom_html_element_get_inner_html (
WEBKIT_DOM_HTML_ELEMENT (body));
+
+ if (!view->priv->html_mode)
+ webkit_dom_element_remove_attribute (
+ WEBKIT_DOM_ELEMENT (first_child), "data-evo-signature-plain-text-mode");
} else
content = webkit_dom_html_element_get_outer_html (
WEBKIT_DOM_HTML_ELEMENT (document_element_clone));
diff --git a/e-util/e-mail-signature-editor.c b/e-util/e-mail-signature-editor.c
index 52bfcb3..4d91694 100644
--- a/e-util/e-mail-signature-editor.c
+++ b/e-util/e-mail-signature-editor.c
@@ -147,9 +147,13 @@ mail_signature_editor_loaded_cb (GObject *object,
view = e_html_editor_get_view (editor);
e_html_editor_view_set_html_mode (view, is_html);
- if (is_html)
+ if (is_html) {
+ if (strstr (contents, "data-evo-signature-plain-text-mode")) {
+ e_html_editor_view_set_html_mode (view, FALSE);
+ e_html_editor_view_set_is_message_from_draft (view, TRUE);
+ }
e_html_editor_view_set_text_html (view, contents);
- else
+ } else
e_html_editor_view_set_text_plain (view, contents);
g_free (contents);
diff --git a/e-util/e-mail-signature-preview.c b/e-util/e-mail-signature-preview.c
index eb67a3d..32acfb0 100644
--- a/e-util/e-mail-signature-preview.c
+++ b/e-util/e-mail-signature-preview.c
@@ -107,7 +107,24 @@ signature_preview_document_loaded_cb (WebKitWebView *web_view,
WebKitWebFrame *web_frame,
gpointer user_data)
{
- replace_local_image_links (webkit_web_view_get_dom_document (web_view));
+ WebKitDOMDocument *document;
+
+ document = webkit_web_view_get_dom_document (web_view);
+ replace_local_image_links (document);
+
+ if ((webkit_dom_document_query_selector (
+ document, "[data-evo-signature-plain-text-mode]", NULL))) {
+
+ WebKitDOMHTMLElement *body;
+
+ body = webkit_dom_document_get_body (document);
+
+ webkit_dom_element_set_attribute (
+ WEBKIT_DOM_ELEMENT (body),
+ "style",
+ "font-family: Monospace;",
+ NULL);
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]