From: helge Date: Thu, 27 Jan 2005 12:40:13 +0000 (+0000) Subject: started work on attachment viewer (#1074) X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27bb1f267b457a9b52f4cde62a8cb0cf8dbb34e4;p=scalable-opengroupware.org started work on attachment viewer (#1074) git-svn-id: http://svn.opengroupware.org/SOGo/trunk@502 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/UI/Mailer/ChangeLog b/SOGo/UI/Mailer/ChangeLog index e06572d1..4f979b4c 100644 --- a/SOGo/UI/Mailer/ChangeLog +++ b/SOGo/UI/Mailer/ChangeLog @@ -1,3 +1,7 @@ +2005-01-27 Helge Hess + + * started attachment (download) viewer (#1074) (v0.9.76) + 2005-01-26 Helge Hess * v0.9.75 diff --git a/SOGo/UI/Mailer/GNUmakefile b/SOGo/UI/Mailer/GNUmakefile index bf97210d..39658678 100644 --- a/SOGo/UI/Mailer/GNUmakefile +++ b/SOGo/UI/Mailer/GNUmakefile @@ -39,6 +39,7 @@ MailerUI_OBJC_FILES += \ UIxMailPartViewer.m \ UIxMailPartTextViewer.m \ UIxMailPartImageViewer.m \ + UIxMailPartLinkViewer.m \ UIxMailPartMixedViewer.m \ UIxMailPartAlternativeViewer.m \ \ @@ -70,6 +71,7 @@ MailerUI_RESOURCE_FILES += \ UIxMailPartTextViewer.wox \ UIxMailPartMixedViewer.wox \ UIxMailPartImageViewer.wox \ + UIxMailPartLinkViewer.wox \ UIxMailPartAlternativeViewer.wox\ \ UIxFilterList.wox \ diff --git a/SOGo/UI/Mailer/UIxMailPartLinkViewer.m b/SOGo/UI/Mailer/UIxMailPartLinkViewer.m new file mode 100644 index 00000000..6b27fb39 --- /dev/null +++ b/SOGo/UI/Mailer/UIxMailPartLinkViewer.m @@ -0,0 +1,70 @@ +/* + Copyright (C) 2004-2005 SKYRIX Software AG + + This file is part of OpenGroupware.org. + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ + +#include "UIxMailPartViewer.h" + +/* + UIxMailPartLinkViewer + + The generic viewer for all kinds of attachments. Renders a link to download + the attachment. + + TODO: show info based on the 'bodyInfo' dictionary: + { + bodyId = ""; + description = ""; + encoding = BASE64; + parameterList = { + "x-unix-mode" = 0666; + name = "IncoWEBOpenGroupwarepresentation.pdf"; + }; + size = 1314916; + subtype = PDF; type = application; + } +*/ + +@interface UIxMailPartLinkViewer : UIxMailPartViewer +{ +} + +@end + +#include "common.h" + +@implementation UIxMailPartLinkViewer + +- (void)dealloc { + [super dealloc]; +} + +/* URLs */ + +- (NSString *)pathToAttachment { + NSString *url, *n; + + url = [[self clientObject] baseURLInContext:[self context]]; + if (![url hasSuffix:@"/"]) url = [url stringByAppendingString:@"/"]; + + n = [[self partPath] componentsJoinedByString:@"/"]; + return [url stringByAppendingString:n]; +} + +@end /* UIxMailPartLinkViewer */ diff --git a/SOGo/UI/Mailer/UIxMailPartLinkViewer.wox b/SOGo/UI/Mailer/UIxMailPartLinkViewer.wox new file mode 100644 index 00000000..a516ec71 --- /dev/null +++ b/SOGo/UI/Mailer/UIxMailPartLinkViewer.wox @@ -0,0 +1,9 @@ + +
+ [abc ] +
diff --git a/SOGo/UI/Mailer/UIxMailRenderingContext.h b/SOGo/UI/Mailer/UIxMailRenderingContext.h index 672a5eb0..e58aeec7 100644 --- a/SOGo/UI/Mailer/UIxMailRenderingContext.h +++ b/SOGo/UI/Mailer/UIxMailRenderingContext.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 SKYRIX Software AG + Copyright (C) 2004-2005 SKYRIX Software AG This file is part of OpenGroupware.org. @@ -43,6 +43,7 @@ WOComponent *mixedViewer; WOComponent *textViewer; WOComponent *imageViewer; + WOComponent *linkViewer; } - (id)initWithViewer:(WOComponent *)_viewer context:(WOContext *)_ctx; diff --git a/SOGo/UI/Mailer/UIxMailRenderingContext.m b/SOGo/UI/Mailer/UIxMailRenderingContext.m index 0346c09b..3885512a 100644 --- a/SOGo/UI/Mailer/UIxMailRenderingContext.m +++ b/SOGo/UI/Mailer/UIxMailRenderingContext.m @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 SKYRIX Software AG + Copyright (C) 2004-2005 SKYRIX Software AG This file is part of OpenGroupware.org. @@ -44,6 +44,7 @@ [self->mixedViewer release]; [self->textViewer release]; [self->imageViewer release]; + [self->linkViewer release]; [super dealloc]; } @@ -55,6 +56,7 @@ [self->mixedViewer release]; self->mixedViewer = nil; [self->textViewer release]; self->textViewer = nil; [self->imageViewer release]; self->imageViewer = nil; + [self->linkViewer release]; self->linkViewer = nil; } /* fetching */ @@ -109,6 +111,14 @@ return self->imageViewer; } +- (WOComponent *)linkViewer { + if (self->linkViewer == nil) { + self->linkViewer = + [[self->viewer pageWithName:@"UIxMailPartLinkViewer"] retain]; + } + return self->linkViewer; +} + - (WOComponent *)viewerForBodyInfo:(id)_info { NSString *mt, *st; @@ -139,8 +149,10 @@ } // TODO: always fallback to octet viewer?! +#if 0 [self errorWithFormat:@"found no viewer for MIME type: %@/%@", mt, st]; - return nil; +#endif + return [self linkViewer]; } /* debugging */ diff --git a/SOGo/UI/Mailer/Version b/SOGo/UI/Mailer/Version index fa87263e..b4ba3132 100644 --- a/SOGo/UI/Mailer/Version +++ b/SOGo/UI/Mailer/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=75 +SUBMINOR_VERSION:=76 # v0.9.74 requires SoObjects/Mailer v0.9.56 # v0.9.70 requires NGExtensions v4.5.136