Bug 439494 folderRenamed nsIMsgFolderListener notification in local folders broken. p=Siddharth Agarwal <sid1337@gmail.com>,r/sr=bienvenu,r=me for tests and subfolder discovery on rename

This commit is contained in:
bugzilla%standard8.plus.com 2008-06-30 13:14:14 +00:00
Родитель f050048035
Коммит 702a4b1612
3 изменённых файлов: 12 добавлений и 10 удалений

Просмотреть файл

@ -123,7 +123,7 @@ var gMFListener =
folderRenamed: function(aOrigFolder, aNewFolder)
{
verify([gEvents.folderRenamed, aOrigFolder, aNewFolder]);
verify([kEvents.folderRenamed, aOrigFolder, aNewFolder]);
if (gExpectedEvents.length == 0)
{
gCurrStatus |= kStatus.notificationsDone;

Просмотреть файл

@ -170,11 +170,10 @@ const gTestArray =
function testDeleteMessages4() { deleteMessages(gLocalTrashFolder, [gMsgHdrs[1].hdr], true, false); },
// Renaming folders
// XXX enable after working out bugs in rename folder
/*function testRename1() { renameFolder(gLocalFolder3, "folder4"); },
function testRename2() { renameFolder(gLocalFolder2.getChildNamed("folder4"), "folder3"); }
function testRename3() { renameFolder(gLocalFolder2, "folder4"); }
function testRename4() { renameFolder(gLocalInboxFolder.getChildNamed("folder4"), "folder2"); }*/
function testRename1() { renameFolder(gLocalFolder3, "folder4"); },
function testRename2() { renameFolder(gLocalFolder2.getChildNamed("folder4"), "folder3"); },
function testRename3() { renameFolder(gLocalFolder2, "folder4"); },
function testRename4() { renameFolder(gLocalInboxFolder.getChildNamed("folder4"), "folder2"); },
// Deleting folders (currently only one folder delete is supported through the UI)
function deleteFolder1() { deleteFolder(gLocalInboxFolder.getChildNamed("folder3")); },

Просмотреть файл

@ -1143,6 +1143,9 @@ NS_IMETHODIMP nsMsgLocalMailFolder::Rename(const nsAString& aNewName, nsIMsgWind
if (count > 0)
newFolder->RenameSubFolders(msgWindow, this);
// Discover the subfolders inside this folder (this is recursive)
newFolder->GetSubFolders(nsnull);
// the newFolder should have the same flags
newFolder->SetFlags(mFlags);
if (parentFolder)
@ -1154,6 +1157,10 @@ NS_IMETHODIMP nsMsgLocalMailFolder::Rename(const nsAString& aNewName, nsIMsgWind
SetFilePath(nsnull); // forget our path, since this folder object renamed itself
folderRenameAtom = do_GetAtom("RenameCompleted");
newFolder->NotifyFolderEvent(folderRenameAtom);
nsCOMPtr<nsIMsgFolderNotificationService> notifier(do_GetService(NS_MSGNOTIFICATIONSERVICE_CONTRACTID));
if (notifier)
notifier->NotifyFolderRenamed(this, newFolder);
}
}
return rv;
@ -1164,10 +1171,6 @@ NS_IMETHODIMP nsMsgLocalMailFolder::RenameSubFolders(nsIMsgWindow *msgWindow, ns
nsresult rv =NS_OK;
mInitialized = PR_TRUE;
nsCOMPtr<nsIMsgFolderNotificationService> notifier(do_GetService(NS_MSGNOTIFICATIONSERVICE_CONTRACTID));
if (notifier)
notifier->NotifyFolderRenamed(oldFolder, this);
PRUint32 flags;
oldFolder->GetFlags(&flags);
SetFlags(flags);