mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-05 22:05:40 +00:00
Bug #282429 --> Re-design Message Status Bars (junk bar & remote content bar) to be more flexible,
making it easier to add more notification messages in the future. Includes using a deck element to control the visibility of each statatus message. sr=bienvenu
This commit is contained in:
parent
98939fc29f
commit
42239160e5
@ -486,28 +486,29 @@ function StopUrls()
|
||||
msgWindow.StopUrls();
|
||||
}
|
||||
|
||||
function loadStartPage() {
|
||||
try {
|
||||
// collapse the junk bar
|
||||
SetUpJunkBar(null);
|
||||
SetUpRemoteContentBar(null);
|
||||
|
||||
var startpageenabled = pref.getBoolPref("mailnews.start_page.enabled");
|
||||
|
||||
if (startpageenabled) {
|
||||
var startpage = pref.getComplexValue("mailnews.start_page.url",
|
||||
Components.interfaces.nsIPrefLocalizedString).data;
|
||||
if (startpage != "") {
|
||||
GetMessagePaneFrame().location = startpage;
|
||||
//dump("start message pane with: " + startpage + "\n");
|
||||
ClearMessageSelection();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (ex) {
|
||||
dump("Error loading start page.\n");
|
||||
return;
|
||||
function loadStartPage()
|
||||
{
|
||||
try
|
||||
{
|
||||
gMessageNotificationBar.clearMsgNotifications();
|
||||
|
||||
var startpageenabled = pref.getBoolPref("mailnews.start_page.enabled");
|
||||
if (startpageenabled)
|
||||
{
|
||||
var startpage = pref.getComplexValue("mailnews.start_page.url", Components.interfaces.nsIPrefLocalizedString).data;
|
||||
if (startpage != "")
|
||||
{
|
||||
GetMessagePaneFrame().location = startpage;
|
||||
//dump("start message pane with: " + startpage + "\n");
|
||||
ClearMessageSelection();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (ex)
|
||||
{
|
||||
dump("Error loading start page.\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Display AccountCentral page when users clicks on the Account Folder.
|
||||
|
@ -62,6 +62,10 @@ const kNoRemoteContentPolicy = 0;
|
||||
const kBlockRemoteContent = 1;
|
||||
const kAllowRemoteContent = 2;
|
||||
|
||||
const kMsgNotificationNoStatus = 0;
|
||||
const kMsgNotificationJunkBar = 1;
|
||||
const kMsgNotificationRemoteImages = 2;
|
||||
|
||||
var gMessengerBundle;
|
||||
var gPromptService;
|
||||
var gOfflinePromptsBundle;
|
||||
@ -2134,7 +2138,7 @@ function HandleJunkStatusChanged(folder)
|
||||
// We have no way of determining if the junk status of our current message has really changed
|
||||
// the only thing we can do is cheat by asking if the junkbar visibility had to change as a result of this notification
|
||||
|
||||
var changedJunkStatus = SetUpJunkBar(msgHdr);
|
||||
var changedJunkStatus = gMessageNotificationBar.setJunkMsg(msgHdr);
|
||||
|
||||
// we may be forcing junk mail to be rendered with sanitized html. In that scenario, we want to
|
||||
// reload the message if the status has just changed to not junk.
|
||||
@ -2159,53 +2163,54 @@ function HandleJunkStatusChanged(folder)
|
||||
}
|
||||
}
|
||||
else
|
||||
SetUpJunkBar(null);
|
||||
gMessageNotificationBar.setJunkMsg(null);
|
||||
}
|
||||
}
|
||||
|
||||
// returns true if we actually changed the visiblity of the junk bar otherwise false
|
||||
function SetUpJunkBar(aMsgHdr)
|
||||
var gMessageNotificationBar =
|
||||
{
|
||||
// XXX todo
|
||||
// should this happen on the start, or at the end?
|
||||
// if at the end, we might keep the "this message is junk" up for a while, until a big message is loaded
|
||||
// or do we need to wait until here, to make sure the message is fully analyzed
|
||||
// what about almost hiding it on the start, and then showing here?
|
||||
mMsgNotificationBar: document.getElementById('msgNotificationBar'),
|
||||
|
||||
var isJunk = false;
|
||||
setJunkMsg: function (aMsgHdr)
|
||||
{
|
||||
var isJunk = false;
|
||||
var isCurrentlyNotJunk = this.mMsgNotificationBar.selectedIndex != kMsgNotificationJunkBar;
|
||||
|
||||
if (aMsgHdr) {
|
||||
var junkScore = aMsgHdr.getStringProperty("junkscore");
|
||||
isJunk = ((junkScore != "") && (junkScore != "0"));
|
||||
if (aMsgHdr)
|
||||
{
|
||||
var junkScore = aMsgHdr.getStringProperty("junkscore");
|
||||
isJunk = ((junkScore != "") && (junkScore != "0"));
|
||||
}
|
||||
|
||||
this.updateMsgNotificationBar (isJunk ? kMsgNotificationJunkBar : kMsgNotificationNoStatus);
|
||||
|
||||
goUpdateCommand('button_junk');
|
||||
|
||||
return (isJunk && isCurrentlyNotJunk) || (!isJunk && !isCurrentlyNotJunk);
|
||||
},
|
||||
|
||||
setRemoteContentMsg: function (aMsgHdr)
|
||||
{
|
||||
this.updateMsgNotificationBar(aMsgHdr && aMsgHdr.getUint32Property("remoteContentPolicy") == kBlockRemoteContent ?
|
||||
kMsgNotificationRemoteImages : kMsgNotificationNoStatus);
|
||||
},
|
||||
|
||||
clearMsgNotifications: function()
|
||||
{
|
||||
this.updateMsgNotificationBar(kMsgNotificationNoStatus);
|
||||
},
|
||||
|
||||
// private method used to set our message notification deck to the correct value...
|
||||
updateMsgNotificationBar: function(aIndex)
|
||||
{
|
||||
if (aIndex == kMsgNotificationNoStatus)
|
||||
this.mMsgNotificationBar.setAttribute('collapsed', true);
|
||||
else
|
||||
this.mMsgNotificationBar.removeAttribute('collapsed');
|
||||
|
||||
this.mMsgNotificationBar.selectedIndex = aIndex;
|
||||
}
|
||||
|
||||
var junkBar = document.getElementById("junkBar");
|
||||
var isAlreadyCollapsed = junkBar.getAttribute("collapsed") == "true";
|
||||
|
||||
if (isJunk)
|
||||
junkBar.removeAttribute("collapsed");
|
||||
else
|
||||
junkBar.setAttribute("collapsed","true");
|
||||
|
||||
goUpdateCommand('button_junk');
|
||||
|
||||
return (isJunk && isAlreadyCollapsed) || (!isJunk && !isAlreadyCollapsed);
|
||||
}
|
||||
|
||||
// hides or shows the remote content bar based on the property in the msg hdr
|
||||
function SetUpRemoteContentBar(aMsgHdr)
|
||||
{
|
||||
var showRemoteContentBar = false;
|
||||
if (aMsgHdr && aMsgHdr.getUint32Property("remoteContentPolicy") == kBlockRemoteContent)
|
||||
showRemoteContentBar = true;
|
||||
|
||||
var remoteContentBar = document.getElementById("remoteContentBar");
|
||||
|
||||
if (showRemoteContentBar)
|
||||
remoteContentBar.removeAttribute("collapsed");
|
||||
else
|
||||
remoteContentBar.setAttribute("collapsed","true");
|
||||
}
|
||||
};
|
||||
|
||||
function LoadMsgWithRemoteContent()
|
||||
{
|
||||
@ -2269,8 +2274,8 @@ function OnMsgLoaded(aUrl)
|
||||
|
||||
if (!(/type=x-message-display/.test(msgURI)))
|
||||
msgHdr = messenger.messageServiceFromURI(msgURI).messageURIToMsgHdr(msgURI);
|
||||
|
||||
SetUpJunkBar(msgHdr);
|
||||
|
||||
gMessageNotificationBar.setJunkMsg(msgHdr);
|
||||
|
||||
// we just finished loading a message. set a timer to actually mark the message is read after n seconds
|
||||
// where n can be configured by the user.
|
||||
|
@ -1935,19 +1935,26 @@
|
||||
</textbox>
|
||||
</hbox>
|
||||
|
||||
<hbox id="junkBar" collapsed="true" align="center">
|
||||
<image id="junkBarImage"/>
|
||||
<description flex="1" id="junkBarMessage">&junkBarMessage.label;</description>
|
||||
<spacer flex="1"/>
|
||||
<button label="¬JunkButton.label;" oncommand="JunkSelectedMessages(false)"/>
|
||||
</hbox>
|
||||
<!-- The msgNotificationBar appears on top of the message and displays
|
||||
information like: junk, contains remote images, or is a suspected phishing URL
|
||||
-->
|
||||
<deck id="msgNotificationBar" selectedIndex="0" collapsed="true">
|
||||
<hbox id="msgNotificationNoStatus"/>
|
||||
|
||||
<hbox id="remoteContentBar" collapsed="true" align="center">
|
||||
<image id="remoteContentImage"/>
|
||||
<description flex="1" id="remoteContentMessage">&remoteContenMessage.label;</description>
|
||||
<spacer flex="1"/>
|
||||
<button label="&loadRemoteContentButton.label;" oncommand="LoadMsgWithRemoteContent()"/>
|
||||
</hbox>
|
||||
<hbox id="junkBar" class="msgNotificationBar" align="center">
|
||||
<image id="junkBarImage"/>
|
||||
<description flex="1" class="msgNotificationBarText">&junkBarMessage.label;</description>
|
||||
<spacer flex="1"/>
|
||||
<button label="¬JunkButton.label;" oncommand="JunkSelectedMessages(false)"/>
|
||||
</hbox>
|
||||
|
||||
<hbox id="remoteContentBar" class="msgNotificationBar" align="center">
|
||||
<image id="remoteContentImage"/>
|
||||
<description flex="1" class="msgNotificationBarText">&remoteContenMessage.label;</description>
|
||||
<spacer flex="1"/>
|
||||
<button label="&loadRemoteContentButton.label;" oncommand="LoadMsgWithRemoteContent()"/>
|
||||
</hbox>
|
||||
</deck>
|
||||
|
||||
<statusbar class="chromeclass-status" id="status-bar">
|
||||
<hbox insertbefore="unreadMessageCount" id="statusTextBox" flex="1">
|
||||
|
@ -157,9 +157,7 @@
|
||||
ondragdrop="nsDragAndDrop.drop(event, messagepaneObserver);"
|
||||
ondragexit="nsDragAndDrop.dragExit(event, messagepaneObserver);">
|
||||
|
||||
<hbox id="junkBar"/>
|
||||
<hbox id="remoteContentBar"/>
|
||||
|
||||
<deck id="msgNotificationBar"/>
|
||||
<hbox id="msgHeaderView"/>
|
||||
|
||||
<!-- message view -->
|
||||
|
@ -385,8 +385,7 @@
|
||||
onmouseup="OnMouseUpThreadAndMessagePaneSplitter()"/>
|
||||
|
||||
<vbox id="messagepanebox" flex="1" minheight="100" height="200" minwidth="100" width="200" persist="collapsed height width">
|
||||
<hbox id="junkBar"/>
|
||||
<hbox id="remoteContentBar"/>
|
||||
<deck id="msgNotificationBar"/>
|
||||
<hbox id="msgHeaderView"/>
|
||||
<browser id="messagepane" context="messagePaneContext" autofind="false"
|
||||
minheight="1" flex="1" name="messagepane"
|
||||
|
@ -326,7 +326,7 @@ var messageHeaderSink = {
|
||||
gBuildAttachmentPopupForCurrentMsg = true;
|
||||
ClearAttachmentList();
|
||||
ClearEditMessageButton();
|
||||
SetUpRemoteContentBar(null);
|
||||
gMessageNotificationBar.clearMsgNotifications();
|
||||
|
||||
for (index in gMessageListeners)
|
||||
gMessageListeners[index].onStartHeaders();
|
||||
@ -474,9 +474,10 @@ var messageHeaderSink = {
|
||||
{
|
||||
OnMsgLoaded(url);
|
||||
},
|
||||
|
||||
onMsgHasRemoteContent: function(aMsgHdr)
|
||||
{
|
||||
SetUpRemoteContentBar(aMsgHdr);
|
||||
gMessageNotificationBar.setRemoteContentMsg(aMsgHdr);
|
||||
},
|
||||
|
||||
mSecurityInfo : null,
|
||||
|
@ -1259,12 +1259,10 @@ function ClearMessagePane()
|
||||
gCurrentDisplayedMessage = null;
|
||||
if (GetMessagePaneFrame().location != "about:blank")
|
||||
GetMessagePaneFrame().location = "about:blank";
|
||||
|
||||
// hide the message header view AND the message pane...
|
||||
HideMessageHeaderPane();
|
||||
|
||||
// hide the junk bar
|
||||
SetUpJunkBar(null);
|
||||
SetUpRemoteContentBar(null);
|
||||
gMessageNotificationBar.clearMsgNotifications();
|
||||
}
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 374 B |
@ -27,7 +27,6 @@ classic.jar:
|
||||
skin/classic/messenger/icons/throbber.gif (icons/throbber.gif)
|
||||
skin/classic/messenger/icons/throbber-small.gif (icons/throbber-small.gif)
|
||||
skin/classic/messenger/icons/throbber-small.png (icons/throbber-small.png)
|
||||
skin/classic/messenger/icons/junkbar.png (icons/junkbar.png)
|
||||
+ skin/classic/messenger/icons/folder-junk.png (icons/folder-junk.png)
|
||||
skin/classic/messenger/icons/folder-closed.png (icons/folder-closed.png)
|
||||
skin/classic/messenger/icons/folder-draft.png (icons/folder-draft.png)
|
||||
|
@ -434,17 +434,17 @@ toolbar[iconsize="small"] #button-next[disabled] {
|
||||
|
||||
/* ::::: end small primary toolbar buttons ::::: */
|
||||
|
||||
#junkBarImage {
|
||||
list-style-image: url("chrome://messenger/skin/icons/mail-toolbar.png");
|
||||
-moz-image-region: rect(0px 256px 32px 224px);
|
||||
}
|
||||
|
||||
#junkBarMessage {
|
||||
.msgNotificationBarText {
|
||||
font: icon;
|
||||
font-weight: bold;
|
||||
padding: 0px 4px;
|
||||
}
|
||||
|
||||
#junkBarImage {
|
||||
list-style-image: url("chrome://messenger/skin/icons/mail-toolbar.png");
|
||||
-moz-image-region: rect(0px 256px 32px 224px);
|
||||
}
|
||||
|
||||
#junkBar {
|
||||
border: 1px solid #9AC790;
|
||||
-moz-border-radius: 7px;
|
||||
@ -460,12 +460,6 @@ toolbar[iconsize="small"] #button-next[disabled] {
|
||||
|
||||
/* ::::: remote content bar status rules ::::: */
|
||||
|
||||
#remoteContentMessage {
|
||||
font: icon;
|
||||
font-weight: bold;
|
||||
padding: 0px 4px;
|
||||
}
|
||||
|
||||
#remoteContentImage {
|
||||
list-style-image: url("chrome://global/skin/console/console-toolbar.png");
|
||||
-moz-image-region: rect(0px, 32px, 32px, 0px);
|
||||
|
@ -436,7 +436,19 @@ toolbar[iconsize="small"] #button-mark[disabled] {
|
||||
|
||||
/* ::::: end small primary toolbar buttons ::::: */
|
||||
|
||||
/* ::::: junk message bar style rules ::::: */
|
||||
/* ::::: message notification bar style rules ::::: */
|
||||
|
||||
.msgNotificationBar {
|
||||
border-bottom: 1px solid;
|
||||
-moz-border-bottom-colors: #000000;
|
||||
-moz-appearance: toolbox;
|
||||
background-color: -moz-Dialog;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.msgNotificationBarText {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#junkBarImage {
|
||||
list-style-image: url("chrome://messenger/skin/icons/mail-toolbar-small.png");
|
||||
@ -444,37 +456,11 @@ toolbar[iconsize="small"] #button-mark[disabled] {
|
||||
padding-left: 3px;
|
||||
}
|
||||
|
||||
#junkBarMessage {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#junkBar {
|
||||
border-bottom: 1px solid;
|
||||
-moz-border-bottom-colors: #000000;
|
||||
background: url("chrome://messenger/skin/icons/junkbar.png") repeat-y bottom left white;
|
||||
color: white;
|
||||
}
|
||||
|
||||
|
||||
#junkIcon {
|
||||
list-style-image: url("chrome://messenger/skin/icons/folder-junk.png");
|
||||
}
|
||||
|
||||
/* ::::: remote content bar status rules ::::: */
|
||||
|
||||
#remoteContentMessage {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#remoteContentImage {
|
||||
list-style-image: url("chrome://messenger/skin/icons/remote-blocked.png");
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
#remoteContentBar {
|
||||
border-bottom: 1px solid;
|
||||
-moz-border-bottom-colors: #000000;
|
||||
-moz-appearance: toolbox;
|
||||
background-color: -moz-Dialog;
|
||||
color: black;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user