feat(mail): Add an option in Preferences to display full email instead of name alone in mailboxes

This commit is contained in:
Hivert Quentin
2023-11-23 14:09:57 +01:00
parent 8babb23c58
commit 2e670f7e62
10 changed files with 47 additions and 7 deletions
@@ -2490,6 +2490,9 @@ Defaults to `NO` when unset.
Defaults to `inline` when unset.
|U |SOGoMailDisplayFullEmail
|Show recipients or sender full email in mailboxes if set to `YES`. Default value is `NO`.
|U |SOGoMailHideInlineAttachments
|Hide inline message as attachements if set to `YES`. Default value is `NO`.
+1
View File
@@ -124,6 +124,7 @@
SOGoMailComposeMessageType = "html";
SOGoMailComposeFontSize = "0";
SOGoMailHideInlineAttachments = NO;
SOGoMailDisplayFullEmail = NO;
SOGoMailDisplayRemoteInlineImages = "never";
SOGoMailCertificateEnabled = YES;
+3
View File
@@ -156,6 +156,9 @@ extern NSString *SOGoPasswordRecoverySecondaryEmail;
- (void) setMailComposeFontSize: (int) newValue;
- (int) mailComposeFontSize;
- (void) setMailDisplayFullEmail: (BOOL *) newValue;
- (BOOL *) mailDisplayFullEmail;
- (void) setMailDisplayRemoteInlineImages: (NSString *) newValue;
- (NSString *) mailDisplayRemoteInlineImages;
+10
View File
@@ -631,6 +631,16 @@ NSString *SOGoPasswordRecoverySecondaryEmail = @"SecondaryEmail";
return [self integerForKey: @"SOGoMailComposeFontSize"];
}
- (void) setMailDisplayFullEmail: (BOOL *) newValue
{
[self setBool: newValue forKey: @"SOGoMailDisplayFullEmail"];
}
- (BOOL *) mailDisplayFullEmail;
{
return [self boolForKey: @"SOGoMailDisplayFullEmail"];
}
- (void) setMailDisplayRemoteInlineImages: (NSString *) newValue
{
[self setObject: newValue forKey: @"SOGoMailDisplayRemoteInlineImages"];
@@ -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";
"Show recipients or sender full email in mailboxes" = "Show recipients or sender full email in mailboxes";
"Hide inline attachments" = "Hide inline attachments";
/* Base font size for messages composed in HTML */
@@ -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";
"Show recipients or sender full email in mailboxes" = "Afficher l'email complet du destinataire ou expéditeur dans les boîtes aux lettres";
"Hide inline attachments" = "Cacher les pièces jointes 'inline'";
/* Base font size for messages composed in HTML */
+3
View File
@@ -356,6 +356,9 @@ static SoProduct *preferencesProduct = nil;
[[defaults source] setObject: [NSNumber numberWithBool: [defaults mailAddOutgoingAddresses]] forKey: @"SOGoMailAddOutgoingAddresses"];
if (![[defaults source] objectForKey: @"SOGoMailDisplayFullEmail"])
[[defaults source] setObject: [NSNumber numberWithBool: [defaults mailDisplayFullEmail]] forKey: @"SOGoMailDisplayFullEmail"];
if (![[defaults source] objectForKey: @"SOGoMailComposeMessageType"])
[[defaults source] setObject: [defaults mailComposeMessageType] forKey: @"SOGoMailComposeMessageType"];
@@ -695,6 +695,16 @@
</md-checkbox>
</div>
<div>
<md-checkbox
ng-model="app.preferences.defaults.SOGoMailDisplayFullEmail"
ng-true-value="1"
ng-false-value="0"
label:aria-label="Show recipients or sender full email in mailboxes">
<var:string label:value="Show recipients or sender full email in mailboxes"/>
</md-checkbox>
</div>
<div>
<md-checkbox
ng-model="app.preferences.defaults.SOGoMailHideInlineAttachments"
@@ -273,7 +273,7 @@
* @desc Format the first address of a specific type with a short description.
* @returns a string of the name or the email of the envelope address type
*/
Message.prototype.$shortAddress = function (type) {
Message.prototype.$shortAddress = function (type, fullEmail) {
var address = '';
if (this[type]) {
if (angular.isString(this[type])) {
@@ -289,7 +289,16 @@
}
else if (this[type].length > 0) {
// We have an array of objects; pick the first one
address = this[type][0].name || this[type][0].email || '';
if(!fullEmail)
address = this[type][0].name || this[type][0].email || '';
else if(this[type][0].name && this[type][0].email)
address = this[type][0].name + ' <' + this[type][0].email +'>';
else if(this[type][0].name)
address = this[type][0].name;
else if(this[type][0].email)
address = this[type][0].email;
else
address = '';
}
}
@@ -58,8 +58,8 @@
/**
* @ngInject
*/
sgMessageListItemMainController.$inject = ['$scope', '$element', '$parse', '$state', '$mdUtil', '$mdToast', 'Mailbox', 'Message', 'encodeUriFilter'];
function sgMessageListItemMainController($scope, $element, $parse, $state, $mdUtil, $mdToast, Mailbox, Message, encodeUriFilter) {
sgMessageListItemMainController.$inject = ['$scope', '$element', '$parse', '$state', '$mdUtil', '$mdToast', 'Mailbox', 'Message', 'encodeUriFilter', 'Preferences'];
function sgMessageListItemMainController($scope, $element, $parse, $state, $mdUtil, $mdToast, Mailbox, Message, encodeUriFilter, Preferences) {
var $ctrl = this;
this.$postLink = function () {
@@ -83,7 +83,6 @@
threadButton = angular.element(threadButton);
this.threadIconElement = threadButton.find('md-icon')[0];
this.threadCountElement = threadButton.find('span')[0];
this.priorityIconElement = contentDivElement.find('md-icon')[0];
if (Mailbox.$virtualMode) {
@@ -144,9 +143,9 @@
// Sender or recipient when in Sent or Draft mailbox
if ($ctrl.MailboxService.selectedFolder.isSentFolder || $ctrl.MailboxService.selectedFolder.isDraftsFolder)
$ctrl.senderElement.innerHTML = $ctrl.message.$shortAddress('to').encodeEntities();
$ctrl.senderElement.innerHTML = $ctrl.message.$shortAddress('to', Preferences.defaults.SOGoMailDisplayFullEmail).encodeEntities();
else
$ctrl.senderElement.innerHTML = $ctrl.message.$shortAddress('from').encodeEntities();
$ctrl.senderElement.innerHTML = $ctrl.message.$shortAddress('from', Preferences.defaults.SOGoMailDisplayFullEmail).encodeEntities();
// Priority icon
if ($ctrl.message.priority && $ctrl.message.priority.level < 3) {