diff --git a/mailnews/base/util/nsMsgDBFolder.cpp b/mailnews/base/util/nsMsgDBFolder.cpp index 46416af5eab9..340587175d1c 100644 --- a/mailnews/base/util/nsMsgDBFolder.cpp +++ b/mailnews/base/util/nsMsgDBFolder.cpp @@ -52,11 +52,7 @@ nsIAtom* nsMsgDBFolder::mFolderLoadedAtom=nsnull; nsIAtom* nsMsgDBFolder::mDeleteOrMoveMsgCompletedAtom=nsnull; nsrefcnt nsMsgDBFolder::mInstanceCount=0; -NS_IMPL_ADDREF_INHERITED(nsMsgDBFolder, nsMsgFolder) -NS_IMPL_RELEASE_INHERITED(nsMsgDBFolder, nsMsgFolder) - -NS_IMPL_QUERY_INTERFACE_INHERITED2(nsMsgDBFolder, - nsMsgFolder, +NS_IMPL_ISUPPORTS_INHERITED2(nsMsgDBFolder, nsMsgFolder, nsIDBChangeListener, nsIUrlListener) @@ -610,7 +606,7 @@ NS_IMETHODIMP nsMsgDBFolder::OnKeyChange(nsMsgKey aKeyChanged, PRUint32 aOldFlag { SendFlagNotifications(msgSupports, aOldFlags, aNewFlags); } - UpdateSummaryTotals(PR_TRUE); + UpdateSummaryTotals(PR_TRUE); } } @@ -961,8 +957,11 @@ nsMsgDBFolder::MarkAllMessagesRead(void) nsresult rv = GetDatabase(nsnull); if(NS_SUCCEEDED(rv)) - return mDatabase->MarkAllRead(nsnull); - + { + EnableNotifications(allMessageCountNotifications, PR_FALSE); + rv = mDatabase->MarkAllRead(nsnull); + EnableNotifications(allMessageCountNotifications, PR_TRUE); + } return rv; } diff --git a/mailnews/base/util/nsMsgFolder.cpp b/mailnews/base/util/nsMsgFolder.cpp index 8b3f0e1a22f7..929014834a83 100644 --- a/mailnews/base/util/nsMsgFolder.cpp +++ b/mailnews/base/util/nsMsgFolder.cpp @@ -172,10 +172,7 @@ nsMsgFolder::~nsMsgFolder(void) } } -NS_IMPL_ADDREF_INHERITED(nsMsgFolder, nsRDFResource) -NS_IMPL_RELEASE_INHERITED(nsMsgFolder, nsRDFResource) - -NS_IMPL_QUERY_INTERFACE_INHERITED3(nsMsgFolder, nsRDFResource, +NS_IMPL_ISUPPORTS_INHERITED3(nsMsgFolder, nsRDFResource, nsIMsgFolder, nsIFolder, nsISupportsWeakReference) @@ -1648,6 +1645,7 @@ NS_IMETHODIMP nsMsgFolder::GetExpansionArray(nsISupportsArray *expansionArray) return NS_OK; } + #ifdef HAVE_PANE NS_IMETHODIMP nsMsgFolder::SetFlagInAllFolderPanes(PRUInt32 which) { diff --git a/mailnews/imap/src/nsImapMailFolder.cpp b/mailnews/imap/src/nsImapMailFolder.cpp index f8bf3d2c2f5c..ab2ed85b9549 100644 --- a/mailnews/imap/src/nsImapMailFolder.cpp +++ b/mailnews/imap/src/nsImapMailFolder.cpp @@ -1041,6 +1041,9 @@ NS_IMETHODIMP nsImapMailFolder::GetFolderURL(char **url) NS_IMETHODIMP nsImapMailFolder::UpdateSummaryTotals(PRBool force) { + if (!mNotifyCountChanges) + return NS_OK; + // could we move this into nsMsgDBFolder, or do we need to deal // with the pending imap counts? nsresult rv = NS_OK; @@ -1050,10 +1053,6 @@ NS_IMETHODIMP nsImapMailFolder::UpdateSummaryTotals(PRBool force) //We need to read this info from the database ReadDBFolderInfo(force); - // If we asked, but didn't get any, stop asking - if (mNumUnreadMessages == -1) - mNumUnreadMessages = -2; - PRInt32 newUnreadMessages = mNumUnreadMessages + mNumPendingUnreadMessages; PRInt32 newTotalMessages = mNumTotalMessages + mNumPendingTotalMessages; @@ -1174,7 +1173,9 @@ nsImapMailFolder::MarkAllMessagesRead(void) if(NS_SUCCEEDED(rv)) { nsMsgKeyArray thoseMarked; + EnableNotifications(allMessageCountNotifications, PR_FALSE); rv = mDatabase->MarkAllRead(&thoseMarked); + EnableNotifications(allMessageCountNotifications, PR_TRUE); if (NS_SUCCEEDED(rv)) { rv = StoreImapFlags(kImapMsgSeenFlag, PR_TRUE, thoseMarked); @@ -3274,7 +3275,11 @@ nsImapMailFolder::OnStopRunningUrl(nsIURI *aUrl, nsresult aExitCode) if (msgTxn) msgTxn->GetSrcKeyArray(srcKeyArray); if (!ShowDeletedMessages()) + { + EnableNotifications(allMessageCountNotifications, PR_FALSE); srcDB->DeleteMessages(&srcKeyArray, nsnull); + EnableNotifications(allMessageCountNotifications, PR_TRUE); + } else MarkMessagesImapDeleted(&srcKeyArray, PR_TRUE, srcDB); } diff --git a/mailnews/local/src/nsLocalMailFolder.cpp b/mailnews/local/src/nsLocalMailFolder.cpp index a315fe99eef9..d7a5a6846a0b 100644 --- a/mailnews/local/src/nsLocalMailFolder.cpp +++ b/mailnews/local/src/nsLocalMailFolder.cpp @@ -1501,15 +1501,13 @@ nsMsgLocalMailFolder::GetDBFolderInfoAndDB(nsIDBFolderInfo **folderInfo, nsIMsgD NS_IMETHODIMP nsMsgLocalMailFolder::UpdateSummaryTotals(PRBool force) { + if (!mNotifyCountChanges) + return NS_OK; PRInt32 oldUnreadMessages = mNumUnreadMessages; PRInt32 oldTotalMessages = mNumTotalMessages; //We need to read this info from the database ReadDBFolderInfo(force); - // If we asked, but didn't get any, stop asking - if (mNumUnreadMessages == -1) - mNumUnreadMessages = -2; - //Need to notify listeners that total count changed. if(oldTotalMessages != mNumTotalMessages) { @@ -1521,6 +1519,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::UpdateSummaryTotals(PRBool force) NotifyIntPropertyChanged(kTotalUnreadMessagesAtom, oldUnreadMessages, mNumUnreadMessages); } + FlushToFolderCache(); return NS_OK; } diff --git a/mailnews/news/src/nsNewsFolder.cpp b/mailnews/news/src/nsNewsFolder.cpp index cb31b6e32f56..390dcbbb6e04 100644 --- a/mailnews/news/src/nsNewsFolder.cpp +++ b/mailnews/news/src/nsNewsFolder.cpp @@ -843,6 +843,9 @@ nsMsgNewsFolder::UpdateSummaryFromNNTPInfo(PRInt32 oldest, PRInt32 youngest, PRI NS_IMETHODIMP nsMsgNewsFolder::UpdateSummaryTotals(PRBool force) { + if (!mNotifyCountChanges) + return NS_OK; + #ifdef DEBUG_NEWS printf("nsMsgNewsFolder::UpdateSummaryTotals(%s)\n",mURI); #endif @@ -852,10 +855,6 @@ NS_IMETHODIMP nsMsgNewsFolder::UpdateSummaryTotals(PRBool force) //We need to read this info from the database ReadDBFolderInfo(force); - // If we asked, but didn't get any, stop asking - if (mNumUnreadMessages == -1) - mNumUnreadMessages = -2; - //Need to notify listeners that total count changed. if(oldTotalMessages != mNumTotalMessages) { NotifyIntPropertyChanged(kTotalMessagesAtom, oldTotalMessages, mNumTotalMessages); @@ -865,6 +864,7 @@ NS_IMETHODIMP nsMsgNewsFolder::UpdateSummaryTotals(PRBool force) NotifyIntPropertyChanged(kTotalUnreadMessagesAtom, oldUnreadMessages, mNumUnreadMessages); } + FlushToFolderCache(); return NS_OK; }