fixed bug 25988 -- IMAP Subfolders appearing at 1st level instead of 2nd level; bug 26061 -- Rename a pop3 folder and its subfolders disappear; a=phil,r=bienvenu

This commit is contained in:
jefft%netscape.com 2000-03-01 05:17:53 +00:00
parent f4cd0a1c67
commit 8142d351ad
5 changed files with 30 additions and 27 deletions

View File

@ -116,6 +116,33 @@ NS_IMETHODIMP nsMsgDBFolder::Shutdown(PRBool shutdownChildren)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsMsgDBFolder::ForceDBClosed ()
{
PRUint32 cnt = 0, i;
if (mSubFolders)
{
nsCOMPtr<nsISupports> aSupport;
nsCOMPtr<nsIMsgFolder> child;
mSubFolders->Count(&cnt);
if (cnt > 0)
for (i = 0; i < cnt; i++)
{
aSupport = getter_AddRefs(mSubFolders->ElementAt(i));
child = do_QueryInterface(aSupport);
if (child)
child->ForceDBClosed();
}
}
if (mDatabase)
{
mDatabase->ForceClosed();
mDatabase = null_nsCOMPtr();
}
return NS_OK;
}
NS_IMETHODIMP nsMsgDBFolder::StartFolderLoading(void) NS_IMETHODIMP nsMsgDBFolder::StartFolderLoading(void)
{ {
if(mDatabase) if(mDatabase)

View File

@ -74,6 +74,7 @@ public:
NS_IMETHOD MarkAllMessagesRead(void); NS_IMETHOD MarkAllMessagesRead(void);
NS_IMETHOD Shutdown(PRBool shutdownChildren); NS_IMETHOD Shutdown(PRBool shutdownChildren);
NS_IMETHOD ForceDBClosed();
protected: protected:
virtual nsresult ReadDBFolderInfo(PRBool force); virtual nsresult ReadDBFolderInfo(PRBool force);

View File

@ -655,6 +655,7 @@ NS_IMETHODIMP nsImapMailFolder::CreateClientSubfolderInfo(const char *folderName
onlineName += folderNameStr; onlineName += folderNameStr;
imapFolder->SetVerifiedAsOnlineFolder(PR_TRUE); imapFolder->SetVerifiedAsOnlineFolder(PR_TRUE);
imapFolder->SetOnlineName(onlineName.GetBuffer()); imapFolder->SetOnlineName(onlineName.GetBuffer());
imapFolder->SetHierarchyDelimiter(hierarchyDelimiter);
} }
unusedDB->SetSummaryValid(PR_TRUE); unusedDB->SetSummaryValid(PR_TRUE);
@ -906,31 +907,6 @@ NS_IMETHODIMP nsImapMailFolder::Rename (const PRUnichar *newName)
return rv; return rv;
} }
NS_IMETHODIMP nsImapMailFolder::ForceDBClosed()
{
PRUint32 cnt = 0, i;
if (mSubFolders)
{
nsCOMPtr<nsISupports> aSupport;
nsCOMPtr<nsIMsgFolder> child;
mSubFolders->Count(&cnt);
if (cnt > 0)
for (i = 0; i < cnt; i++)
{
aSupport = getter_AddRefs(mSubFolders->ElementAt(i));
child = do_QueryInterface(aSupport);
if (child)
child->ForceDBClosed();
}
}
if (mDatabase)
{
mDatabase->ForceClosed();
mDatabase = null_nsCOMPtr();
}
return NS_OK;
}
NS_IMETHODIMP NS_IMETHODIMP
nsImapMailFolder::RenameLocal(const char *newName) nsImapMailFolder::RenameLocal(const char *newName)
{ {

View File

@ -118,7 +118,6 @@ public:
NS_IMETHOD CreateSubfolder(const PRUnichar *folderName); NS_IMETHOD CreateSubfolder(const PRUnichar *folderName);
NS_IMETHOD AddSubfolder(nsAutoString *name, nsIMsgFolder **child); NS_IMETHOD AddSubfolder(nsAutoString *name, nsIMsgFolder **child);
NS_IMETHOD ForceDBClosed();
NS_IMETHOD Compact(); NS_IMETHOD Compact();
NS_IMETHOD EmptyTrash(nsIMsgWindow *msgWindow); NS_IMETHOD EmptyTrash(nsIMsgWindow *msgWindow);
NS_IMETHOD Delete (); NS_IMETHOD Delete ();

View File

@ -768,7 +768,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::Rename(const PRUnichar *aNewName)
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
rv = GetParent(getter_AddRefs(parent)); rv = GetParent(getter_AddRefs(parent));
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
Shutdown(PR_TRUE); ForceDBClosed();
nsCOMPtr<nsIMsgFolder> parentFolder = do_QueryInterface(parent); nsCOMPtr<nsIMsgFolder> parentFolder = do_QueryInterface(parent);
nsCOMPtr<nsISupports> parentSupport = do_QueryInterface(parent); nsCOMPtr<nsISupports> parentSupport = do_QueryInterface(parent);