diff --git a/mailnews/base/util/nsMsgDBFolder.cpp b/mailnews/base/util/nsMsgDBFolder.cpp index c1e521618707..7a4ce8f3c335 100644 --- a/mailnews/base/util/nsMsgDBFolder.cpp +++ b/mailnews/base/util/nsMsgDBFolder.cpp @@ -83,6 +83,7 @@ NS_IMETHODIMP nsMsgDBFolder::EndFolderLoading(void) if(mDatabase) mDatabase->AddListener(this); mAddListener = PR_TRUE; + UpdateSummaryTotals(PR_FALSE); return NS_OK; } diff --git a/mailnews/base/util/nsMsgFolder.cpp b/mailnews/base/util/nsMsgFolder.cpp index 326713c499c1..073f81fdcbf1 100644 --- a/mailnews/base/util/nsMsgFolder.cpp +++ b/mailnews/base/util/nsMsgFolder.cpp @@ -897,7 +897,7 @@ NS_IMETHODIMP nsMsgFolder::GetNumUnread(PRBool deep, PRInt32 *numUnread) return NS_ERROR_NULL_POINTER; nsresult rv; - PRUint32 total = mNumUnreadMessages; + PRUint32 total = mNumUnreadMessages + mNumPendingUnreadMessages; if (deep) { nsCOMPtr folder; @@ -930,7 +930,7 @@ NS_IMETHODIMP nsMsgFolder::GetTotalMessages(PRBool deep, PRInt32 *totalMessages) return NS_ERROR_NULL_POINTER; nsresult rv; - PRInt32 total = mNumTotalMessages; + PRInt32 total = mNumTotalMessages + mNumPendingTotalMessages; if (deep) { nsCOMPtr folder; @@ -960,18 +960,33 @@ NS_IMETHODIMP nsMsgFolder::GetTotalMessages(PRBool deep, PRInt32 *totalMessages) NS_IMETHOD GetTotalMessagesInDB(PRUint32 *totalMessages) const; // How many messages in database. #endif +PRInt32 nsMsgFolder::GetNumPendingUnread() +{ + return mNumPendingUnreadMessages; +} + +PRInt32 nsMsgFolder::GetNumPendingTotalMessages() +{ + return mNumPendingTotalMessages; +} + + +void nsMsgFolder::ChangeNumPendingUnread(PRInt32 delta) +{ + mNumPendingTotalMessages += delta; +} + +void nsMsgFolder::ChangeNumPendingTotalMessages(PRInt32 delta) +{ + mNumPendingTotalMessages += delta; +} + #ifdef HAVE_DB // These functions are used for tricking the front end into thinking that we have more // messages than are really in the DB. This is usually after and IMAP message copy where // we don't want to do an expensive select until the user actually opens that folder // These functions are called when MSG_Master::GetFolderLineById is populating a MSG_FolderLine // struct used by the FE -int32 GetNumPendingUnread(PRBool deep = PR_FALSE) const; -int32 GetNumPendingTotalMessages(PRBool deep = PR_FALSE) const; - -void ChangeNumPendingUnread(int32 delta); -void ChangeNumPendingTotalMessages(int32 delta); - NS_IMETHODIMP nsMsgFolder::SetFolderPrefFlags(PRUint32 flags) { diff --git a/mailnews/base/util/nsMsgFolder.h b/mailnews/base/util/nsMsgFolder.h index d92b71de6acf..5674cf6e6401 100644 --- a/mailnews/base/util/nsMsgFolder.h +++ b/mailnews/base/util/nsMsgFolder.h @@ -150,24 +150,24 @@ public: // created string that must be free'd using XP_FREE(). // If the db is NULL, then returns a URL that represents the entire // folder as a whole. + // These functions are used for tricking the front end into thinking that we have more + // messages than are really in the DB. This is usually after and IMAP message copy where + // we don't want to do an expensive select until the user actually opens that folder + // These functions are called when MSG_Master::GetFolderLineById is populating a MSG_FolderLine + // struct used by the FE + PRInt32 GetNumPendingUnread(); + PRInt32 GetNumPendingTotalMessages(); + + void ChangeNumPendingUnread(PRInt32 delta); + void ChangeNumPendingTotalMessages(PRInt32 delta); + + #ifdef HAVE_DB NS_IMETHOD BuildUrl(nsMsgDatabase *db, nsMsgKey key, char ** url); // updates num messages and num unread - should be pure virtual // when I get around to implementing in all subclasses? NS_IMETHOD GetTotalMessagesInDB(PRUint32 *totalMessages) const; // How many messages in database. - // These functions are used for tricking the front end into thinking that we have more - // messages than are really in the DB. This is usually after and IMAP message copy where - // we don't want to do an expensive select until the user actually opens that folder - // These functions are called when MSG_Master::GetFolderLineById is populating a MSG_FolderLine - // struct used by the FE - int32 GetNumPendingUnread(PRBool deep = PR_FALSE); - int32 GetNumPendingTotalMessages(PRBool deep = PR_FALSE); - - void ChangeNumPendingUnread(int32 delta); - void ChangeNumPendingTotalMessages(int32 delta); - - NS_IMETHOD SetFolderPrefFlags(PRUint32 flags); NS_IMETHOD GetFolderPrefFlags(PRUint32 *flags); diff --git a/mailnews/base/util/nsMsgIncomingServer.cpp b/mailnews/base/util/nsMsgIncomingServer.cpp index 6cf11cc7e5df..8aa9de34e46c 100644 --- a/mailnews/base/util/nsMsgIncomingServer.cpp +++ b/mailnews/base/util/nsMsgIncomingServer.cpp @@ -381,7 +381,7 @@ nsMsgIncomingServer::SetCharValue(const char *prefname, rv = m_prefs->SetCharPref(fullPrefName, val); PR_FREEIF(defaultVal); - PR_Free(fullPrefName); + PR_smprintf_free(fullPrefName); return rv; }