fix for bug #190825. add junk mail icon to header pane for messages we think are junk.

also, fix for bug #185269 (fix classic skin icon in thread pane and thread pane column header)
r/sr=bienvenu
This commit is contained in:
sspitzer%netscape.com 2003-02-23 04:05:57 +00:00
parent 892426fd3f
commit 6bdc4c2e20
29 changed files with 180 additions and 33 deletions

View File

@ -175,6 +175,8 @@ Rights Reserved.
</splitter>
<!-- msg header view -->
<vbox id="messagepanebox" flex="4" persist="collapsed height">
<hbox id="junkBar"/>
<hbox id="msgHeaderView"/>
<!-- message view -->

View File

@ -446,6 +446,9 @@ function StopUrls()
function loadStartPage() {
try {
// collapse the junk bar
SetUpJunkBar(null);
var startpageenabled = pref.getBoolPref("mailnews.start_page.enabled");
if (startpageenabled) {

View File

@ -1890,10 +1890,50 @@ function SetupUndoRedoCommand(command)
return canUndoOrRedo;
}
function OnMsgLoaded(folder, msgURI)
function HandleJunkStatusChanged(folder)
{
if (IsCurrentLoadedFolder(folder)) {
var messageURI = GetLoadedMessage();
// if multiple message are selected
// and we change the junk status
// we don't want to show the junk bar
// (since the message pane is blank)
if (messageURI && (GetNumSelectedMessages() == 1))
SetUpJunkBar(messenger.messageServiceFromURI(messageURI).messageURIToMsgHdr(messageURI));
else
SetUpJunkBar(null);
}
}
function SetUpJunkBar(aMsgHdr)
{
// 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?
var isJunk = false;
if (aMsgHdr) {
var junkScore = aMsgHdr.getStringProperty("junkscore");
isJunk = ((junkScore != "") && (junkScore != "0"));
}
var junkBar = document.getElementById("junkBar");
if (isJunk)
junkBar.removeAttribute("collapsed");
else
junkBar.setAttribute("collapsed","true");
}
function OnMsgLoaded(folder, aMessageURI)
{
var msgHdr = messenger.messageServiceFromURI(aMessageURI).messageURIToMsgHdr(aMessageURI);
SetUpJunkBar(msgHdr);
var currentMsgFolder = folder.QueryInterface(Components.interfaces.nsIMsgFolder);
if (!IsImapMessage(msgURI))
if (!IsImapMessage(aMessageURI))
return;
var imapServer = currentMsgFolder.server.QueryInterface(Components.interfaces.nsIImapIncomingServer);
@ -1908,7 +1948,6 @@ function OnMsgLoaded(folder, msgURI)
// don't put this message in the read mail pfc.
var outputPFC = imapServer.GetReadMailPFC(true);
var msgHdr = messenger.messageServiceFromURI(messageURI).messageURIToMsgHdr(messageURI);
if (msgHdr)
{
messageID = msgHdr.messageId;

View File

@ -1602,6 +1602,17 @@ Rights Reserved.
accesskey="&advancedButton.accesskey;"/>
</hbox>
<hbox id="junkBar" collapsed="true">
<hbox align="center">
<image id="junkBarImage"/>
</hbox>
<hbox align="center">
<label id="junkBarMessage" value="&junkBarMessage.label;"/>
</hbox>
<spacer flex="1"/>
<button label="&notJunkButton.label;" oncommand="JunkSelectedMessages(false)" />
</hbox>
<statusbar class="chromeclass-status" id="status-bar">
<hbox insertbefore="unreadMessageCount" flex="1">
<statusbarpanel id="component-bar"/>

View File

@ -104,6 +104,9 @@ var folderListener = {
}
}
}
else if (eventType == "JunkStatusChanged") {
HandleJunkStatusChanged(folder);
}
}
}
@ -191,8 +194,7 @@ function HandleDeleteOrMoveMsgCompleted(folder)
if (!folderResource)
return;
var folderUri = folderResource.Value;
if ((folderUri == gCurrentFolderUri) && gCurrentMessageIsDeleted)
if ((folderResource.Value == gCurrentFolderUri) && gCurrentMessageIsDeleted)
{
gDBView.onDeleteCompleted(true);
gCurrentMessageIsDeleted = false;
@ -220,12 +222,20 @@ function HandleDeleteOrMoveMsgFailed(folder)
if (!folderResource)
return;
var folderUri = folderResource.Value;
gDBView.onDeleteCompleted(false);
if ((folderUri == gCurrentFolderUri) && gCurrentMessageIsDeleted)
if ((folderResource.Value == gCurrentFolderUri) && gCurrentMessageIsDeleted)
gCurrentMessageIsDeleted = false;
}
function IsCurrentLoadedFolder(folder)
{
var folderResource = folder.QueryInterface(Components.interfaces.nsIRDFResource);
if (!folderResource)
return false;
return (folderResource.Value == gCurrentFolderUri);
}
function OnLoadMessageWindow()
{
HideMenus();

View File

@ -131,6 +131,9 @@ Rights Reserved.
ondragover="nsDragAndDrop.dragOver(event, messagepaneObserver);"
ondragdrop="nsDragAndDrop.drop(event, messagepaneObserver);"
ondragexit="nsDragAndDrop.dragExit(event, messagepaneObserver);">
<hbox id="junkBar"/>
<hbox id="msgHeaderView"/>
<!-- message view -->

View File

@ -169,6 +169,9 @@ Rights Reserved.
</splitter>
<vbox id="messagepanebox" flex="3" persist="collapsed height" onclick="contentAreaClick(event);">
<hbox id="junkBar"/>
<hbox id="msgHeaderView"/>
<browser id="messagepane" context="messagePaneContext"

View File

@ -272,9 +272,12 @@ var folderListener = {
else if (eventType == "CompactCompleted") {
HandleCompactCompleted(folder);
}
else if(eventType == "RenameCompleted") {
else if (eventType == "RenameCompleted") {
SelectFolder(folder.URI);
}
else if (eventType == "JunkStatusChanged") {
HandleJunkStatusChanged(folder);
}
}
}
@ -1038,6 +1041,9 @@ function ClearMessagePane()
GetMessagePaneFrame().location = "about:blank";
// hide the message header view AND the message pane...
HideMessageHeaderPane();
// hide the junk bar
SetUpJunkBar(null);
}
}

View File

@ -42,6 +42,9 @@ Contributors:
<treecol id="threadCol" persist="hidden ordinal" fixed="true" cycler="true" class="treecol-image threadColumnHeader" currentView="unthreaded"
display="&threadColumn.label;" tooltiptext="&threadColumn.tooltip;"/>
<splitter class="tree-splitter"/>
<treecol id="junkStatusCol" persist="hidden ordinal width" fixed="true" cycler="true" hidden="true" class="treecol-image junkStatusHeader"
display="&junkStatusColumn.label;" tooltiptext="&junkStatusColumn.tooltip;"/>
<splitter class="tree-splitter"/>
<treecol id="subjectCol" persist="hidden ordinal width" flex="7" ignoreincolumnpicker="true"
label="&subjectColumn.label;" tooltiptext="&subjectColumn.tooltip;"/>
<splitter class="tree-splitter"/>
@ -60,9 +63,6 @@ Contributors:
<treecol id="sizeCol" persist="hidden ordinal width" flex="1" hidden="true"
label="&sizeColumn.label;" tooltiptext="&sizeColumn.tooltip;"/>
<splitter class="tree-splitter"/>
<treecol id="junkStatusCol" persist="hidden ordinal width" fixed="true" cycler="true" hidden="true" class="treecol-image junkStatusHeader"
display="&junkStatusColumn.label;" tooltiptext="&junkStatusColumn.tooltip;"/>
<splitter class="tree-splitter"/>
<treecol id="flaggedCol" persist="hidden ordinal" fixed="true" cycler="true" hidden="true" class="treecol-image flagColumnHeader"
display="&flagColumn.label;" tooltiptext="&flagColumn.tooltip;"/>
<splitter class="tree-splitter"/>

View File

@ -523,3 +523,7 @@ Rights Reserved.
<!ENTITY markSelectedAsJunk.label "Mark Selected Messages As Junk">
<!ENTITY markSelectedAsNotJunk.label "Mark Selected Messages As Not Junk">
<!-- junk bar -->
<!ENTITY junkBarMessage.label "&brandShortName; thinks this message is junk mail">
<!ENTITY notJunkButton.label "This is Not Junk">

