diff --git a/src/apps/bemail/Enclosures.cpp b/src/apps/bemail/Enclosures.cpp index 98a321ae3d..10fd2f9f56 100644 --- a/src/apps/bemail/Enclosures.cpp +++ b/src/apps/bemail/Enclosures.cpp @@ -352,6 +352,23 @@ TEnclosuresView::Focus(bool focus) } +static void recursive_attachment_search(TEnclosuresView *us,BMailContainer *mail) { + 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(component)); + + BMailAttachment *attachment = dynamic_cast(component); + if (attachment == NULL) + continue; + + us->fList->AddItem(new TListItem(component)); + } +} + void TEnclosuresView::AddEnclosuresFromMail(BEmailMessage *mail) { @@ -360,7 +377,10 @@ TEnclosuresView::AddEnclosuresFromMail(BEmailMessage *mail) BMailComponent *component = mail->GetComponent(i); if (component == mail->Body()) continue; - + + if (component->ComponentType() == B_MAIL_MULTIPART_CONTAINER) + recursive_attachment_search(this,dynamic_cast(component)); + BMailAttachment *attachment = dynamic_cast(component); if (attachment == NULL) continue; diff --git a/src/apps/bemail/Mail.cpp b/src/apps/bemail/Mail.cpp index 93eedc5f67..4d238c9c6b 100644 --- a/src/apps/bemail/Mail.cpp +++ b/src/apps/bemail/Mail.cpp @@ -241,7 +241,7 @@ TMailApp::AboutRequested() (new BAlert("", "BeMail\nBy Robert Polic\n\n" "Enhanced by Axel Dörfler and the Dr. Zoidberg crew\n\n" - "Mail.cpp $Revision: 1.1 $\n" + "Mail.cpp $Revision: 1.2 $\n" "Compiled on " __DATE__ " at " __TIME__ ".", "Close"))->Go(); } @@ -2875,14 +2875,19 @@ class HorizontalLine : public BView { void TMailWindow::Print() { + BPrintJob print(Title()); + if (!print_settings) { - PrintSetup(); - if (!print_settings) - return; + if (print.Settings()) { + print_settings = print.Settings(); + } else { + PrintSetup(); + if (!print_settings) + return; + } } - BPrintJob print(Title()); print.SetSettings(new BMessage(*print_settings)); if (print.ConfigJob() == B_NO_ERROR) diff --git a/src/kits/mail/MailAttachment.cpp b/src/kits/mail/MailAttachment.cpp index 42b6b0e838..e02b071279 100644 --- a/src/kits/mail/MailAttachment.cpp +++ b/src/kits/mail/MailAttachment.cpp @@ -340,6 +340,7 @@ void BSimpleMailAttachment::ParseNow() { } status_t BSimpleMailAttachment::RenderToRFC822(BPositionIO *render_to) { + ParseNow(); BMailComponent::RenderToRFC822(render_to); //---------Massive memory squandering!---ALERT!---------- // now with error checks, dumb :-) -- axeld. diff --git a/src/kits/mail/MailComponent.cpp b/src/kits/mail/MailComponent.cpp index 36cb4e783d..4a068faeb8 100644 --- a/src/kits/mail/MailComponent.cpp +++ b/src/kits/mail/MailComponent.cpp @@ -427,6 +427,9 @@ void BTextMailComponent::Quote(const char *message, const char *quote_style) { status_t BTextMailComponent::GetDecodedData(BPositionIO *data) { ParseRaw(); + + if (data == NULL) + return B_IO_ERROR; BMimeType type; ssize_t written; diff --git a/src/kits/mail/MailMessage.cpp b/src/kits/mail/MailMessage.cpp index bf42ff1834..08863f3e68 100644 --- a/src/kits/mail/MailMessage.cpp +++ b/src/kits/mail/MailMessage.cpp @@ -168,7 +168,6 @@ BEmailMessage::ReplyMessage(mail_reply_to_mode replyTo, bool accountFromMail, co return to_return; } - BEmailMessage * BEmailMessage::ForwardMessage(bool accountFromMail, bool includeAttachments) { @@ -195,25 +194,23 @@ BEmailMessage::ForwardMessage(bool accountFromMail, bool includeAttachments) if (includeAttachments) { for (int32 i = 0; i < CountComponents(); i++) { BMailComponent *cmpt = GetComponent(i); - if (cmpt == _text_body) + if (cmpt == _text_body || cmpt == NULL) continue; - + //---I am ashamed to have the written the code between here and the next comment - cmpt->GetDecodedData(NULL); // ... and you still managed to get it wrong ;-)), axeld. // we should really move this stuff into copy constructors // or something like that - + BMallocIO io; cmpt->RenderToRFC822(&io); BMailComponent *clone = cmpt->WhatIsThis(); io.Seek(0, SEEK_SET); clone->SetToRFC822(&io, io.BufferLength(), true); message->AddComponent(clone); - //--- + //--- } } - if (accountFromMail) message->SendViaAccountFrom(this);