Monotone-Parent: 50626dad4bfc5d3baa2556f6d16ca3eb3cc21bb6

Monotone-Revision: f6dd6e26aadfa52716bf3ca2c504de3593e5f35b

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-11-23T13:53:54
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2010-11-23 13:53:54 +00:00
parent d89a194aa9
commit e4956f5d1f
5 changed files with 57 additions and 16 deletions

View File

@ -1,3 +1,19 @@
2010-11-23 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/Mailer/SOGoDraftObject.m (-setIsHTML, -isHTML): new
accessors, which enables the setting of html mode from the caller
rather than from the user defaults.
(-mimeMessageForContentWithHeaderMap:, -bodyPartForText): make use
of "isHTML".
* UI/MailerUI/UIxMailEditor.m (-setIsHTML, -isHTML): new
accessors. The former sets the "isHTML" ivar based on a previous
request on the latter, which actually returns the value stored in
the user defaults. This enables the user to change composition
type while editing a message without altering the proper logic
underneat.
(-_saveFormInfo): forward the value of "isHTML" to the co.
2010-11-22 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* OpenChange/MAPIStoreContext.m

View File

@ -57,6 +57,7 @@
NSString *sourceURL;
NSString *sourceFlag;
NSString *sourceFolder;
BOOL isHTML;
}
/* contents */
@ -72,6 +73,8 @@
- (NSDictionary *) headers;
- (void) setText: (NSString *) newText;
- (NSString *) text;
- (void) setIsHTML: (BOOL) aBool;
- (BOOL) isHTML;
/* for replies and forwards */
- (void) setSourceURL: (NSString *) newSurceURL;

View File

@ -112,6 +112,7 @@ static NSString *userAgent = nil;
sourceURL = nil;
sourceFlag = nil;
inReplyTo = nil;
isHTML = NO;
}
return self;
@ -252,6 +253,16 @@ static NSString *userAgent = nil;
return text;
}
- (void) setIsHTML: (BOOL) aBool
{
isHTML = aBool;
}
- (BOOL) isHTML
{
return isHTML;
}
- (void) setInReplyTo: (NSString *) newInReplyTo
{
ASSIGN (inReplyTo, newInReplyTo);
@ -307,6 +318,8 @@ static NSString *userAgent = nil;
[infos setObject: headers forKey: @"headers"];
if (text)
[infos setObject: text forKey: @"text"];
[infos setObject: [NSNumber numberWithBool: isHTML]
forKey: @"isHTML"];
if (inReplyTo)
[infos setObject: inReplyTo forKey: @"inReplyTo"];
if (IMAP4ID > -1)
@ -351,6 +364,7 @@ static NSString *userAgent = nil;
value = [infoDict objectForKey: @"text"];
if ([value length] > 0)
[self setText: value];
isHTML = [[infoDict objectForKey: @"isHTML"] boolValue];
value = [infoDict objectForKey: @"IMAP4ID"];
if (value)
@ -895,13 +909,8 @@ static NSString *userAgent = nil;
// TODO: set charset in header!
[map setObject: @"text/plain" forKey: @"content-type"];
if (text)
{
if ([[ud mailComposeMessageType] isEqualToString: @"html"])
[map setObject: htmlContentTypeValue
forKey: @"content-type"];
else
[map setObject: contentTypeValue forKey: @"content-type"];
}
[map setObject: (isHTML ? htmlContentTypeValue : contentTypeValue)
forKey: @"content-type"];
// if ((body = text) != nil) {
// if ([body isKindOfClass: [NSString class]]) {
@ -934,12 +943,8 @@ static NSString *userAgent = nil;
{
// if ([body isKindOfClass:[NSString class]])
/* Note: just 'utf8' is displayed wrong in Mail.app */
if ([[ud mailComposeMessageType] isEqualToString: @"html"])
[map setObject: htmlContentTypeValue
forKey: @"content-type"];
else
[map setObject: contentTypeValue
forKey: @"content-type"];
[map setObject: (isHTML ? htmlContentTypeValue : contentTypeValue)
forKey: @"content-type"];
// body = [body dataUsingEncoding:NSUTF8StringEncoding];
// else if ([body isKindOfClass:[NSData class]] && addSuffix) {
// body = [[body mutableCopy] autorelease];
@ -949,13 +954,12 @@ static NSString *userAgent = nil;
// NSStringFromClass([body class])];
// }
message = [[[NGMimeMessage alloc] initWithHeader:map] autorelease];
[message setBody: body];
message = [[[NGMimeMessage alloc] initWithHeader:map] autorelease];
[message setBody: body];
}
else
message = nil;
return message;
}

View File

@ -76,6 +76,7 @@
NSMutableArray *fromEMails;
NSString *from;
SOGoMailFolder *sentFolder;
BOOL isHTML;
NSString *priority;
NSString *receipt;
@ -179,6 +180,21 @@ static NSArray *infoKeys = nil;
return receipt;
}
- (void) setIsHTML: (BOOL) aBool
{
isHTML = aBool;
NSLog (@"setIsHTML: %d", aBool);
}
- (BOOL) isHTML
{
SOGoUserDefaults *ud;
ud = [[context activeUser] userDefaults];
return [[ud mailComposeMessageType] isEqualToString: @"html"];
}
- (NSString *) itemPriorityText
{
return [self labelForKey: [NSString stringWithFormat: @"%@", [item lowercaseString]]];
@ -480,6 +496,7 @@ static NSArray *infoKeys = nil;
info = [self storeInfo];
[co setHeaders: info];
[co setText: text];
[co setIsHTML: isHTML];
error = [co storeInfo];
if (error)
{

View File

@ -52,6 +52,7 @@
<form const:href="" name="pageform" enctype="multipart/form-data" autocomplete="off">
<input type="hidden" name="priority" id="priority" var:value="priority"/>
<input type="hidden" name="receipt" id="receipt" var:value="receipt"/>
<input type="hidden" name="isHTML" id="isHTML" var:value="isHTML"/>
<div id="attachmentsArea">
<var:string label:value="Attachments:" />