зеркало из https://github.com/mozilla/pjs.git
more work on imap pending counts,r=jefft
This commit is contained in:
Родитель
801c04575d
Коммит
08275ee4e5
|
@ -723,8 +723,8 @@ NS_IMETHODIMP nsImapMailFolder::UpdateSummaryTotals(PRBool force)
|
||||||
// with the pending imap counts?
|
// with the pending imap counts?
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
PRInt32 oldUnreadMessages = mNumUnreadMessages;
|
PRInt32 oldUnreadMessages = mNumUnreadMessages + mNumPendingUnreadMessages;
|
||||||
PRInt32 oldTotalMessages = mNumTotalMessages;
|
PRInt32 oldTotalMessages = mNumTotalMessages + mNumPendingTotalMessages;
|
||||||
//We need to read this info from the database
|
//We need to read this info from the database
|
||||||
ReadDBFolderInfo(force);
|
ReadDBFolderInfo(force);
|
||||||
|
|
||||||
|
@ -732,20 +732,23 @@ NS_IMETHODIMP nsImapMailFolder::UpdateSummaryTotals(PRBool force)
|
||||||
if (mNumUnreadMessages == -1)
|
if (mNumUnreadMessages == -1)
|
||||||
mNumUnreadMessages = -2;
|
mNumUnreadMessages = -2;
|
||||||
|
|
||||||
|
PRInt32 newUnreadMessages = mNumUnreadMessages + mNumPendingUnreadMessages;
|
||||||
|
PRInt32 newTotalMessages = mNumTotalMessages + mNumPendingTotalMessages;
|
||||||
|
|
||||||
//Need to notify listeners that total count changed.
|
//Need to notify listeners that total count changed.
|
||||||
if(oldTotalMessages != mNumTotalMessages)
|
if(oldTotalMessages != newTotalMessages)
|
||||||
{
|
{
|
||||||
char *oldTotalMessagesStr = PR_smprintf("%d", oldTotalMessages);
|
char *oldTotalMessagesStr = PR_smprintf("%d", oldTotalMessages);
|
||||||
char *totalMessagesStr = PR_smprintf("%d",mNumTotalMessages);
|
char *totalMessagesStr = PR_smprintf("%d",newTotalMessages);
|
||||||
NotifyPropertyChanged("TotalMessages", oldTotalMessagesStr, totalMessagesStr);
|
NotifyPropertyChanged("TotalMessages", oldTotalMessagesStr, totalMessagesStr);
|
||||||
PR_smprintf_free(totalMessagesStr);
|
PR_smprintf_free(totalMessagesStr);
|
||||||
PR_smprintf_free(oldTotalMessagesStr);
|
PR_smprintf_free(oldTotalMessagesStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(oldUnreadMessages != mNumUnreadMessages)
|
if(oldUnreadMessages != newUnreadMessages)
|
||||||
{
|
{
|
||||||
char *oldUnreadMessagesStr = PR_smprintf("%d", oldUnreadMessages);
|
char *oldUnreadMessagesStr = PR_smprintf("%d", oldUnreadMessages);
|
||||||
char *totalUnreadMessages = PR_smprintf("%d",mNumUnreadMessages);
|
char *totalUnreadMessages = PR_smprintf("%d",newUnreadMessages);
|
||||||
NotifyPropertyChanged("TotalUnreadMessages", oldUnreadMessagesStr, totalUnreadMessages);
|
NotifyPropertyChanged("TotalUnreadMessages", oldUnreadMessagesStr, totalUnreadMessages);
|
||||||
PR_smprintf_free(totalUnreadMessages);
|
PR_smprintf_free(totalUnreadMessages);
|
||||||
PR_smprintf_free(oldUnreadMessagesStr);
|
PR_smprintf_free(oldUnreadMessagesStr);
|
||||||
|
@ -1207,6 +1210,9 @@ NS_IMETHODIMP nsImapMailFolder::UpdateImapMailboxInfo(
|
||||||
(void **) getter_AddRefs(mailDBFactory));
|
(void **) getter_AddRefs(mailDBFactory));
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
ChangeNumPendingTotalMessages(-GetNumPendingTotalMessages());
|
||||||
|
ChangeNumPendingUnread(-GetNumPendingUnread());
|
||||||
|
|
||||||
if (!mDatabase)
|
if (!mDatabase)
|
||||||
{
|
{
|
||||||
// if we pass in PR_TRUE for upgrading, the db code will ignore the
|
// if we pass in PR_TRUE for upgrading, the db code will ignore the
|
||||||
|
@ -2518,8 +2524,12 @@ nsImapMailFolder::OnStopRunningUrl(nsIURI *aUrl, nsresult aExitCode)
|
||||||
nsCOMPtr<nsIMsgWindow> aWindow;
|
nsCOMPtr<nsIMsgWindow> aWindow;
|
||||||
nsCOMPtr<nsIMsgMailNewsUrl> mailUrl = do_QueryInterface(aUrl);
|
nsCOMPtr<nsIMsgMailNewsUrl> mailUrl = do_QueryInterface(aUrl);
|
||||||
nsCOMPtr<nsIImapUrl> imapUrl = do_QueryInterface(aUrl);
|
nsCOMPtr<nsIImapUrl> imapUrl = do_QueryInterface(aUrl);
|
||||||
|
PRBool folderOpen = PR_FALSE;
|
||||||
if (mailUrl)
|
if (mailUrl)
|
||||||
mailUrl->GetMsgWindow(getter_AddRefs(aWindow));
|
mailUrl->GetMsgWindow(getter_AddRefs(aWindow));
|
||||||
|
if (session)
|
||||||
|
session->IsFolderOpenInWindow(this, &folderOpen);
|
||||||
|
|
||||||
if (imapUrl)
|
if (imapUrl)
|
||||||
{
|
{
|
||||||
nsIImapUrl::nsImapAction imapAction = nsIImapUrl::nsImapTest;
|
nsIImapUrl::nsImapAction imapAction = nsIImapUrl::nsImapTest;
|
||||||
|
@ -2557,22 +2567,21 @@ nsImapMailFolder::OnStopRunningUrl(nsIURI *aUrl, nsresult aExitCode)
|
||||||
if (m_transactionManager)
|
if (m_transactionManager)
|
||||||
m_transactionManager->Do(m_copyState->m_undoMsgTxn);
|
m_transactionManager->Do(m_copyState->m_undoMsgTxn);
|
||||||
}
|
}
|
||||||
ClearCopyState(aExitCode);
|
|
||||||
}
|
|
||||||
if (session)
|
|
||||||
{
|
|
||||||
PRBool folderOpen = PR_FALSE;
|
|
||||||
session->IsFolderOpenInWindow(this, &folderOpen);
|
|
||||||
if (folderOpen)
|
if (folderOpen)
|
||||||
UpdateFolder(aWindow);
|
UpdateFolder(aWindow);
|
||||||
else
|
else
|
||||||
UpdatePendingCounts(PR_TRUE, PR_FALSE);
|
UpdatePendingCounts(PR_TRUE, PR_FALSE);
|
||||||
}
|
ClearCopyState(aExitCode);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case nsIImapUrl::nsImapAppendMsgFromFile:
|
case nsIImapUrl::nsImapAppendMsgFromFile:
|
||||||
case nsIImapUrl::nsImapAppendDraftFromFile:
|
case nsIImapUrl::nsImapAppendDraftFromFile:
|
||||||
if (m_copyState)
|
if (m_copyState)
|
||||||
{
|
{
|
||||||
|
if (folderOpen)
|
||||||
|
UpdateFolder(aWindow);
|
||||||
|
else
|
||||||
|
UpdatePendingCounts(PR_TRUE, PR_FALSE);
|
||||||
m_copyState->m_curIndex++;
|
m_copyState->m_curIndex++;
|
||||||
if (m_copyState->m_curIndex >= m_copyState->m_totalCount)
|
if (m_copyState->m_curIndex >= m_copyState->m_totalCount)
|
||||||
{
|
{
|
||||||
|
@ -2581,7 +2590,6 @@ nsImapMailFolder::OnStopRunningUrl(nsIURI *aUrl, nsresult aExitCode)
|
||||||
ClearCopyState(aExitCode);
|
ClearCopyState(aExitCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UpdateFolder(aWindow);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -3196,8 +3204,6 @@ nsImapMailFolder::CopyFileMessage(nsIFileSpec* fileSpec,
|
||||||
PR_TRUE, isDraftOrTemplate,
|
PR_TRUE, isDraftOrTemplate,
|
||||||
urlListener, nsnull,
|
urlListener, nsnull,
|
||||||
copySupport);
|
copySupport);
|
||||||
if (NS_SUCCEEDED(rv))
|
|
||||||
imapService->SelectFolder(m_eventQueue, this, this, nsnull, nsnull);
|
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче