Monotone-Parent: 7673d0874bfab0e145fb002673765af736eb602a
Monotone-Revision: ac841eb2b94bbfe80bea0191f70da349cc60a700 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-12-17T20:24:07 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
c493575541
commit
b3679212bb
29
ChangeLog
29
ChangeLog
|
@ -1,13 +1,32 @@
|
|||
2007-12-17 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* UI/MailPartViewers/UIxMailPartViewer.m ([UIxMailPartViewer
|
||||
-clientPart]): new method that returns the corresponding
|
||||
SOGoMailPart instance.
|
||||
([UIxMailPartViewer -pathToAttachment]): simplified method, ensure
|
||||
the filename is present. If the part has none, create one with the
|
||||
"Untitled-" prefix. Add an extension if none is found.
|
||||
|
||||
* UI/MailPartViewers/UIxMailPartImageViewer.m
|
||||
([UIxMailPartImageViewer -pathToImage]): removed method since it
|
||||
implementents exactly the same functionality as
|
||||
[UIxMailPartViewer -pathToAttachment].
|
||||
|
||||
* SoObjects/Mailer/SOGoMailBodyPart.m ([SOGoMailBodyPart
|
||||
-filename]): new method that returns the filename to the current
|
||||
part by taking the different mime implementations into account.
|
||||
[SOGoMailBodyPart -isBodyPartKey:inContext:]: commented out method
|
||||
because we need to handle the part recognition in a different way,
|
||||
by using the prefix "part" for example. One day we will do that.
|
||||
|
||||
* UI/Scheduler/NSArray+Scheduler.m ([NSMutableArray
|
||||
-reverseArray]): new category method.
|
||||
|
||||
2007-12-17 Francis Lachapelle <flachapelle@inverse.ca>
|
||||
|
||||
* UI/MailerUI/UIxMailMainFrame.m ([UIxMailMainFrame
|
||||
-composeAction]): fixed URL when no recipient is specified.
|
||||
|
||||
2007-12-17 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* UI/Scheduler/NSArray+Scheduler.m ([NSMutableArray
|
||||
-reverseArray]): new category method.
|
||||
|
||||
2007-12-14 Ludovic Marcotte <ludovic@inverse.ca>
|
||||
|
||||
* SoObjects/Appointments/SOGoCalendarComponent.m
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<#IsSubject>Rendez-vous du <#OldAptStartDate /> à <#OldAptStartTime /> modifié</#IsSubject>
|
||||
<#IsBody>
|
||||
La réunion qui devait se dérouler le <#OldAptStartDate /> à <#OldAptStartTime /> est maintenant prévue le <#NewAptStartDate /> à <#NewAptStartTime />.
|
||||
Vous êtes invité à accepter ou refuser de participer à la réunion pour cette nouvelle date à l'adresse <#HomePageURL />.
|
||||
Vous êtes invité à accepter ou refuser de participer à la réunion pour cette nouvelle date à l'adresse <#HomePageURL />.
|
||||
</#IsBody>
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
- (NSString *) bodyPartName;
|
||||
- (NSArray *) bodyPartPath;
|
||||
- (NSString *) bodyPartIdentifier;
|
||||
- (NSString *) filename;
|
||||
|
||||
/* part info */
|
||||
|
||||
|
|
|
@ -73,9 +73,9 @@ static BOOL debugOn = NO;
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
[self->partInfo release];
|
||||
[self->identifier release];
|
||||
[self->pathToPart release];
|
||||
[partInfo release];
|
||||
[identifier release];
|
||||
[pathToPart release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -108,8 +108,8 @@ static BOOL debugOn = NO;
|
|||
NSMutableArray *p;
|
||||
id obj;
|
||||
|
||||
if (self->pathToPart != nil)
|
||||
return [self->pathToPart isNotNull] ? self->pathToPart : nil;
|
||||
if (pathToPart != nil)
|
||||
return [pathToPart isNotNull] ? pathToPart : nil;
|
||||
|
||||
p = [[NSMutableArray alloc] initWithCapacity:8];
|
||||
for (obj = self; [obj isKindOfClass:[SOGoMailBodyPart class]];
|
||||
|
@ -117,18 +117,18 @@ static BOOL debugOn = NO;
|
|||
[p insertObject:[obj bodyPartName] atIndex:0];
|
||||
}
|
||||
|
||||
self->pathToPart = [p copy];
|
||||
pathToPart = [p copy];
|
||||
[p release];
|
||||
return self->pathToPart;
|
||||
return pathToPart;
|
||||
}
|
||||
|
||||
- (NSString *)bodyPartIdentifier {
|
||||
if (self->identifier != nil)
|
||||
return [self->identifier isNotNull] ? self->identifier : nil;
|
||||
if (identifier != nil)
|
||||
return [identifier isNotNull] ? identifier : nil;
|
||||
|
||||
self->identifier =
|
||||
identifier =
|
||||
[[[self bodyPartPath] componentsJoinedByString:@"."] copy];
|
||||
return self->identifier;
|
||||
return identifier;
|
||||
}
|
||||
|
||||
- (NSURL *)imap4URL {
|
||||
|
@ -139,12 +139,12 @@ static BOOL debugOn = NO;
|
|||
/* part info */
|
||||
|
||||
- (id)partInfo {
|
||||
if (self->partInfo != nil)
|
||||
return [self->partInfo isNotNull] ? self->partInfo : nil;
|
||||
if (partInfo != nil)
|
||||
return [partInfo isNotNull] ? partInfo : nil;
|
||||
|
||||
self->partInfo =
|
||||
partInfo =
|
||||
[[[self mailObject] lookupInfoForBodyPart:[self bodyPartPath]] retain];
|
||||
return self->partInfo;
|
||||
return partInfo;
|
||||
}
|
||||
|
||||
/* name lookup */
|
||||
|
@ -160,25 +160,40 @@ static BOOL debugOn = NO;
|
|||
return [clazz objectWithName: _key inContainer: self];
|
||||
}
|
||||
|
||||
- (NSString *) filename
|
||||
{
|
||||
NSString *filename;
|
||||
NSDictionary *parameters;
|
||||
|
||||
[self partInfo];
|
||||
|
||||
filename = [[partInfo objectForKey: @"parameterList"]
|
||||
objectForKey: @"name"];
|
||||
if (!filename)
|
||||
{
|
||||
parameters = [[partInfo objectForKey: @"disposition"]
|
||||
objectForKey: @"parameterList"];
|
||||
filename = [parameters objectForKey: @"filename"];
|
||||
}
|
||||
|
||||
return filename;
|
||||
}
|
||||
|
||||
/* We overwrite the super's class method in order to make sure
|
||||
we aren't dealing with our actual filename as the _key. That
|
||||
could lead to problems if we weren't doing this as our filename
|
||||
could start with a digit, leading to a wrong assumption in
|
||||
the super class
|
||||
*/
|
||||
- (BOOL)isBodyPartKey:(NSString *)_key inContext:(id)_ctx
|
||||
{
|
||||
NSString *s;
|
||||
|
||||
s = [[[self partInfo] objectForKey: @"parameterList"] objectForKey: @"name"];
|
||||
// - (BOOL)isBodyPartKey:(NSString *)_key inContext:(id)_ctx
|
||||
// {
|
||||
// NSString *s;
|
||||
|
||||
if (!s)
|
||||
s = [[[[self partInfo] objectForKey: @"disposition"] objectForKey: @"parameterList"] objectForKey: @"filename"];
|
||||
|
||||
if (s && [s isEqualToString: _key]) return NO;
|
||||
// s = [self filename];
|
||||
// if (s && [s isEqualToString: _key]) return NO;
|
||||
|
||||
return [super isBodyPartKey: _key inContext: _ctx];
|
||||
}
|
||||
// return [super isBodyPartKey: _key inContext: _ctx];
|
||||
// }
|
||||
|
||||
- (id) lookupName: (NSString *) _key
|
||||
inContext: (id) _ctx
|
||||
|
@ -355,16 +370,13 @@ static BOOL debugOn = NO;
|
|||
[r setHeader: [NSString stringWithFormat:@"%d", [data length]]
|
||||
forKey: @"content-length"];
|
||||
|
||||
if (asAttachment) {
|
||||
fileName = [[[self partInfo] objectForKey: @"parameterList"] objectForKey: @"name"];
|
||||
if (!fileName)
|
||||
fileName = [[[[self partInfo] objectForKey: @"disposition"]
|
||||
objectForKey: @"parameterList"]
|
||||
objectForKey: @"filename"];
|
||||
if ([fileName length])
|
||||
[r setHeader: [NSString stringWithFormat: @"attachment; filename=%@", fileName]
|
||||
forKey: @"content-disposition"];
|
||||
}
|
||||
if (asAttachment)
|
||||
{
|
||||
fileName = [self filename];
|
||||
if ([fileName length])
|
||||
[r setHeader: [NSString stringWithFormat: @"attachment; filename=%@", fileName]
|
||||
forKey: @"content-disposition"];
|
||||
}
|
||||
|
||||
if ((etag = [self davEntityTag]) != nil)
|
||||
[r setHeader:etag forKey:@"etag"];
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
02111-1307, USA.
|
||||
*/
|
||||
|
||||
#import <SoObjects/Mailer/SOGoMailBodyPart.h>
|
||||
|
||||
#import "UIxMailPartViewer.h"
|
||||
|
||||
@interface UIxMailPartImageViewer : UIxMailPartViewer
|
||||
|
@ -29,26 +31,4 @@
|
|||
|
||||
@implementation UIxMailPartImageViewer
|
||||
|
||||
/* URLs */
|
||||
|
||||
- (NSString *) pathToImage
|
||||
{
|
||||
NSMutableString *url;
|
||||
NSString *s;
|
||||
|
||||
s = [[self clientObject] baseURLInContext: [self context]];
|
||||
url = [NSMutableString stringWithString: s];
|
||||
if (![url hasSuffix: @"/"])
|
||||
[url appendString: @"/"];
|
||||
|
||||
s = [[self partPath] componentsJoinedByString:@"/"];
|
||||
[url appendString: s];
|
||||
|
||||
s = [self preferredPathExtension];
|
||||
if (s)
|
||||
[url appendFormat: @".%@", s];
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
@end /* UIxMailPartImageViewer */
|
||||
|
|
|
@ -41,7 +41,11 @@
|
|||
content.
|
||||
*/
|
||||
|
||||
@class NSData, NSArray, NSFormatter;
|
||||
@class NSArray;
|
||||
@class NSData;
|
||||
@class NSFormatter;
|
||||
|
||||
@class SOGoMailBodyPart;
|
||||
|
||||
@interface UIxMailPartViewer : UIxComponent
|
||||
{
|
||||
|
@ -58,6 +62,8 @@
|
|||
- (void)setBodyInfo:(id)_info;
|
||||
- (id)bodyInfo;
|
||||
|
||||
- (SOGoMailBodyPart *) clientPart;
|
||||
|
||||
- (NSData *)flatContent;
|
||||
- (NSData *)decodedFlatContent;
|
||||
- (NSString *)flatContentAsString;
|
||||
|
|
|
@ -134,29 +134,25 @@
|
|||
return [self flatContent];
|
||||
}
|
||||
|
||||
- (NSData *) content
|
||||
- (SOGoMailBodyPart *) clientPart
|
||||
{
|
||||
NSData *content;
|
||||
NSEnumerator *parts;
|
||||
id currentObject;
|
||||
NSString *currentPart;
|
||||
|
||||
content = nil;
|
||||
NSEnumerator *parts;
|
||||
|
||||
currentObject = [self clientObject];
|
||||
parts = [partPath objectEnumerator];
|
||||
currentPart = [parts nextObject];
|
||||
while (currentPart)
|
||||
{
|
||||
currentObject = [currentObject lookupName: currentPart
|
||||
inContext: context
|
||||
acquire: NO];
|
||||
currentPart = [parts nextObject];
|
||||
}
|
||||
while ((currentPart = [parts nextObject]))
|
||||
currentObject = [currentObject lookupName: currentPart
|
||||
inContext: context
|
||||
acquire: NO];
|
||||
|
||||
content = [currentObject fetchBLOB];
|
||||
return currentObject;
|
||||
}
|
||||
|
||||
return content;
|
||||
- (NSData *) content
|
||||
{
|
||||
return [[self clientPart] fetchBLOB];
|
||||
}
|
||||
|
||||
- (NSString *) flatContentAsString
|
||||
|
@ -323,32 +319,41 @@
|
|||
return url;
|
||||
}
|
||||
|
||||
- (NSString *) _filenameForAttachment: (SOGoMailBodyPart *) bodyPart
|
||||
{
|
||||
NSMutableString *filename;
|
||||
NSString *extension;
|
||||
|
||||
filename = [NSMutableString stringWithString: [bodyPart filename]];
|
||||
if (![filename length])
|
||||
[filename appendFormat: @"%@-%@",
|
||||
[self labelForKey: @"Untitled"],
|
||||
[bodyPart nameInContainer]];
|
||||
|
||||
if (![[filename pathExtension] length])
|
||||
{
|
||||
extension = [self preferredPathExtension];
|
||||
if (extension)
|
||||
[filename appendFormat: @".%@", extension];
|
||||
}
|
||||
|
||||
return [filename stringByEscapingURL];
|
||||
}
|
||||
|
||||
- (NSString *) pathToAttachment
|
||||
{
|
||||
/* this generates a more beautiful 'download' URL for a part */
|
||||
NSString *fn;
|
||||
NSMutableString *url;
|
||||
NSString *s;
|
||||
SOGoMailBodyPart *bodyPart;
|
||||
|
||||
fn = [self filename];
|
||||
if ([fn length] > 0)
|
||||
{
|
||||
/* get basic URL */
|
||||
url = [NSMutableString stringWithString: [self pathToAttachmentObject]];
|
||||
|
||||
/*
|
||||
If we have an attachment name, we attach it, this is properly handled by
|
||||
SOGoMailBodyPart.
|
||||
*/
|
||||
|
||||
if (![url hasSuffix: @"/"])
|
||||
[url appendString: @"/"];
|
||||
if (isdigit([url characterAtIndex: 0]))
|
||||
[url appendString: @"fn-"];
|
||||
[url appendString: [fn stringByEscapingURL]];
|
||||
// TODO: should we check for a proper extension?
|
||||
}
|
||||
else
|
||||
url = nil;
|
||||
bodyPart = [self clientPart];
|
||||
s = [bodyPart baseURLInContext: [self context]];
|
||||
url = [NSMutableString stringWithString: s];
|
||||
if (![url hasSuffix: @"/"])
|
||||
[url appendString: @"/"];
|
||||
|
||||
// s = [[self partPath] componentsJoinedByString: @"/"];
|
||||
[url appendString: [self _filenameForAttachment: bodyPart]];
|
||||
|
||||
return url;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:var="http://www.skyrix.com/od/binding"
|
||||
|
||||
var:src="pathToImage"
|
||||
var:src="pathToAttachment"
|
||||
var:title="filenameForDisplay"
|
||||
class="mailer_imagecontent"
|
||||
></img>
|
||||
|
|
Loading…
Reference in New Issue