* Now derived subject composes a string with no subject
also for a "" subject.
* src/widgets/modest-attachment-view.c:
* If subject is "", we also show no subject string
* src/modest-tny-msg.c:
* If we are forwarding, and the mail is formatted in html,
we forward the message as attachment (fixes NB#62261).
* src/modest-formatter.[ch]:
* Fixed modest_formatter_attach, to attach the TnyMsg instead
of a mime part.
pmo-trunk-r2930
-modest_formatter_attach (ModestFormatter *self, TnyMimePart *body, TnyHeader *header)
+modest_formatter_attach (ModestFormatter *self, TnyMsg *msg, TnyHeader *header)
{
TnyMsg *new_msg = NULL;
{
TnyMsg *new_msg = NULL;
- gchar *attach_text = NULL;
- const gchar *subject;
- TnyMimePart *body_part = NULL, *attach_part = NULL;
+ TnyMimePart *body_part = NULL;
ModestFormatterPrivate *priv;
TnyPlatformFactory *fact;
ModestFormatterPrivate *priv;
TnyPlatformFactory *fact;
/* Build new part */
new_msg = modest_formatter_create_message (self, TRUE, TRUE);
body_part = modest_formatter_create_body_part (self, new_msg);
/* Build new part */
new_msg = modest_formatter_create_message (self, TRUE, TRUE);
body_part = modest_formatter_create_body_part (self, new_msg);
- attach_part = tny_platform_factory_new_mime_part (fact);
/* Create the two parts */
priv = MODEST_FORMATTER_GET_PRIVATE (self);
/* Create the two parts */
priv = MODEST_FORMATTER_GET_PRIVATE (self);
- attach_text = extract_text (self, body);
construct_from_text (body_part, "", priv->content_type);
g_object_unref (body_part);
construct_from_text (body_part, "", priv->content_type);
g_object_unref (body_part);
- construct_from_text (attach_part, (const gchar*) attach_text, priv->content_type);
- subject = tny_header_get_subject (header);
- tny_mime_part_set_filename (attach_part, subject ? subject : _("No subject"));
- tny_mime_part_add_part (TNY_MIME_PART (new_msg), attach_part);
- g_object_unref (attach_part);
-
- /* Clean */
- g_free (attach_text);
+ tny_mime_part_add_part (TNY_MIME_PART (new_msg), TNY_MIME_PART (msg));
*
* Returns: a newly formatted #TnyMsg or NULL in case of error
**/
*
* Returns: a newly formatted #TnyMsg or NULL in case of error
**/
-TnyMsg * modest_formatter_attach (ModestFormatter *self, TnyMimePart *part, TnyHeader *header);
+TnyMsg * modest_formatter_attach (ModestFormatter *self, TnyMsg *msg, TnyHeader *header);
/**
* modest_formatter_create_message:
/**
* modest_formatter_create_message:
gchar *tmp;
g_return_val_if_fail (prefix, NULL);
gchar *tmp;
g_return_val_if_fail (prefix, NULL);
-
- if (!subject)
- return g_strdup (prefix);
+
+ if (!subject || subject[0] == '\0')
+ subject = _("mail_va_no_subject");
tmp = g_strchug (g_strdup (subject));
tmp = g_strchug (g_strdup (subject));
header = tny_msg_get_header (msg);
if (msg != NULL)
header = tny_msg_get_header (msg);
if (msg != NULL)
- body = modest_tny_msg_find_body_part (msg, FALSE);
+ body = modest_tny_msg_find_body_part (msg, !is_reply);
/* TODO: select the formatter from account prefs */
if (modest_conf_get_bool (modest_runtime_get_conf (), MODEST_CONF_PREFER_FORMATTED_TEXT, NULL))
/* TODO: select the formatter from account prefs */
if (modest_conf_get_bool (modest_runtime_get_conf (), MODEST_CONF_PREFER_FORMATTED_TEXT, NULL))
switch (type) {
case MODEST_TNY_MSG_FORWARD_TYPE_INLINE:
default:
switch (type) {
case MODEST_TNY_MSG_FORWARD_TYPE_INLINE:
default:
- new_msg = modest_formatter_inline (formatter, body, header, attachments);
+ if (strcmp (tny_mime_part_get_content_type (body), "text/html")==0)
+ new_msg = modest_formatter_attach (formatter, msg, header);
+ else
+ new_msg = modest_formatter_inline (formatter, body, header, attachments);
break;
case MODEST_TNY_MSG_FORWARD_TYPE_ATTACHMENT:
break;
case MODEST_TNY_MSG_FORWARD_TYPE_ATTACHMENT:
- new_msg = modest_formatter_attach (formatter, body, header);
+ new_msg = modest_formatter_attach (formatter, msg, header);
TnyHeader *header = tny_msg_get_header (TNY_MSG (mime_part));
if (TNY_IS_HEADER (header)) {
filename = g_strdup (tny_header_get_subject (header));
TnyHeader *header = tny_msg_get_header (TNY_MSG (mime_part));
if (TNY_IS_HEADER (header)) {
filename = g_strdup (tny_header_get_subject (header));
+ if (filename == NULL || filename[0] == '\0')
filename = g_strdup (_("mail_va_no_subject"));
if (priv->is_purged)
file_icon_name = modest_platform_get_file_icon_name (NULL, NULL, NULL);
filename = g_strdup (_("mail_va_no_subject"));
if (priv->is_purged)
file_icon_name = modest_platform_get_file_icon_name (NULL, NULL, NULL);