View File

@ -4396,7 +4396,12 @@ NS_IMETHODIMP nsMsgDBView::OnAnnouncerGoingAway(nsIDBChangeAnnouncer *instigator
}
NS_IMETHODIMP nsMsgDBView::OnReadChanged(nsIDBChangeListener *instigator)
NS_IMETHODIMP nsMsgDBView::OnReadChanged(nsIDBChangeListener *aInstigator)
{
return NS_OK;
}
NS_IMETHODIMP nsMsgDBView::OnJunkScoreChanged(nsIDBChangeListener *aInstigator)
{
return NS_OK;
}

View File

@ -247,11 +247,8 @@ NS_IMETHODIMP nsMsgWindow::SetMsgHeaderSink(nsIMsgHeaderSink * aMsgHdrSink)
NS_IMETHODIMP nsMsgWindow::GetTransactionManager(nsITransactionManager * *aTransactionManager)
{
if(!aTransactionManager)
return NS_ERROR_NULL_POINTER;
*aTransactionManager = mTransactionManager;
NS_IF_ADDREF(*aTransactionManager);
NS_ENSURE_ARG_POINTER(aTransactionManager);
NS_IF_ADDREF(*aTransactionManager = mTransactionManager);
return NS_OK;
}
@ -263,13 +260,9 @@ NS_IMETHODIMP nsMsgWindow::SetTransactionManager(nsITransactionManager * aTransa
NS_IMETHODIMP nsMsgWindow::GetOpenFolder(nsIMsgFolder * *aOpenFolder)
{
if(!aOpenFolder)
return NS_ERROR_NULL_POINTER;
*aOpenFolder = mOpenFolder;
NS_IF_ADDREF(*aOpenFolder);
NS_ENSURE_ARG_POINTER(aOpenFolder);
NS_IF_ADDREF(*aOpenFolder = mOpenFolder);
return NS_OK;
}
NS_IMETHODIMP nsMsgWindow::SetOpenFolder(nsIMsgFolder * aOpenFolder)

View File

@ -80,6 +80,7 @@ static PRTime gtimeOfLastPurgeCheck; //variable to know when to check for pur
nsIAtom* nsMsgDBFolder::mFolderLoadedAtom=nsnull;
nsIAtom* nsMsgDBFolder::mDeleteOrMoveMsgCompletedAtom=nsnull;
nsIAtom* nsMsgDBFolder::mDeleteOrMoveMsgFailedAtom=nsnull;
nsIAtom* nsMsgDBFolder::mJunkStatusChangedAtom=nsnull;
nsrefcnt nsMsgDBFolder::mInstanceCount=0;
NS_IMPL_ISUPPORTS_INHERITED2(nsMsgDBFolder, nsMsgFolder,
@ -94,6 +95,7 @@ nsMsgDBFolder::nsMsgDBFolder(void)
mFolderLoadedAtom = NS_NewAtom("FolderLoaded");
mDeleteOrMoveMsgCompletedAtom = NS_NewAtom("DeleteOrMoveMsgCompleted");
mDeleteOrMoveMsgFailedAtom = NS_NewAtom("DeleteOrMoveMsgFailed");
mJunkStatusChangedAtom = NS_NewAtom("JunkStatusChanged");
LL_I2L(gtimeOfLastPurgeCheck, 0);
}
}
@ -104,6 +106,7 @@ nsMsgDBFolder::~nsMsgDBFolder(void)
NS_IF_RELEASE(mFolderLoadedAtom);
NS_IF_RELEASE(mDeleteOrMoveMsgCompletedAtom);
NS_IF_RELEASE(mDeleteOrMoveMsgFailedAtom);
NS_IF_RELEASE(mJunkStatusChangedAtom);
}
//shutdown but don't shutdown children.
Shutdown(PR_FALSE);
@ -663,10 +666,18 @@ nsMsgDBFolder::SetMsgDatabase(nsIMsgDatabase *aMsgDatabase)
NS_IMETHODIMP
nsMsgDBFolder::OnReadChanged(nsIDBChangeListener * aInstigator)
{
/* do nothing. if you care about this, over ride it. see nsNewsFolder.cpp */
/* do nothing. if you care about this, override it. see nsNewsFolder.cpp */
return NS_OK;
}
NS_IMETHODIMP
nsMsgDBFolder::OnJunkScoreChanged(nsIDBChangeListener * aInstigator)
{
NotifyFolderEvent(mJunkStatusChangedAtom);
return NS_OK;
}
// 1. When the status of a message changes.
NS_IMETHODIMP nsMsgDBFolder::OnKeyChange(nsMsgKey aKeyChanged, PRUint32 aOldFlags, PRUint32 aNewFlags,
nsIDBChangeListener * aInstigator)
@ -1171,7 +1182,8 @@ nsMsgDBFolder::OnStopRunningUrl(nsIURI *aUrl, nsresult aExitCode)
return NS_OK;
}
NS_IMETHODIMP nsMsgDBFolder::GetRetentionSettings(nsIMsgRetentionSettings **settings)
NS_IMETHODIMP
nsMsgDBFolder::GetRetentionSettings(nsIMsgRetentionSettings **settings)
{
NS_ENSURE_ARG_POINTER(settings);
nsresult rv = NS_OK;

View File

@ -173,6 +173,7 @@ protected:
static nsIAtom* mFolderLoadedAtom;
static nsIAtom* mDeleteOrMoveMsgCompletedAtom;
static nsIAtom* mDeleteOrMoveMsgFailedAtom;
static nsIAtom* mJunkStatusChangedAtom;
static nsrefcnt mInstanceCount;
};

