add folder notifications for rename, and for when imap messages are deleted, sr=mscott, 290057

This commit is contained in:
bienvenu%nventure.com 2007-08-14 20:25:56 +00:00
Родитель 823348af4c
Коммит 5890c2b035
4 изменённых файлов: 33 добавлений и 4 удалений

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

@ -49,6 +49,8 @@ interface nsIMsgFolderNotificationService : nsISupports {
void removeListener(in nsIMsgFolderListener aListener);
void notifyItemAdded(in nsISupports aItem);
// for the convenience of the callers, we allow this to be an nsISupportsArray of items,
// or an individual nsISupports.
void notifyItemDeleted(in nsISupports aItem);
void notifyItemMoveCopyCompleted(in boolean aMove,
in nsISupportsArray aSrcItems,

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

@ -38,7 +38,7 @@
#include "msgCore.h"
#include "nsMsgFolderNotificationService.h"
#include "nsISupportsArray.h"
//
// nsMsgFolderNotificationService
@ -102,13 +102,27 @@ NS_IMETHODIMP nsMsgFolderNotificationService::NotifyItemDeleted(nsISupports *aIt
{
PRInt32 count = m_listeners.Count();
// this might be an array of items - use QI to find out.
nsCOMPtr <nsISupportsArray> itemArray = do_QueryInterface(aItem);
for(PRInt32 i = 0; i < count; i++)
{
nsCOMPtr<nsIMsgFolderListener> listener = m_listeners[i];
NS_ASSERTION(listener, "listener is null");
if (!listener)
return NS_ERROR_FAILURE;
listener->ItemDeleted(aItem);
if (itemArray)
{
PRUint32 cnt;
itemArray->Count(&cnt);
for (PRUint32 i = 0; i < cnt; i++)
{
nsCOMPtr <nsISupports> supports = do_QueryElementAt(itemArray, i);
if (supports)
listener->ItemDeleted(supports);
}
}
else
listener->ItemDeleted(aItem);
}
return NS_OK;

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

@ -2069,6 +2069,12 @@ NS_IMETHODIMP nsImapMailFolder::DeleteMessages(nsISupportsArray *messages,
deleteImmediatelyNoTrash = PR_TRUE;
}
}
else
{
nsCOMPtr <nsIMsgFolderNotificationService> notifier = do_GetService(NS_MSGNOTIFICATIONSERVICE_CONTRACTID);
if (notifier)
notifier->NotifyItemDeleted(messages);
}
if ((NS_SUCCEEDED(rv) && deleteImmediatelyNoTrash) || deleteModel == nsMsgImapDeleteModels::IMAPDelete )
{
@ -3113,7 +3119,7 @@ NS_IMETHODIMP nsImapMailFolder::ApplyFilterHit(nsIMsgFilter *filter, nsIMsgWindo
m_msgMovedByFilter = PR_TRUE;
}
// don't apply any more filters, even if it was a move to the same folder
*applyMore = PR_FALSE;
*applyMore = PR_FALSE;
}
break;
case nsMsgFilterAction::CopyToFolder:
@ -7273,7 +7279,7 @@ NS_IMETHODIMP nsImapMailFolder::RenameClient(nsIMsgWindow *msgWindow, nsIMsgFold
oldImapFolder->GetHierarchyDelimiter(&hierarchyDelimiter);
PRInt32 boxflags=0;
oldImapFolder->GetBoxFlags(&boxflags);
nsAutoString newLeafName;
nsAutoString newNameString;
CopyASCIItoUTF16(newName, newNameString);
@ -7360,6 +7366,9 @@ NS_IMETHODIMP nsImapMailFolder::RenameClient(nsIMsgWindow *msgWindow, nsIMsgFold
nsCOMPtr <nsIMsgImapMailFolder> oldImapFolder = do_QueryInterface(msgFolder);
if (oldImapFolder)
oldImapFolder->SetVerifiedAsOnlineFolder(PR_FALSE);
nsCOMPtr <nsIMsgFolderNotificationService> notifier = do_GetService(NS_MSGNOTIFICATIONSERVICE_CONTRACTID);
if (notifier)
notifier->NotifyFolderRenamed(msgFolder, child);
NotifyItemAdded(child);
}
return rv;

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

@ -1160,6 +1160,10 @@ 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);