From f363ddf101a097494ec50f6f1a4f3dfcce61657f Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Fri, 20 Jul 2012 18:17:06 +0000 Subject: [PATCH] See ChangeLog Monotone-Parent: 5a6d160e6f9616edb725a40e08f24f0f0bf539b0 Monotone-Revision: 173ccf9cd4cd08cdc361da9d58df641be065e5a5 Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2012-07-20T18:17:06 --- ChangeLog | 6 ++++++ UI/MailPartViewers/UIxMailRenderingContext.m | 17 ++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1907ca606..2cd1afe47 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2012-07-20 Ludovic Marcotte + + * UI/MailPartViewers/UIxMailRenderingContext.m + (_shouldDisplayAsAttachment:): refactored to consider + the "bodyId" parameter only for non text/* parts. + 2012-07-20 Francis Lachapelle * UI/MailPartViewers/UIxMailPartHTMLViewer.m diff --git a/UI/MailPartViewers/UIxMailRenderingContext.m b/UI/MailPartViewers/UIxMailRenderingContext.m index 82113cac3..9b128f8a5 100644 --- a/UI/MailPartViewers/UIxMailRenderingContext.m +++ b/UI/MailPartViewers/UIxMailRenderingContext.m @@ -32,22 +32,25 @@ @interface UIxMailRenderingContext (Private) -- (BOOL) _shouldDisplayAsAttachment: (NSDictionary *) info; - +- (BOOL) _shouldDisplayAsAttachment: (NSDictionary *) info + textPart: (BOOL) textPart; @end @implementation UIxMailRenderingContext (Private) - (BOOL) _shouldDisplayAsAttachment: (NSDictionary *) info + textPart: (BOOL) textPart { NSString *s; BOOL shouldDisplay; s = [[info objectForKey:@"disposition"] objectForKey: @"type"]; - shouldDisplay = ((s && ([s caseInsensitiveCompare: @"ATTACHMENT"] - == NSOrderedSame)) - || [[info objectForKey: @"bodyId"] length]); + shouldDisplay = (s && ([s caseInsensitiveCompare: @"ATTACHMENT"] + == NSOrderedSame)); + + if (!shouldDisplay && !textPart) + shouldDisplay = ([[info objectForKey: @"bodyId"] length] ? YES : NO); return shouldDisplay; } @@ -198,7 +201,7 @@ static BOOL showNamedTextAttachmentsInline = NO; else if ([mt isEqualToString:@"text"]) { if ([st isEqualToString:@"plain"] || [st isEqualToString:@"html"]) { - if (!showNamedTextAttachmentsInline && [self _shouldDisplayAsAttachment: _info]) + if (!showNamedTextAttachmentsInline && [self _shouldDisplayAsAttachment: _info textPart:YES]) return [self linkViewer]; return [st isEqualToString:@"html"] @@ -212,7 +215,7 @@ static BOOL showNamedTextAttachmentsInline = NO; // Tiffs aren't well-supported if ([mt isEqualToString:@"image"] && ![st isEqualToString: @"tiff"]) { - if ([self _shouldDisplayAsAttachment: _info]) + if ([self _shouldDisplayAsAttachment: _info textPart: NO]) return [self linkViewer]; return [self imageViewer];