From 97de47a33072addcdeb1465b43396966452bc809 Mon Sep 17 00:00:00 2001 From: helge Date: Mon, 18 Jul 2005 12:42:59 +0000 Subject: [PATCH] show text/plain and text/html attachments as inline git-svn-id: http://svn.opengroupware.org/SOGo/trunk@788 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/UI/MailPartViewers/ChangeLog | 6 +++++ .../MailPartViewers/UIxMailRenderingContext.m | 24 +++++++++++++++---- SOGo/UI/MailPartViewers/Version | 2 +- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/SOGo/UI/MailPartViewers/ChangeLog b/SOGo/UI/MailPartViewers/ChangeLog index 8dd8b803..d3fd2683 100644 --- a/SOGo/UI/MailPartViewers/ChangeLog +++ b/SOGo/UI/MailPartViewers/ChangeLog @@ -1,3 +1,9 @@ +2005-07-18 Helge Hess + + * UIxMailRenderingContext.m: show text/plain and text/html attachments + which have "filename" set in the content-disposition using the link + viewer (#1468) (v0.9.16) + 2005-07-18 Helge Hess * UIxMailRenderingContext.m: map multipart/report mimetype to use the diff --git a/SOGo/UI/MailPartViewers/UIxMailRenderingContext.m b/SOGo/UI/MailPartViewers/UIxMailRenderingContext.m index b4cc2ba0..9b96d296 100644 --- a/SOGo/UI/MailPartViewers/UIxMailRenderingContext.m +++ b/SOGo/UI/MailPartViewers/UIxMailRenderingContext.m @@ -25,6 +25,8 @@ @implementation UIxMailRenderingContext +static BOOL showNamedTextAttachmentsInline = NO; + - (id)initWithViewer:(WOComponent *)_viewer context:(WOContext *)_ctx { if ((self = [super init])) { self->viewer = _viewer; @@ -162,11 +164,23 @@ return [self mixedViewer]; } else if ([mt isEqualToString:@"text"]) { - if ([st isEqualToString:@"plain"]) - return [self textViewer]; - - if ([st isEqualToString:@"html"]) - return [self htmlViewer]; // TODO: temporary workaround + /* + Note: in the _info dictionary we do not get the content-disposition + information (inline vs attachment). Our hack is to check for the + 'name' parameter. + */ + if ([st isEqualToString:@"plain"] || [st isEqualToString:@"html"]) { + if (!showNamedTextAttachmentsInline) { + NSString *n; + + n = [[_info objectForKey:@"parameterList"] objectForKey:@"name"]; + if ([n isNotNull] && [n length] > 0) + return [self linkViewer]; + } + + return [st isEqualToString:@"html"] + ? [self htmlViewer] : [self textViewer]; + } if ([st isEqualToString:@"calendar"]) return [self iCalViewer]; diff --git a/SOGo/UI/MailPartViewers/Version b/SOGo/UI/MailPartViewers/Version index eaf1bd34..4c9aeea9 100644 --- a/SOGo/UI/MailPartViewers/Version +++ b/SOGo/UI/MailPartViewers/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=15 +SUBMINOR_VERSION:=16 # v0.9.0 requires libNGiCal v4.5.53 # v0.9.1 requires libNGMime v4.5.213 -- 2.39.5