aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-10-16 17:20:31 +0800
committerMilan Crha <mcrha@redhat.com>2009-10-16 17:20:31 +0800
commit3827cbee4ce7bce71da9f811459daba287d896ed (patch)
treefb30d283fee36e6ab6dc55045d889e011bb575c5
parent527e9e472fb5d813f2ba337401af9e8bac70691d (diff)
downloadgsoc2013-evolution-3827cbee4ce7bce71da9f811459daba287d896ed.tar.gz
gsoc2013-evolution-3827cbee4ce7bce71da9f811459daba287d896ed.tar.zst
gsoc2013-evolution-3827cbee4ce7bce71da9f811459daba287d896ed.zip
Bug #522783 - Signature separator for HTML E-mails
Reapplied patch from bug #551470, as this got dropped on merging. Be sure you all also gconftool-2 --install-schema-file=$PREFIX/etc/gconf/schemas/evolution-mail.schemas as new key had been added.
-rw-r--r--composer/e-composer-private.h2
-rw-r--r--composer/e-msg-composer.c23
-rw-r--r--mail/evolution-mail.schemas.in13
-rw-r--r--modules/mail/e-mail-shell-settings.c4
4 files changed, 37 insertions, 5 deletions
diff --git a/composer/e-composer-private.h b/composer/e-composer-private.h
index 7695df5179..3288f0bcca 100644
--- a/composer/e-composer-private.h
+++ b/composer/e-composer-private.h
@@ -63,8 +63,6 @@
COMPOSER_GCONF_PREFIX "/request_receipt"
#define COMPOSER_GCONF_TOP_SIGNATURE_KEY \
COMPOSER_GCONF_PREFIX "/top_signature"
-#define COMPOSER_GCONF_NO_SIGNATURE_DELIM_KEY \
- COMPOSER_GCONF_PREFIX "/no_signature_delim"
#define COMPOSER_GCONF_SEND_HTML_KEY \
COMPOSER_GCONF_PREFIX "/send_html"
#define COMPOSER_GCONF_SPELL_LANGUAGES_KEY \
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 0737d358b5..65bc2acf5e 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -1210,6 +1210,18 @@ is_top_signature (EMsgComposer *composer)
return e_shell_settings_get_boolean (shell_settings, "composer-top-signature");
}
+static gboolean
+add_signature_delim (void)
+{
+ EShell *shell;
+ EShellSettings *shell_settings;
+
+ shell = e_shell_get_default ();
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ return !e_shell_settings_get_boolean (shell_settings, "composer-no-signature-delim");
+}
+
#define CONVERT_SPACES CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES
#define NO_SIGNATURE_TEXT \
"<!--+GtkHTML:<DATA class=\"ClueFlow\" key=\"signature\" value=\"1\">-->" \
@@ -1221,7 +1233,7 @@ get_signature_html (EMsgComposer *composer)
EComposerHeaderTable *table;
gchar *text = NULL, *html = NULL;
ESignature *signature;
- gboolean format_html;
+ gboolean format_html, add_delim;
table = e_msg_composer_get_header_table (composer);
signature = e_composer_header_table_get_signature (table);
@@ -1229,6 +1241,8 @@ get_signature_html (EMsgComposer *composer)
if (!signature)
return NULL;
+ add_delim = add_signature_delim ();
+
if (!e_signature_get_autogenerated (signature)) {
const gchar *filename;
@@ -1258,7 +1272,8 @@ get_signature_html (EMsgComposer *composer)
name = id->name ? camel_text_to_html (id->name, CONVERT_SPACES, 0) : NULL;
organization = id->organization ? camel_text_to_html (id->organization, CONVERT_SPACES, 0) : NULL;
- text = g_strdup_printf ("-- <BR>%s%s%s%s%s%s%s%s",
+ text = g_strdup_printf ("%s%s%s%s%s%s%s%s%s",
+ add_delim ? "-- \n<BR>" : "",
name ? name : "",
(address && *address) ? " &lt;<A HREF=\"mailto:" : "",
address ? address : "",
@@ -1276,6 +1291,8 @@ get_signature_html (EMsgComposer *composer)
/* printf ("text: %s\n", text); */
if (text) {
gchar *encoded_uid = NULL;
+ const gchar *sig_delim = format_html ? "-- \n<BR>" : "-- \n";
+ const gchar *sig_delim_ent = format_html ? "\n-- \n<BR>" : "\n-- \n";
if (signature)
encoded_uid = encode_signature_uid (signature);
@@ -1291,7 +1308,7 @@ get_signature_html (EMsgComposer *composer)
"%s</TD></TR></TABLE>",
encoded_uid ? encoded_uid : "",
format_html ? "" : "<PRE>\n",
- format_html || (!strncmp ("-- \n", text, 4) || strstr (text, "\n-- \n")) ? "" : "-- \n",
+ !add_delim ? "" : (!strncmp (sig_delim, text, strlen (sig_delim)) || strstr (text, sig_delim_ent)) ? "" : sig_delim,
text,
format_html ? "" : "</PRE>\n",
is_top_signature (composer) ? "<BR>" : "");
diff --git a/mail/evolution-mail.schemas.in b/mail/evolution-mail.schemas.in
index 7a975531df..418e57d371 100644
--- a/mail/evolution-mail.schemas.in
+++ b/mail/evolution-mail.schemas.in
@@ -248,6 +248,19 @@
</schema>
<schema>
+ <key>/schemas/apps/evolution/mail/composer/no_signature_delim</key>
+ <applyto>/apps/evolution/mail/composer/no_signature_delim</applyto>
+ <owner>evolution-mail</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Do not add signature delimiter</short>
+ <long>Set to TRUE in case you do not want to add signature delimiter
+ before your signature when composing a mail.</long>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/evolution/mail/composer/width</key>
<applyto>/apps/evolution/mail/composer/width</applyto>
<owner>evolution-mail</owner>
diff --git a/modules/mail/e-mail-shell-settings.c b/modules/mail/e-mail-shell-settings.c
index 907c5fb643..c20f57ce43 100644
--- a/modules/mail/e-mail-shell-settings.c
+++ b/modules/mail/e-mail-shell-settings.c
@@ -226,4 +226,8 @@ e_mail_shell_settings_init (EShell *shell)
e_shell_settings_install_property_for_key (
"composer-top-signature",
"/apps/evolution/mail/composer/top_signature");
+
+ e_shell_settings_install_property_for_key (
+ "composer-no-signature-delim",
+ "/apps/evolution/mail/composer/no_signature_delim");
}