View File

@ -57,6 +57,8 @@ interface nsIDBChangeAnnouncer : nsISupports {
void NotifyReadChanged(in nsIDBChangeListener instigator);
void NotifyJunkScoreChanged(in nsIDBChangeListener aInstigator);
void NotifyAnnouncerGoingAway();
};

View File

@ -52,6 +52,7 @@ interface nsIDBChangeListener : nsISupports {
void OnParentChanged (in nsMsgKey aKeyChanged, in nsMsgKey oldParent, in nsMsgKey newParent, in nsIDBChangeListener aInstigator);
void OnAnnouncerGoingAway(in nsIDBChangeAnnouncer instigator);
void OnReadChanged(in nsIDBChangeListener instigator);
void OnReadChanged(in nsIDBChangeListener aInstigator);
void OnJunkScoreChanged(in nsIDBChangeListener aInstigator);
};

View File

@ -500,6 +500,24 @@ NS_IMETHODIMP nsMsgDatabase::NotifyReadChanged(nsIDBChangeListener *instigator)
return NS_OK;
}
NS_IMETHODIMP nsMsgDatabase::NotifyJunkScoreChanged(nsIDBChangeListener *instigator)
{
if (m_ChangeListeners == nsnull)
return NS_OK;
PRUint32 count;
m_ChangeListeners->Count(&count);
for (PRUint32 i = 0; i < count; i++)
{
nsCOMPtr<nsIDBChangeListener> changeListener;
m_ChangeListeners->QueryElementAt(i, NS_GET_IID(nsIDBChangeListener), (void **) getter_AddRefs(changeListener));
nsresult rv = changeListener->OnJunkScoreChanged(instigator);
if (NS_FAILED(rv))
return rv;
}
return NS_OK;
}
NS_IMETHODIMP nsMsgDatabase::NotifyKeyDeletedAll(nsMsgKey keyDeleted, nsMsgKey parentKey, PRInt32 flags,
nsIDBChangeListener *instigator)
{
@ -1526,7 +1544,6 @@ nsresult nsMsgDatabase::AdjustExpungedBytesOnDelete(nsIMsgDBHdr *msgHdr)
return m_dbFolderInfo->ChangeExpungedBytes (size);
}
NS_IMETHODIMP nsMsgDatabase::DeleteHeader(nsIMsgDBHdr *msg, nsIDBChangeListener *instigator, PRBool commit, PRBool notify)
{
nsMsgHdr* msgHdr = NS_STATIC_CAST(nsMsgHdr*, msg); // closed system, so this is ok
@ -1886,6 +1903,9 @@ NS_IMETHODIMP nsMsgDatabase::SetStringProperty(nsMsgKey aKey, const char *aPrope
rv = msgHdr->SetStringProperty(aProperty, aValue);
NS_ENSURE_SUCCESS(rv,rv);
if (strcmp(aProperty, "junkscore") == 0)
NotifyJunkScoreChanged(nsnull);
PRUint32 flags;
(void)msgHdr->GetFlags(&flags);

View File

@ -248,6 +248,12 @@ NS_IMETHODIMP nsMsgMailboxParser::OnReadChanged(nsIDBChangeListener *instigator)
return NS_OK;
}
/* void OnJunkScoreChanged (in nsIDBChangeListener instigator); */
NS_IMETHODIMP nsMsgMailboxParser::OnJunkScoreChanged(nsIDBChangeListener *instigator)
{
return NS_OK;
}
nsMsgMailboxParser::nsMsgMailboxParser() : nsMsgLineBuffer(nsnull, PR_FALSE)
{
Init();

View File

@ -314,7 +314,6 @@ classic.jar:
skin/classic/messenger/smime/icons/hdrSignNotOk.gif (messenger/smime/icons/hdrSignNotOk.gif)
skin/classic/messenger/smime/icons/hdrCryptoOk.gif (messenger/smime/icons/hdrCryptoOk.gif)
skin/classic/messenger/smime/icons/hdrCryptoNotOk.gif (messenger/smime/icons/hdrCryptoNotOk.gif)
skin/classic/messenger/icons/message-junk-other.gif (messenger/icons/message-junk-other.gif)
skin/classic/navigator/contents.rdf (navigator/contents.rdf)
skin/classic/navigator/navigator.css (navigator/navigator.css)
skin/classic/navigator/linkToolbar.css (navigator/linkToolbar.css)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 540 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 564 B

View File

@ -118,3 +118,5 @@
#messagepanebox[focusring="true"] > #messagepane {
border-color: #000000;
}

View File

@ -227,3 +227,16 @@
#button-junk[disabled="true"] {
list-style-image: url("chrome://messenger/skin/icons/junk-dis.gif");
}
#junkBarImage {
list-style-image: url("chrome://messenger/skin/icons/junk.gif");
}
#junkBarMessage {
font-weight: bold;
}
#junkBar {
border-bottom: 1px solid;
-moz-border-bottom-colors: #000000;
}

