aboutsummaryrefslogtreecommitdiffstats
path: root/composer/e-msg-composer.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-12-16 07:14:57 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-12-16 07:14:57 +0800
commit1f9b8f9c4eb80dab128458f7f3e49c3a25ff5a00 (patch)
tree8c68db4cb047352e96a3a684b67ce7e604e3e6fc /composer/e-msg-composer.c
parentce4bd7a99eaea7274956a0092bf6c867b97dee77 (diff)
downloadgsoc2013-evolution-1f9b8f9c4eb80dab128458f7f3e49c3a25ff5a00.tar.gz
gsoc2013-evolution-1f9b8f9c4eb80dab128458f7f3e49c3a25ff5a00.tar.zst
gsoc2013-evolution-1f9b8f9c4eb80dab128458f7f3e49c3a25ff5a00.zip
New function to get whether or not to encrypt the message.
2000-12-15 Jeffrey Stedfast <fejj@helixcode.com> * e-msg-composer.c (e_msg_composer_get_pgp_encrypt): New function to get whether or not to encrypt the message. (e_msg_composer_set_pgp_encrypt): New function to set encryption. (e_msg_composer_get_pgp_sign): New function to get whether or not to sign the message. (e_msg_composer_set_pgp_sign): New function to set pgp_sign. (init): Initialize pgp_sign and pgp_encrypt to FALSE. svn path=/trunk/; revision=7058
Diffstat (limited to 'composer/e-msg-composer.c')
-rw-r--r--composer/e-msg-composer.c101
1 files changed, 98 insertions, 3 deletions
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 8143bee24e..44994540cb 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -46,6 +46,7 @@
#include "camel-charset-map.h"
#include "mail/mail.h"
+#include "mail/mail-crypto.h"
#include "mail/mail-tools.h"
#include "mail/mail-threads.h"
@@ -391,15 +392,15 @@ build_message (EMsgComposer *composer)
camel_medium_set_content_object (CAMEL_MEDIUM (new), CAMEL_DATA_WRAPPER (body));
camel_object_unref (CAMEL_OBJECT (body));
break;
-
case MSG_FORMAT_PLAIN:
camel_mime_part_set_content (CAMEL_MIME_PART (new), plain, strlen (plain), best_content (plain));
-
+
if (plain_e8bit)
camel_mime_part_set_encoding (CAMEL_MIME_PART (new), best_encoding (plain));
-
+
g_free (plain);
g_free (content_type);
+
break;
}
}
@@ -1292,6 +1293,8 @@ init (EMsgComposer *composer)
composer->attachment_bar_visible = FALSE;
composer->send_html = FALSE;
+ composer->pgp_sign = FALSE;
+ composer->pgp_encrypt = FALSE;
}
@@ -2039,6 +2042,98 @@ e_msg_composer_get_send_html (EMsgComposer *composer)
}
+/**
+ * e_msg_composer_set_pgp_sign:
+ * @composer: A message composer widget
+ * @send_html: Whether the composer should have the "PGP Sign" flag set
+ *
+ * Set the status of the "PGP Sign" toggle item. The user can override it.
+ **/
+void
+e_msg_composer_set_pgp_sign (EMsgComposer *composer, gboolean pgp_sign)
+{
+ g_return_if_fail (composer != NULL);
+ g_return_if_fail (E_IS_MSG_COMPOSER (composer));
+
+ if (composer->pgp_sign && pgp_sign)
+ return;
+ if (!composer->pgp_sign && !pgp_sign)
+ return;
+
+ composer->pgp_sign = pgp_sign;
+
+ bonobo_ui_component_set_prop (composer->uic, "/commands/SecuritySign",
+ "state", composer->pgp_sign ? "1" : "0", NULL);
+}
+
+
+/**
+ * e_msg_composer_get_pgp_sign:
+ * @composer: A message composer widget
+ *
+ * Get the status of the "PGP Sign" flag.
+ *
+ * Return value: The status of the "PGP Sign" flag.
+ **/
+gboolean
+e_msg_composer_get_pgp_sign (EMsgComposer *composer)
+{
+ g_return_val_if_fail (composer != NULL, FALSE);
+ g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE);
+
+ return composer->pgp_sign;
+}
+
+
+/**
+ * e_msg_composer_set_pgp_encrypt:
+ * @composer: A message composer widget
+ * @send_html: Whether the composer should have the "PGP Encrypt" flag set
+ *
+ * Set the status of the "PGP Encrypt" toggle item. The user can override it.
+ **/
+void
+e_msg_composer_set_pgp_encrypt (EMsgComposer *composer, gboolean pgp_encrypt)
+{
+ g_return_if_fail (composer != NULL);
+ g_return_if_fail (E_IS_MSG_COMPOSER (composer));
+
+ if (composer->pgp_encrypt && pgp_encrypt)
+ return;
+ if (!composer->pgp_encrypt && !pgp_encrypt)
+ return;
+
+ composer->pgp_encrypt = pgp_encrypt;
+
+ bonobo_ui_component_set_prop (composer->uic, "/commands/SecurityEncrypt",
+ "state", composer->pgp_encrypt ? "1" : "0", NULL);
+}
+
+
+/**
+ * e_msg_composer_get_pgp_encrypt:
+ * @composer: A message composer widget
+ *
+ * Get the status of the "PGP Encrypt" flag.
+ *
+ * Return value: The status of the "PGP Encrypt" flag.
+ **/
+gboolean
+e_msg_composer_get_pgp_encrypt (EMsgComposer *composer)
+{
+ g_return_val_if_fail (composer != NULL, FALSE);
+ g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE);
+
+ return composer->pgp_encrypt;
+}
+
+
+/**
+ * e_msg_composer_guess_mime_type:
+ * @file_name: filename
+ *
+ * Returns the guessed mime type of the file given by #file_name.
+ **/
gchar *
e_msg_composer_guess_mime_type (const gchar *file_name)
{