Fixed bug #1105 Remote images display

There now is a configurable default in mail preferences where
you can set remote images to display either Never or Always.
This commit is contained in:
Luc Charland
2012-10-26 13:39:28 -04:00
parent 21ee23e7df
commit a916ac8927
7 changed files with 55 additions and 4 deletions
+3
View File
@@ -118,6 +118,9 @@ extern NSString *SOGoWeekStartFirstFullWeek;
- (void) setMailComposeMessageType: (NSString *) newValue;
- (NSString *) mailComposeMessageType;
- (void) setMailDisplayRemoteInlineImages: (NSString *) newValue;
- (NSString *) mailDisplayRemoteInlineImages;
- (void) setMailMessageForwarding: (NSString *) newValue;
- (NSString *) mailMessageForwarding;
+10
View File
@@ -493,6 +493,16 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
return [self stringForKey: @"SOGoMailComposeMessageType"];
}
- (void) setMailDisplayRemoteInlineImages: (NSString *) newValue;
{
[self setObject: newValue forKey: @"SOGoMailDisplayRemoteInlineImages"];
}
- (NSString *) mailDisplayRemoteInlineImages;
{
return [self stringForKey: @"SOGoMailDisplayRemoteInlineImages"];
}
- (void) setMailMessageForwarding: (NSString *) newValue
{
[self setObject: newValue forKey: @"SOGoMailMessageForwarding"];
@@ -149,6 +149,8 @@
"Compose messages in" = "Compose messages in";
"composemessagestype_html" = "HTML";
"composemessagestype_text" = "Plain text";
"displayremoteinlineimages_never" = "Never";
"displayremoteinlineimages_always" = "Always";
/* IMAP Accounts */
"New Mail Account" = "New Mail Account";
+22
View File
@@ -759,6 +759,28 @@
[userDefaults setMailComposeMessageType: newType];
}
/* Display remote inline images */
- (NSArray *) displayRemoteInlineImages
{
return [NSArray arrayWithObjects: @"never", @"always", nil];
}
- (NSString *) itemDisplayRemoteInlineImagesText
{
return [self labelForKey: [NSString stringWithFormat:
@"displayremoteinlineimages_%@", item]];
}
- (NSString *) userDisplayRemoteInlineImages
{
return [userDefaults mailDisplayRemoteInlineImages];
}
- (void) setUserDisplayRemoteInlineImages: (NSString *) newType
{
[userDefaults setMailDisplayRemoteInlineImages: newType];
}
/* mail autoreply (vacation) */
- (BOOL) isSieveScriptsEnabled
+1 -1
View File
@@ -7,7 +7,7 @@
xmlns:label="OGo:label"
className="UIxPageFrame"
title="title"
const:userDefaultsKeys="SOGoMailMessageCheck,SOGoMailSortByThreads,SOGoMailListViewColumnsOrder"
const:userDefaultsKeys="SOGoMailMessageCheck,SOGoMailSortByThreads,SOGoMailListViewColumnsOrder,SOGoMailDisplayRemoteInlineImages"
const:userSettingsKeys="Mail"
const:jsFiles="dtree.js,MailerUIdTree.js,SOGoAutoCompletion.js,SOGoResizableTable.js,SOGoMailDataSource.js,SOGoDataTable.js,jquery-ui.js">
<script type="text/javascript">
@@ -241,6 +241,12 @@
const:name="composeMessagesType"
string="itemComposeMessagesText"
selection="userComposeMessagesType"/></dd>
<dt><var:string label:value="Display remote inline images"/></dt>
<dd><var:popup list="displayRemoteInlineImages" item="item"
const:id="displayRemoteInlineImages"
const:name="displayRemoteInlineImages"
string="itemDisplayRemoteInlineImagesText"
selection="userDisplayRemoteInlineImages"/></dd>
</dl>
<var:if condition="isSieveScriptsEnabled"
><label><var:string label:value="Filters"/></label>
+11 -3
View File
@@ -1240,9 +1240,13 @@ function loadMessage(msguid) {
}
}
configureLoadImagesButton();
configureSignatureFlagImage();
if (UserDefaults["SOGoMailDisplayRemoteInlineImages"] == 'always')
loadRemoteImages();
return seenStateHasChanged;
}
@@ -1563,6 +1567,11 @@ function onMessageEditDraft(event) {
}
function onMessageLoadImages(event) {
loadRemoteImages();
Event.stop(event);
}
function loadRemoteImages() {
var content = $("messageContent");
$(content.hiddenImgs).each(function(img) {
var unSafeSrc = img.getAttribute("unsafe-src");
@@ -1582,11 +1591,8 @@ function onMessageLoadImages(event) {
});
content.hiddenObjects = null;
var loadImagesButton = $("loadImagesButton");
loadImagesButton.setStyle({ display: 'none' });
Event.stop(event);
}
function onEmailAddressClick(event) {
@@ -1656,6 +1662,8 @@ function loadMessageCallback(http) {
configureLinksInMessage();
resizeMailContent();
configureLoadImagesButton();
if (UserDefaults["SOGoMailDisplayRemoteInlineImages"] == 'always')
loadRemoteImages();
configureSignatureFlagImage();
handleReturnReceipt();
// Warning: If the user can't set the read/unread flag, it won't