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:
parent
fcdc48f1a7
commit
83cb1d3403
@ -352,18 +352,17 @@ 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)
|
||||
return;
|
||||
for (int32 i = 0; i < mail->CountComponents(); i++)
|
||||
{
|
||||
BMailComponent *component = mail->GetComponent(i);
|
||||
if (component->ComponentType() == B_MAIL_MULTIPART_CONTAINER)
|
||||
recursive_attachment_search(us,dynamic_cast<BMIMEMultipartMailContainer *>(component));
|
||||
|
||||
BMailAttachment *attachment = dynamic_cast<BMailAttachment *>(component);
|
||||
if (attachment == NULL)
|
||||
if (component == body)
|
||||
continue;
|
||||
|
||||
if (component->ComponentType() == B_MAIL_MULTIPART_CONTAINER)
|
||||
recursive_attachment_search(us,dynamic_cast<BMIMEMultipartMailContainer *>(component),body);
|
||||
|
||||
us->fList->AddItem(new TListItem(component));
|
||||
}
|
||||
@ -379,11 +378,7 @@ TEnclosuresView::AddEnclosuresFromMail(BEmailMessage *mail)
|
||||
continue;
|
||||
|
||||
if (component->ComponentType() == B_MAIL_MULTIPART_CONTAINER)
|
||||
recursive_attachment_search(this,dynamic_cast<BMIMEMultipartMailContainer *>(component));
|
||||
|
||||
BMailAttachment *attachment = dynamic_cast<BMailAttachment *>(component);
|
||||
if (attachment == NULL)
|
||||
continue;
|
||||
recursive_attachment_search(this,dynamic_cast<BMIMEMultipartMailContainer *>(component),mail->Body());
|
||||
|
||||
fList->AddItem(new TListItem(component));
|
||||
}
|
||||
@ -526,14 +521,14 @@ TListItem::DrawItem(BView *owner, BRect r, bool /* complete */)
|
||||
if (fComponent) {
|
||||
// if it's already a mail component, we don't have an icon to
|
||||
// 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];
|
||||
if (attachment->FileName(name) < B_OK)
|
||||
if ((attachment == NULL) || (attachment->FileName(name) < B_OK))
|
||||
strcpy(name, "unnamed");
|
||||
|
||||
BMimeType type;
|
||||
if (attachment->MIMEType(&type) == B_OK)
|
||||
if (fComponent->MIMEType(&type) == B_OK)
|
||||
sprintf(name + strlen(name), ", Type: %s", type.Type());
|
||||
|
||||
owner->DrawString(name);
|
||||
|
@ -562,9 +562,11 @@ BTextMailComponent::RenderToRFC822(BPositionIO *render_to)
|
||||
status_t status = ParseRaw();
|
||||
if (status < B_OK)
|
||||
return status;
|
||||
|
||||
|
||||
BMimeType type;
|
||||
MIMEType(&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++) {
|
||||
if (mail_charsets[i].flavor == charset) {
|
||||
|
Loading…
Reference in New Issue
Block a user