View File

@ -140,7 +140,7 @@ treechildren:-moz-tree-image(flaggedCol, flagged) {
/* ..... junkStatus column ..... */
treecol.junkStatusHeader {
list-style-image: url("chrome://messenger/skin/icons/message-junk-other.gif");
list-style-image: url("chrome://messenger/skin/icons/folder-junk.gif");
}
/* "unknown" now looks like "not junk". see bug #182386 */
@ -151,7 +151,7 @@ treechildren:-moz-tree-image(junkStatusCol) {
}
treechildren:-moz-tree-image(junkStatusCol, junk) {
list-style-image: url("chrome://messenger/skin/icons/message-junk-other.gif");
list-style-image: url("chrome://messenger/skin/icons/folder-junk.gif");
}
treechildren:-moz-tree-image(junkStatusCol, notjunk) {

View File

@ -397,6 +397,7 @@ modern.jar:
skin/modern/messenger/icons/junk-act.gif (messenger/icons/junk-act.gif)
skin/modern/messenger/icons/junk-hov.gif (messenger/icons/junk-hov.gif)
skin/modern/messenger/icons/junk-dis.gif (messenger/icons/junk-dis.gif)
skin/modern/messenger/icons/junkBar.gif (messenger/icons/junkBar.gif)
skin/modern/messenger/icons/message-junk-other.gif (messenger/icons/message-junk-other.gif)
skin/modern/messenger/messengercompose/messengercompose.css (messenger/messengercompose/messengercompose.css)
skin/modern/messenger/messengercompose/icons/mast-msgcomp.gif (messenger/messengercompose/icons/mast-msgcomp.gif)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 564 B

View File

@ -43,5 +43,3 @@
@import url("chrome://messenger/skin/primaryToolbar.css");
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
/* ::::: folder icons for menus ::::: */

View File

@ -248,3 +248,16 @@
list-style-image: url("chrome://messenger/skin/icons/junk-dis.gif");
}
#junkBarImage {
list-style-image: url("chrome://messenger/skin/icons/junkBar.gif");
}
#junkBarMessage {
font-weight: bold;
}
#junkBar {
border-bottom: 1px solid;
-moz-border-bottom-colors: #000000;
}