* src/modest-text-utils.c:
authorJose Dapena Paz <jdapena@igalia.com>
Fri, 3 Aug 2007 19:41:34 +0000 (19:41 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Fri, 3 Aug 2007 19:41:34 +0000 (19:41 +0000)
        * 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

src/modest-formatter.c
src/modest-formatter.h
src/modest-text-utils.c
src/modest-tny-msg.c
src/widgets/modest-attachment-view.c

index c495310..73fdfbb 100644 (file)
@@ -168,12 +168,10 @@ modest_formatter_inline (ModestFormatter *self, TnyMimePart *body, TnyHeader *he
 }
 
 TnyMsg *
-modest_formatter_attach (ModestFormatter *self, TnyMimePart *body, TnyHeader *header)
+modest_formatter_attach (ModestFormatter *self, TnyMsg *msg, TnyHeader *header)
 {
        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;
 
@@ -181,23 +179,14 @@ modest_formatter_attach (ModestFormatter *self, TnyMimePart *body, TnyHeader *he
        /* 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);
-       attach_text = extract_text (self, body);
        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"));
 
        /* Add parts */
-       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));
 
        return new_msg;
 }
index 6ddbdd6..338c2a0 100644 (file)
@@ -167,7 +167,7 @@ TnyMsg * modest_formatter_inline (ModestFormatter *self, TnyMimePart *part, TnyH
  *
  * 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:
index aaa025d..d674686 100644 (file)
@@ -248,9 +248,9 @@ modest_text_utils_derived_subject (const gchar *subject, const gchar *prefix)
        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));
 
index 6278399..523f143 100644 (file)
@@ -416,7 +416,7 @@ create_reply_forward_mail (TnyMsg *msg, TnyHeader *header, const gchar *from, co
                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))
@@ -439,10 +439,13 @@ create_reply_forward_mail (TnyMsg *msg, TnyHeader *header, const gchar *from, co
                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:
-                       new_msg = modest_formatter_attach (formatter, body, header);
+                       new_msg = modest_formatter_attach (formatter, msg, header);
                        break;
                }
        }
index 7960fb0..3628204 100644 (file)
@@ -212,7 +212,7 @@ modest_attachment_view_set_part_default (TnyMimePartView *self, TnyMimePart *mim
                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)
+                       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);