Finished fixing forward with attachments. There had been some UI issues when forwarding HTML e-mail. Only one more bug to go.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9664 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Nathan Whitehorn
2004-10-30 17:43:01 +00:00
parent fcdc48f1a7
commit 83cb1d3403
2 changed files with 13 additions and 16 deletions
+9 -14
View File
@@ -352,19 +352,18 @@ TEnclosuresView::Focus(bool focus)
} }
static void recursive_attachment_search(TEnclosuresView *us,BMailContainer *mail) { static void recursive_attachment_search(TEnclosuresView *us,BMailContainer *mail,BMailComponent *body) {
if (mail == NULL) if (mail == NULL)
return; return;
for (int32 i = 0; i < mail->CountComponents(); i++) for (int32 i = 0; i < mail->CountComponents(); i++)
{ {
BMailComponent *component = mail->GetComponent(i); BMailComponent *component = mail->GetComponent(i);
if (component->ComponentType() == B_MAIL_MULTIPART_CONTAINER) if (component == body)
recursive_attachment_search(us,dynamic_cast<BMIMEMultipartMailContainer *>(component));
BMailAttachment *attachment = dynamic_cast<BMailAttachment *>(component);
if (attachment == NULL)
continue; continue;
if (component->ComponentType() == B_MAIL_MULTIPART_CONTAINER)
recursive_attachment_search(us,dynamic_cast<BMIMEMultipartMailContainer *>(component),body);
us->fList->AddItem(new TListItem(component)); us->fList->AddItem(new TListItem(component));
} }
} }
@@ -379,11 +378,7 @@ TEnclosuresView::AddEnclosuresFromMail(BEmailMessage *mail)
continue; continue;
if (component->ComponentType() == B_MAIL_MULTIPART_CONTAINER) if (component->ComponentType() == B_MAIL_MULTIPART_CONTAINER)
recursive_attachment_search(this,dynamic_cast<BMIMEMultipartMailContainer *>(component)); recursive_attachment_search(this,dynamic_cast<BMIMEMultipartMailContainer *>(component),mail->Body());
BMailAttachment *attachment = dynamic_cast<BMailAttachment *>(component);
if (attachment == NULL)
continue;
fList->AddItem(new TListItem(component)); fList->AddItem(new TListItem(component));
} }
@@ -526,14 +521,14 @@ TListItem::DrawItem(BView *owner, BRect r, bool /* complete */)
if (fComponent) { if (fComponent) {
// if it's already a mail component, we don't have an icon to // if it's already a mail component, we don't have an icon to
// draw, and the entry_ref is invalid // draw, and the entry_ref is invalid
BMailAttachment *attachment = static_cast<BMailAttachment *>(fComponent); BMailAttachment *attachment = dynamic_cast<BMailAttachment *>(fComponent);
char name[B_FILE_NAME_LENGTH * 2]; char name[B_FILE_NAME_LENGTH * 2];
if (attachment->FileName(name) < B_OK) if ((attachment == NULL) || (attachment->FileName(name) < B_OK))
strcpy(name, "unnamed"); strcpy(name, "unnamed");
BMimeType type; BMimeType type;
if (attachment->MIMEType(&type) == B_OK) if (fComponent->MIMEType(&type) == B_OK)
sprintf(name + strlen(name), ", Type: %s", type.Type()); sprintf(name + strlen(name), ", Type: %s", type.Type());
owner->DrawString(name); owner->DrawString(name);
+3 -1
View File
@@ -563,8 +563,10 @@ BTextMailComponent::RenderToRFC822(BPositionIO *render_to)
if (status < B_OK) if (status < B_OK)
return status; return status;
BMimeType type;
MIMEType(&type);
BString content_type; BString content_type;
content_type << "text/plain"; content_type << type.Type(); // Preserve MIME type (e.g. text/html
for (uint32 i = 0; mail_charsets[i].charset != NULL; i++) { for (uint32 i = 0; mail_charsets[i].charset != NULL; i++) {
if (mail_charsets[i].flavor == charset) { if (mail_charsets[i].flavor == charset) {