mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 08:12:05 +00:00
add batching support for msg count notifications r=putterman 49212 and 17470
This commit is contained in:
parent
bf41e5e70d
commit
e4622d02ab
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user