diff --git a/ChangeLog b/ChangeLog index c51b99e2d..329fedd75 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2012-03-20 Francis Lachapelle + + * SoObjects/Mailer/SOGoMailObject+Draft.m + (_contentForEditingFromKeys:): prefer the HTML part over the text + part when composing HTML messages. + 2012-03-19 Wolfgang Sourdeau * Main/SOGo+DAV.m (_fillCollections:where:matches:inContext:): diff --git a/SoObjects/Mailer/SOGoMailObject+Draft.m b/SoObjects/Mailer/SOGoMailObject+Draft.m index e27cac368..b0aec21ed 100644 --- a/SoObjects/Mailer/SOGoMailObject+Draft.m +++ b/SoObjects/Mailer/SOGoMailObject+Draft.m @@ -98,22 +98,38 @@ NSArray *types; NSDictionary *parts; NSString *rawPart, *content, *contentKey; + SOGoUserDefaults *ud; int index; - BOOL htmlContent; + BOOL htmlComposition, htmlContent; content = @""; if ([keys count]) { + ud = [[context activeUser] userDefaults]; + htmlComposition = [[ud mailComposeMessageType] isEqualToString: @"html"]; + htmlContent = NO; types = [keys objectsForKey: @"mimeType" notFoundMarker: @""]; - index = [types indexOfObject: @"text/plain"]; - if (index == NSNotFound) + + if (htmlComposition) { + // Prefer HTML content index = [types indexOfObject: @"text/html"]; - htmlContent = YES; + if (index == NSNotFound) + index = [types indexOfObject: @"text/plain"]; + else + htmlContent = YES; } else - htmlContent = NO; + { + // Prefer text content + index = [types indexOfObject: @"text/plain"]; + if (index == NSNotFound) + { + index = [types indexOfObject: @"text/html"]; + htmlContent = YES; + } + } if (index != NSNotFound) {