diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2003-07-17 04:45:56 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2003-07-17 04:45:56 +0800 |
commit | 1dea5ca33880b87d3d0be94867755aa69707a627 (patch) | |
tree | c686decae5f0d06c2d906563d9f74d92d0c6fa3c | |
parent | b83ddf044ce11b4c52996f7827d843465ad5659b (diff) | |
download | gsoc2013-evolution-1dea5ca33880b87d3d0be94867755aa69707a627.tar gsoc2013-evolution-1dea5ca33880b87d3d0be94867755aa69707a627.tar.gz gsoc2013-evolution-1dea5ca33880b87d3d0be94867755aa69707a627.tar.bz2 gsoc2013-evolution-1dea5ca33880b87d3d0be94867755aa69707a627.tar.lz gsoc2013-evolution-1dea5ca33880b87d3d0be94867755aa69707a627.tar.xz gsoc2013-evolution-1dea5ca33880b87d3d0be94867755aa69707a627.tar.zst gsoc2013-evolution-1dea5ca33880b87d3d0be94867755aa69707a627.zip |
don't set the rawtext bit anymore.
2003-07-16 Jeffrey Stedfast <fejj@ximian.com>
* e-msg-composer-attachment-bar.c (attach_to_multipart): don't set
the rawtext bit anymore.
* e-msg-composer.c (build_message): Convert the plain part's
content stream from UTF-8 to whatever charset we want.
2003-07-16 Jeffrey Stedfast <fejj@ximian.com>
* e-msg-composer-attachment-bar.c (popup_menu_event): Fix warnings
and other breakage introduced by Maxx.
svn path=/trunk/; revision=21843
-rw-r--r-- | composer/ChangeLog | 13 | ||||
-rw-r--r-- | composer/e-msg-composer-attachment-bar.c | 67 | ||||
-rw-r--r-- | composer/e-msg-composer.c | 37 |
3 files changed, 68 insertions, 49 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog index 529a2b800e..678e960a81 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,16 @@ +2003-07-16 Jeffrey Stedfast <fejj@ximian.com> + + * e-msg-composer-attachment-bar.c (attach_to_multipart): don't set + the rawtext bit anymore. + + * e-msg-composer.c (build_message): Convert the plain part's + content stream from UTF-8 to whatever charset we want. + +2003-07-16 Jeffrey Stedfast <fejj@ximian.com> + + * e-msg-composer-attachment-bar.c (popup_menu_event): Fix warnings + and other breakage introduced by Maxx. + 2002-07-14 Maxx Cao <maxx.cao@sun.com> ** For bug #45826 diff --git a/composer/e-msg-composer-attachment-bar.c b/composer/e-msg-composer-attachment-bar.c index e359ffd042..05a1b549f3 100644 --- a/composer/e-msg-composer-attachment-bar.c +++ b/composer/e-msg-composer-attachment-bar.c @@ -44,12 +44,12 @@ #include <gal/util/e-iconv.h> -#include "camel/camel-data-wrapper.h" -#include "camel/camel-stream-fs.h" -#include "camel/camel-stream-null.h" -#include "camel/camel-stream-filter.h" -#include "camel/camel-mime-filter-bestenc.h" -#include "camel/camel-mime-part.h" +#include <camel/camel-data-wrapper.h> +#include <camel/camel-stream-fs.h> +#include <camel/camel-stream-null.h> +#include <camel/camel-stream-filter.h> +#include <camel/camel-mime-filter-bestenc.h> +#include <camel/camel-mime-part.h> #include "e-util/e-gui-utils.h" @@ -529,30 +529,29 @@ destroy (GtkObject *object) static void -popup_menu_placement_callback(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer user_data) +popup_menu_placement_callback (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer user_data) { EMsgComposerAttachmentBar *bar; GnomeIconList *icon_list; GList *selection; GnomeCanvasPixbuf *image; - + bar = E_MSG_COMPOSER_ATTACHMENT_BAR (user_data); icon_list = GNOME_ICON_LIST (user_data); - + gdk_window_get_origin (((GtkWidget*) bar)->window, x, y); - + selection = gnome_icon_list_get_selection (icon_list); if (selection == NULL) return; - + image = gnome_icon_list_get_icon_pixbuf_item (icon_list, (gint)selection->data); if (image == NULL) return; - + /* Put menu to the center of icon. */ - *x += (gint)(image->item.x1 + image->item.x2)/2; - *y += (gint)(image->item.y1 + image->item.y2)/2; - + *x += (int)(image->item.x1 + image->item.x2) / 2; + *y += (int)(image->item.y1 + image->item.y2) / 2; } static gboolean @@ -561,16 +560,16 @@ popup_menu_event (GtkWidget *widget) EMsgComposerAttachmentBar *bar = E_MSG_COMPOSER_ATTACHMENT_BAR (widget); GnomeIconList *icon_list = GNOME_ICON_LIST (widget); GList *selection = gnome_icon_list_get_selection (icon_list); - GtkMenu *menu; - - if (selection==NULL) + GtkWidget *menu; + + if (selection == NULL) menu = get_context_menu (bar); else menu = get_icon_context_menu (bar); - + gnome_popup_menu_do_popup (menu, popup_menu_placement_callback, - (gpointer)widget, NULL, (gpointer)widget, NULL); - + widget, NULL, widget, NULL); + return TRUE; } @@ -746,29 +745,22 @@ attach_to_multipart (CamelMultipart *multipart, if (!CAMEL_IS_MULTIPART (content)) { if (header_content_type_is (content_type, "text", "*")) { CamelMimePartEncodingType encoding; - CamelStreamFilter *filtered_stream; + CamelStreamFilter *filter_stream; CamelMimeFilterBestenc *bestenc; CamelStream *stream; const char *charset; char *type; - /* assume that if a charset is set, that the content is in UTF-8 - * or else already has rawtext set to TRUE */ - if (!(charset = header_content_type_param (content_type, "charset"))) { - /* Let camel know that this text part was read in raw and thus is not in - * UTF-8 format so that when it writes this part out, it doesn't try to - * convert it from UTF-8 into the @default_charset charset. */ - content->rawtext = TRUE; - } + charset = header_content_type_param (content_type, "charset"); stream = camel_stream_null_new (); - filtered_stream = camel_stream_filter_new_with_stream (stream); + filter_stream = camel_stream_filter_new_with_stream (stream); bestenc = camel_mime_filter_bestenc_new (CAMEL_BESTENC_GET_ENCODING); - camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (bestenc)); - camel_object_unref (CAMEL_OBJECT (stream)); + camel_stream_filter_add (filter_stream, CAMEL_MIME_FILTER (bestenc)); + camel_object_unref (stream); - camel_data_wrapper_write_to_stream (content, CAMEL_STREAM (filtered_stream)); - camel_object_unref (CAMEL_OBJECT (filtered_stream)); + camel_data_wrapper_write_to_stream (content, CAMEL_STREAM (filter_stream)); + camel_object_unref (filter_stream); encoding = camel_mime_filter_bestenc_get_best_encoding (bestenc, CAMEL_BESTENC_8BIT); camel_mime_part_set_encoding (attachment->body, encoding); @@ -794,10 +786,9 @@ attach_to_multipart (CamelMultipart *multipart, g_free (type); } - camel_object_unref (CAMEL_OBJECT (bestenc)); + camel_object_unref (bestenc); } else if (!CAMEL_IS_MIME_MESSAGE (content)) { - camel_mime_part_set_encoding (attachment->body, - CAMEL_MIME_PART_ENCODING_BASE64); + camel_mime_part_set_encoding (attachment->body, CAMEL_MIME_PART_ENCODING_BASE64); } } diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 32b39b88d0..f1e634b809 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -1,7 +1,7 @@ /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ /* e-msg-composer.c * - * Copyright (C) 1999 Ximian, Inc. + * Copyright (C) 1999-2003 Ximian, Inc. (www.ximian.com) * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public @@ -80,9 +80,10 @@ #include "e-util/e-dialog-utils.h" #include "widgets/misc/e-charset-picker.h" -#include "camel/camel.h" -#include "camel/camel-charset-map.h" -#include "camel/camel-session.h" +#include <camel/camel-session.h> +#include <camel/camel-charset-map.h> +#include <camel/camel-stream-filter.h> +#include <camel/camel-mime-filter-charset.h> #include "mail/mail-callbacks.h" #include "mail/mail-crypto.h" @@ -345,16 +346,16 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) EMsgComposerAttachmentBar *attachment_bar = E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar); EMsgComposerHdrs *hdrs = E_MSG_COMPOSER_HDRS (composer->hdrs); - CamelMimeMessage *new; - GByteArray *data; CamelDataWrapper *plain, *html, *current; CamelMimePartEncodingType plain_encoding; - const char *charset; + CamelMultipart *body = NULL; CamelContentType *type; + CamelMimeMessage *new; + const char *charset; CamelStream *stream; - CamelMultipart *body = NULL; CamelMimePart *part; CamelException ex; + GByteArray *data; int i; if (composer->persist_stream_interface == CORBA_OBJECT_NIL) @@ -402,11 +403,26 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) } plain = camel_data_wrapper_new (); - plain->rawtext = FALSE; - stream = camel_stream_mem_new_with_byte_array (data); + /* convert the stream to the appropriate charset */ + if (charset && strcasecmp (charset, "UTF-8") != 0) { + CamelStreamFilter *filter_stream; + CamelMimeFilterCharset *filter; + + stream = camel_stream_mem_new_with_byte_array (data); + filter_stream = camel_stream_filter_new_with_stream (stream); + camel_object_unref (stream); + + stream = (CamelStream *) filter_stream; + filter = camel_mime_filter_charset_new_convert ("UTF-8", charset); + camel_stream_filter_add (filter_stream, (CamelMimeFilter *) filter); + camel_object_unref (filter); + } + + /* construct the content object */ camel_data_wrapper_construct_from_stream (plain, stream); camel_object_unref (stream); + camel_data_wrapper_set_mime_type_field (plain, type); header_content_type_unref (type); @@ -432,7 +448,6 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) } html = camel_data_wrapper_new (); - html->rawtext = FALSE; stream = camel_stream_mem_new_with_byte_array (data); camel_data_wrapper_construct_from_stream (html, stream); |