feat(mail): Add SOGoMailHideInlineAttachments option to hide attachments when inline. Fixes #5490.

This commit is contained in:
smizrahi
2023-11-01 18:25:01 +01:00
parent 277b73c663
commit abce5f42cf
7 changed files with 49 additions and 8 deletions

View File

@@ -2481,6 +2481,10 @@ Defaults to `NO` when unset.
Defaults to `inline` when unset.
|U |SOGoMailHideInlineAttachments
|Hide inline message as attachements if set to `YES`. Default value is `NO`.
|U |SOGoMailCustomFullName
|The string to use as full name when composing an email, if
_SOGoMailCustomFromEnabled_ is set in the user's domain defaults.

View File

@@ -228,8 +228,11 @@ extern NSString *SOGoPasswordRecoverySecondaryEmail;
- (void) setMailLabelsColors: (NSDictionary *) newValues;
- (NSDictionary *) mailLabelsColors;
- (void)setHideInlineAttachments:(BOOL)newValue;
- (BOOL)hideInlineAttachments;
/* calendar */
- (void) setCalendarCategories: (NSArray *) newValues;
- (void)setCalendarCategories : (NSArray *)newValues;
- (NSArray *) calendarCategories;
- (void) setCalendarCategoriesColors: (NSDictionary *) newValues;

View File

@@ -959,6 +959,16 @@ NSString *SOGoPasswordRecoverySecondaryEmail = @"SecondaryEmail";
return [self objectForKey: @"SOGoMailLabelsColors"];
}
- (void) setHideInlineAttachments: (BOOL) newValue
{
[self setBool: newValue forKey: @"SOGoMailHideInlineAttachments"];
}
- (BOOL) hideInlineAttachments
{
return [self boolForKey: @"SOGoMailHideInlineAttachments"];
}
- (void) setSieveFilters: (NSArray *) newValue
{
[self setObject: newValue forKey: @"SOGoSieveFilters"];

View File

@@ -27,6 +27,8 @@
#import <NGMime/NGMimeBodyPart.h>
#import <NGMime/NGMimeMultipartBody.h>
#import <SOGo/SOGoUserDefaults.h>
#import <UI/MailerUI/WOContext+UIxMailer.h>
#import "UIxMailRenderingContext.h"
@@ -98,6 +100,7 @@
NSString *contentType;
id viewer, info;
NSArray *parts;
SOGoUserDefaults *ud;
NSUInteger i, max;
@@ -119,14 +122,23 @@
[self setChildInfo: [parts objectAtIndex: i]];
info = [self childInfo];
viewer = [[[self context] mailRenderingContext] viewerForBodyInfo: info];
[viewer setBodyInfo: info];
[viewer setPartPath: [self childPartPath]];
if ([self decodedFlatContent])
[viewer setDecodedContent: [parts objectAtIndex: i]];
[viewer setAttachmentIds: attachmentIds];
ud = [[[self context] activeUser] userDefaults];
[renderedParts addObject: [viewer renderedPart]];
if (!([info objectForKey:@"disposition"]
&& [[info objectForKey:@"disposition"] objectForKey:@"type"]
&& [[[info objectForKey:@"disposition"] objectForKey:@"type"] isEqualToString:@"INLINE"]
&& [ud hideInlineAttachments])) {
viewer = [[[self context] mailRenderingContext] viewerForBodyInfo: info];
[viewer setBodyInfo: info];
[viewer setPartPath: [self childPartPath]];
if ([self decodedFlatContent])
[viewer setDecodedContent: [parts objectAtIndex: i]];
[viewer setAttachmentIds: attachmentIds];
[renderedParts addObject: [viewer renderedPart]];
}
}
contentType = [NSString stringWithFormat: @"%@/%@",

View File

@@ -204,6 +204,7 @@
"Insert signature on new message" = "Insert signature on new message";
"Insert signature on reply" = "Insert signature on reply";
"Insert signature on forward" = "Insert signature on forward";
"Hide inline attachments" = "Hide inline attachments";
/* Base font size for messages composed in HTML */
"Default font size" = "Default font size";

View File

@@ -204,6 +204,7 @@
"Insert signature on new message" = "Insérer la signature sur un nouveau message";
"Insert signature on reply" = "Insérer la signature sur une réponse";
"Insert signature on forward" = "Insérer la signature sur un transfert";
"Hide inline attachments" = "Cacher les pièces jointes 'inline'";
/* Base font size for messages composed in HTML */
"Default font size" = "Taille de la police par défaut";

View File

@@ -695,6 +695,16 @@
</md-checkbox>
</div>
<div>
<md-checkbox
ng-model="app.preferences.defaults.SOGoMailHideInlineAttachments"
ng-true-value="1"
ng-false-value="0"
label:aria-label="Hide inline attachments">
<var:string label:value="Hide inline attachments"/>
</md-checkbox>
</div>
<div>
<md-checkbox
ng-model="app.preferences.defaults.SOGoMailAutoMarkAsReadEnabled"