Bug 1513267 - rename nsIMsgFolder::Delete method to deleteStorage (what it really does) and document the other folder deleting methods. r=jorgk
This commit is contained in:
Родитель
20bdef0761
Коммит
15e3219c6d
|
@ -129,8 +129,8 @@ function setupModule(module) {
|
|||
}
|
||||
|
||||
function teardownModule(module) {
|
||||
folderA.Delete();
|
||||
folderB.Delete();
|
||||
folderA.server.rootFolder.propagateDelete(folderA, true, null);
|
||||
folderB.server.rootFolder.propagateDelete(folderB, true, null);
|
||||
Services.prefs.clearUserPref("calendar.integration.notify");
|
||||
}
|
||||
|
||||
|
|
|
@ -177,11 +177,39 @@ interface nsIMsgFolder : nsISupports {
|
|||
*/
|
||||
void closeAndBackupFolderDB(in ACString newName);
|
||||
|
||||
void Delete();
|
||||
|
||||
/**
|
||||
* Delete the backing store of the folder, but not the folder itself.
|
||||
*/
|
||||
[noscript]
|
||||
void deleteStorage();
|
||||
|
||||
/**
|
||||
* Delete the given subfolders of this folder.
|
||||
*
|
||||
* @param folders an array of subfolders to delete
|
||||
* @param msgWindow msgWindow to display status feedback in
|
||||
*/
|
||||
void deleteSubFolders(in nsIArray folders, in nsIMsgWindow msgWindow);
|
||||
|
||||
/**
|
||||
* Delete the given subfolder of this folder.
|
||||
* It does not need to be a direct child.
|
||||
*
|
||||
* @param folder a child subfolder to delete
|
||||
* @param deleteStorage whether to also delete the folder storage on disk
|
||||
* @param msgWindow msgWindow to display status feedback in
|
||||
*/
|
||||
void propagateDelete(in nsIMsgFolder folder, in boolean deleteStorage,
|
||||
in nsIMsgWindow msgWindow);
|
||||
|
||||
/**
|
||||
* Delete the folder and all of its subfolders.
|
||||
*
|
||||
* @param deleteStorage whether to also delete the folder storage on disk
|
||||
* @param msgWindow msgWindow to display status feedback in
|
||||
*/
|
||||
[noscript]
|
||||
void recursiveDelete(in boolean deleteStorage, in nsIMsgWindow msgWindow);
|
||||
|
||||
/**
|
||||
|
|
|
@ -3340,7 +3340,7 @@ NS_IMETHODIMP nsMsgDBFolder::GetShowDeletedMessages(bool *showDeletedMessages) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDBFolder::Delete() {
|
||||
NS_IMETHODIMP nsMsgDBFolder::DeleteStorage() {
|
||||
ForceDBClosed();
|
||||
|
||||
// Delete the .msf file.
|
||||
|
@ -3363,9 +3363,7 @@ NS_IMETHODIMP nsMsgDBFolder::Delete() {
|
|||
nsCOMPtr<nsIMsgPluggableStore> msgStore;
|
||||
rv = GetMsgStore(getter_AddRefs(msgStore));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = msgStore->DeleteFolder(this);
|
||||
|
||||
return rv;
|
||||
return msgStore->DeleteFolder(this);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDBFolder::DeleteSubFolders(nsIArray *folders,
|
||||
|
@ -3419,10 +3417,11 @@ NS_IMETHODIMP nsMsgDBFolder::RecursiveDelete(bool deleteStorage,
|
|||
// and all its subfolders.
|
||||
// Regardless of deleteStorage, always unlinks them from the children lists
|
||||
// and frees memory for the subfolders but NOT for _this_
|
||||
// and does not remove _this_ from the parent's list of children.
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsresult status = NS_OK;
|
||||
nsCOMPtr<nsIFile> dbPath;
|
||||
|
||||
// first remove the deleted folder from the folder cache;
|
||||
nsresult result = GetFolderCacheKey(getter_AddRefs(dbPath));
|
||||
|
||||
|
@ -3443,8 +3442,8 @@ NS_IMETHODIMP nsMsgDBFolder::RecursiveDelete(bool deleteStorage,
|
|||
nsIMsgFolder *child = mSubFolders[0];
|
||||
|
||||
child->SetParent(nullptr);
|
||||
status = child->RecursiveDelete(deleteStorage, msgWindow); // recur
|
||||
if (NS_SUCCEEDED(status))
|
||||
rv = child->RecursiveDelete(deleteStorage, msgWindow);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
// unlink it from this child's list
|
||||
mSubFolders.RemoveObjectAt(0);
|
||||
else {
|
||||
|
@ -3457,16 +3456,16 @@ NS_IMETHODIMP nsMsgDBFolder::RecursiveDelete(bool deleteStorage,
|
|||
}
|
||||
|
||||
// now delete the disk storage for _this_
|
||||
if (deleteStorage && NS_SUCCEEDED(status)) {
|
||||
if (deleteStorage && NS_SUCCEEDED(rv)) {
|
||||
// All delete commands use deleteStorage = true, and local moves use false.
|
||||
// IMAP moves use true, leaving this here in the hope that bug 439108
|
||||
// works out.
|
||||
nsCOMPtr<nsIMsgFolderNotificationService> notifier(
|
||||
do_GetService(NS_MSGNOTIFICATIONSERVICE_CONTRACTID));
|
||||
if (notifier) notifier->NotifyFolderDeleted(this);
|
||||
status = Delete();
|
||||
rv = DeleteStorage();
|
||||
}
|
||||
return status;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDBFolder::CreateSubfolder(const nsAString &folderName,
|
||||
|
|
|
@ -958,7 +958,7 @@ NS_IMETHODIMP nsImapMailFolder::RemoveSubFolder(nsIMsgFolder *which) {
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
folders->AppendElement(folderSupport);
|
||||
rv = nsMsgDBFolder::DeleteSubFolders(folders, nullptr);
|
||||
which->Delete();
|
||||
which->DeleteStorage();
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -1397,7 +1397,7 @@ NS_IMETHODIMP nsImapMailFolder::EmptyTrash(nsIMsgWindow *aMsgWindow,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// Bulk-delete all the messages by deleting the msf file and storage.
|
||||
// This is a little kludgy.
|
||||
rv = trashFolder->Delete();
|
||||
rv = trashFolder->DeleteStorage();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
trashFolder->SetDBTransferInfo(transferInfo);
|
||||
trashFolder->SetSizeOnDisk(0);
|
||||
|
@ -1412,8 +1412,8 @@ NS_IMETHODIMP nsImapMailFolder::EmptyTrash(nsIMsgWindow *aMsgWindow,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapMailFolder::Delete() {
|
||||
nsresult rv = nsMsgDBFolder::Delete();
|
||||
NS_IMETHODIMP nsImapMailFolder::DeleteStorage() {
|
||||
nsresult rv = nsMsgDBFolder::DeleteStorage();
|
||||
|
||||
// Should notify nsIMsgFolderListeners about the folder getting deleted?
|
||||
return rv;
|
||||
|
@ -7342,9 +7342,7 @@ nsImapMailFolder::CopyFolder(nsIMsgFolder *srcFolder, bool isMoveFolder,
|
|||
srcFolder, false, msgWindow); // The files have already been moved,
|
||||
// so delete storage false
|
||||
oldPathFile->Remove(false); // berkeley mailbox
|
||||
nsCOMPtr<nsIMsgDatabase>
|
||||
srcDB; // we need to force closed the source db
|
||||
srcFolder->Delete();
|
||||
srcFolder->DeleteStorage();
|
||||
|
||||
nsCOMPtr<nsIFile> parentPathFile;
|
||||
rv = msgParent->GetFilePath(getter_AddRefs(parentPathFile));
|
||||
|
|
|
@ -231,7 +231,7 @@ class nsImapMailFolder : public nsMsgDBFolder,
|
|||
nsIInputStream *aIStream, int32_t aLength,
|
||||
nsIOutputStream *outputStream) override;
|
||||
NS_IMETHOD CopyDataDone() override;
|
||||
NS_IMETHOD Delete() override;
|
||||
NS_IMETHOD DeleteStorage() override;
|
||||
NS_IMETHOD Rename(const nsAString &newName, nsIMsgWindow *msgWindow) override;
|
||||
NS_IMETHOD RenameSubFolders(nsIMsgWindow *msgWindow,
|
||||
nsIMsgFolder *oldFolder) override;
|
||||
|
|
|
@ -517,9 +517,7 @@ NS_IMETHODIMP nsMsgBrkMBoxStore::CopyFolder(
|
|||
// The files have already been moved, so delete storage false
|
||||
msgParent->PropagateDelete(aSrcFolder, false, aMsgWindow);
|
||||
oldPath->Remove(false); // berkeley mailbox
|
||||
// We need to force closed the source db
|
||||
nsCOMPtr<nsIMsgDatabase> srcDB;
|
||||
aSrcFolder->Delete();
|
||||
aSrcFolder->DeleteStorage();
|
||||
|
||||
nsCOMPtr<nsIFile> parentPath;
|
||||
rv = msgParent->GetFilePath(getter_AddRefs(parentPath));
|
||||
|
@ -545,8 +543,7 @@ NS_IMETHODIMP nsMsgBrkMBoxStore::CopyFolder(
|
|||
newMsgFolder->SetParent(nullptr);
|
||||
if (msgParent) {
|
||||
msgParent->PropagateDelete(newMsgFolder, false, aMsgWindow);
|
||||
newMsgFolder->Delete();
|
||||
newMsgFolder->ForceDBClosed();
|
||||
newMsgFolder->DeleteStorage();
|
||||
AddDirectorySeparator(newPath);
|
||||
newPath->Remove(true); // berkeley mailbox
|
||||
}
|
||||
|
|
|
@ -520,8 +520,7 @@ NS_IMETHODIMP nsMsgMaildirStore::CopyFolder(
|
|||
// The files have already been moved, so delete storage false
|
||||
msgParent->PropagateDelete(aSrcFolder, false, aMsgWindow);
|
||||
oldPath->Remove(true);
|
||||
nsCOMPtr<nsIMsgDatabase> srcDB; // we need to force closed the source db
|
||||
aSrcFolder->Delete();
|
||||
aSrcFolder->DeleteStorage();
|
||||
|
||||
nsCOMPtr<nsIFile> parentPath;
|
||||
rv = msgParent->GetFilePath(getter_AddRefs(parentPath));
|
||||
|
@ -547,8 +546,7 @@ NS_IMETHODIMP nsMsgMaildirStore::CopyFolder(
|
|||
newMsgFolder->SetParent(nullptr);
|
||||
if (msgParent) {
|
||||
msgParent->PropagateDelete(newMsgFolder, false, aMsgWindow);
|
||||
newMsgFolder->Delete();
|
||||
newMsgFolder->ForceDBClosed();
|
||||
newMsgFolder->DeleteStorage();
|
||||
AddDirectorySeparator(newPath);
|
||||
newPath->Remove(true); // berkeley mailbox
|
||||
}
|
||||
|
|
|
@ -440,8 +440,8 @@ NS_IMETHODIMP nsMsgNewsFolder::CreateSubfolder(const nsAString &newsgroupName,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgNewsFolder::Delete() {
|
||||
nsresult rv = nsMsgDBFolder::Delete();
|
||||
NS_IMETHODIMP nsMsgNewsFolder::DeleteStorage() {
|
||||
nsresult rv = nsMsgDBFolder::DeleteStorage();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsINntpIncomingServer> nntpServer;
|
||||
|
|
|
@ -38,7 +38,7 @@ class nsMsgNewsFolder : public nsMsgDBFolder, public nsIMsgNewsFolder {
|
|||
NS_IMETHOD CreateSubfolder(const nsAString &folderName,
|
||||
nsIMsgWindow *msgWindow) override;
|
||||
|
||||
NS_IMETHOD Delete() override;
|
||||
NS_IMETHOD DeleteStorage() override;
|
||||
NS_IMETHOD Rename(const nsAString &newName, nsIMsgWindow *msgWindow) override;
|
||||
|
||||
NS_IMETHOD GetAbbreviatedName(nsAString &aAbbreviatedName) override;
|
||||
|
|
Загрузка…
Ссылка в новой задаче