зеркало из https://github.com/mozilla/pjs.git
consolidate nsIMsgMailSession and nsIFolderListener by simply making nsMsgMailSession implement nsIFolderListener instead of having it's own API. r=scottip
This commit is contained in:
Родитель
7621cc570e
Коммит
c3b39881e4
|
@ -46,35 +46,7 @@ interface nsIMsgMailSession : nsISupports {
|
|||
void Shutdown();
|
||||
void AddFolderListener(in nsIFolderListener listener);
|
||||
void RemoveFolderListener(in nsIFolderListener listener);
|
||||
void NotifyFolderItemPropertyChanged(in nsISupports item,
|
||||
in nsIAtom property,
|
||||
in string oldValue,
|
||||
in string newValue);
|
||||
void NotifyFolderItemIntPropertyChanged(in nsISupports item,
|
||||
in nsIAtom property,
|
||||
in long oldValue,
|
||||
in long newValue);
|
||||
void NotifyFolderItemBoolPropertyChanged(in nsISupports item,
|
||||
in nsIAtom property,
|
||||
in boolean oldValue,
|
||||
in boolean newValue);
|
||||
void NotifyFolderItemPropertyFlagChanged(in nsISupports item,
|
||||
in nsIAtom property,
|
||||
in unsigned long oldValue,
|
||||
in unsigned long newValue);
|
||||
void NotifyFolderItemUnicharPropertyChanged(in nsISupports item,
|
||||
in nsIAtom property,
|
||||
in wstring oldValue,
|
||||
in wstring newValue);
|
||||
|
||||
void NotifyFolderItemAdded(in nsISupports parentItem, in nsISupports item, in string viewString);
|
||||
void NotifyFolderItemDeleted(in nsISupports parentItem, in nsISupports item, in string viewString);
|
||||
|
||||
void NotifyFolderEvent(in nsIFolder folder, in nsIAtom event);
|
||||
|
||||
void NotifyFolderLoaded(in nsIFolder folder);
|
||||
void NotifyDeleteOrMoveMessagesCompleted(in nsIFolder folder);
|
||||
|
||||
readonly attribute nsIMsgWindow topmostMsgWindow;
|
||||
void AddMsgWindow(in nsIMsgWindow msgWindow);
|
||||
void RemoveMsgWindow(in nsIMsgWindow msgWindow);
|
||||
|
|
|
@ -34,8 +34,14 @@
|
|||
#include "nsIURI.h"
|
||||
#include "nsXPIDLString.h"
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsMsgMailSession, nsIMsgMailSession);
|
||||
|
||||
NS_IMPL_THREADSAFE_ADDREF(nsMsgMailSession)
|
||||
NS_IMPL_THREADSAFE_RELEASE(nsMsgMailSession)
|
||||
NS_INTERFACE_MAP_BEGIN(nsMsgMailSession)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIMsgMailSession)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIFolderListener)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIMsgMailSession)
|
||||
NS_INTERFACE_MAP_END_THREADSAFE
|
||||
|
||||
static NS_DEFINE_IID(kIFileLocatorIID, NS_IFILELOCATOR_IID);
|
||||
static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID);
|
||||
|
||||
|
@ -85,10 +91,10 @@ NS_IMETHODIMP nsMsgMailSession::RemoveFolderListener(nsIFolderListener * listene
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgMailSession::NotifyFolderItemPropertyChanged(nsISupports *item,
|
||||
nsIAtom *property,
|
||||
const char* oldValue,
|
||||
const char* newValue)
|
||||
nsMsgMailSession::OnItemPropertyChanged(nsISupports *item,
|
||||
nsIAtom *property,
|
||||
const char* oldValue,
|
||||
const char* newValue)
|
||||
{
|
||||
nsresult rv;
|
||||
PRUint32 count;
|
||||
|
@ -107,10 +113,10 @@ nsMsgMailSession::NotifyFolderItemPropertyChanged(nsISupports *item,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgMailSession::NotifyFolderItemUnicharPropertyChanged(nsISupports *item,
|
||||
nsIAtom *property,
|
||||
const PRUnichar* oldValue,
|
||||
const PRUnichar* newValue)
|
||||
nsMsgMailSession::OnItemUnicharPropertyChanged(nsISupports *item,
|
||||
nsIAtom *property,
|
||||
const PRUnichar* oldValue,
|
||||
const PRUnichar* newValue)
|
||||
{
|
||||
nsresult rv;
|
||||
PRUint32 count;
|
||||
|
@ -129,7 +135,7 @@ nsMsgMailSession::NotifyFolderItemUnicharPropertyChanged(nsISupports *item,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgMailSession::NotifyFolderItemIntPropertyChanged(nsISupports *item,
|
||||
nsMsgMailSession::OnItemIntPropertyChanged(nsISupports *item,
|
||||
nsIAtom *property,
|
||||
PRInt32 oldValue,
|
||||
PRInt32 newValue)
|
||||
|
@ -151,10 +157,10 @@ nsMsgMailSession::NotifyFolderItemIntPropertyChanged(nsISupports *item,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgMailSession::NotifyFolderItemBoolPropertyChanged(nsISupports *item,
|
||||
nsIAtom *property,
|
||||
PRBool oldValue,
|
||||
PRBool newValue)
|
||||
nsMsgMailSession::OnItemBoolPropertyChanged(nsISupports *item,
|
||||
nsIAtom *property,
|
||||
PRBool oldValue,
|
||||
PRBool newValue)
|
||||
{
|
||||
nsresult rv;
|
||||
PRUint32 count;
|
||||
|
@ -172,10 +178,10 @@ nsMsgMailSession::NotifyFolderItemBoolPropertyChanged(nsISupports *item,
|
|||
|
||||
}
|
||||
NS_IMETHODIMP
|
||||
nsMsgMailSession::NotifyFolderItemPropertyFlagChanged(nsISupports *item,
|
||||
nsIAtom *property,
|
||||
PRUint32 oldValue,
|
||||
PRUint32 newValue)
|
||||
nsMsgMailSession::OnItemPropertyFlagChanged(nsISupports *item,
|
||||
nsIAtom *property,
|
||||
PRUint32 oldValue,
|
||||
PRUint32 newValue)
|
||||
{
|
||||
nsresult rv;
|
||||
PRUint32 count;
|
||||
|
@ -193,7 +199,7 @@ nsMsgMailSession::NotifyFolderItemPropertyFlagChanged(nsISupports *item,
|
|||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgMailSession::NotifyFolderItemAdded(nsISupports *parentItem, nsISupports *item, const char* viewString)
|
||||
NS_IMETHODIMP nsMsgMailSession::OnItemAdded(nsISupports *parentItem, nsISupports *item, const char* viewString)
|
||||
{
|
||||
nsresult rv;
|
||||
PRUint32 count;
|
||||
|
@ -211,7 +217,7 @@ NS_IMETHODIMP nsMsgMailSession::NotifyFolderItemAdded(nsISupports *parentItem, n
|
|||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgMailSession::NotifyFolderItemDeleted(nsISupports *parentItem, nsISupports *item, const char* viewString)
|
||||
NS_IMETHODIMP nsMsgMailSession::OnItemRemoved(nsISupports *parentItem, nsISupports *item, const char* viewString)
|
||||
{
|
||||
nsresult rv;
|
||||
PRUint32 count;
|
||||
|
@ -228,7 +234,7 @@ NS_IMETHODIMP nsMsgMailSession::NotifyFolderItemDeleted(nsISupports *parentItem,
|
|||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgMailSession::NotifyFolderLoaded(nsIFolder *folder)
|
||||
NS_IMETHODIMP nsMsgMailSession::OnFolderLoaded(nsIFolder *folder)
|
||||
{
|
||||
|
||||
nsresult rv;
|
||||
|
@ -247,7 +253,7 @@ NS_IMETHODIMP nsMsgMailSession::NotifyFolderLoaded(nsIFolder *folder)
|
|||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgMailSession::NotifyDeleteOrMoveMessagesCompleted(nsIFolder *folder)
|
||||
NS_IMETHODIMP nsMsgMailSession::OnDeleteOrMoveMessagesCompleted(nsIFolder *folder)
|
||||
{
|
||||
|
||||
nsresult rv;
|
||||
|
@ -264,7 +270,7 @@ NS_IMETHODIMP nsMsgMailSession::NotifyDeleteOrMoveMessagesCompleted(nsIFolder *
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgMailSession::NotifyFolderEvent(nsIFolder *aFolder,
|
||||
NS_IMETHODIMP nsMsgMailSession::OnItemEvent(nsIFolder *aFolder,
|
||||
nsIAtom *aEvent)
|
||||
{
|
||||
nsresult rv;
|
||||
|
|
|
@ -39,7 +39,8 @@
|
|||
// cruft in it....
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsMsgMailSession : public nsIMsgMailSession
|
||||
class nsMsgMailSession : public nsIMsgMailSession,
|
||||
public nsIFolderListener
|
||||
{
|
||||
public:
|
||||
nsMsgMailSession();
|
||||
|
@ -47,6 +48,7 @@ public:
|
|||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIMSGMAILSESSION
|
||||
NS_DECL_NSIFOLDERLISTENER
|
||||
|
||||
nsresult Init();
|
||||
protected:
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
#include "nsRDFCID.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIMsgMailSession.h"
|
||||
#include "nsIMsgAccountManager.h"
|
||||
#include "nsIMsgIdentity.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
|
@ -49,7 +48,7 @@
|
|||
|
||||
static NS_DEFINE_CID(kStandardUrlCID, NS_STANDARDURL_CID);
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID);
|
||||
static NS_DEFINE_CID(kMsgFolderListenerManagerCID, NS_MSGMAILSESSION_CID);
|
||||
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
||||
|
||||
PRInt32 nsMsgFolder::gInstanceCount = 0;
|
||||
|
@ -74,8 +73,8 @@ nsMsgFolder::nsMsgFolder(void)
|
|||
mHaveParsedURI(PR_FALSE),
|
||||
mIsServerIsValid(PR_FALSE),
|
||||
mIsServer(PR_FALSE),
|
||||
mBaseMessageURI(nsnull),
|
||||
mDeleteIsMoveToTrash(PR_TRUE)
|
||||
mDeleteIsMoveToTrash(PR_TRUE),
|
||||
mBaseMessageURI(nsnull)
|
||||
{
|
||||
// NS_INIT_REFCNT(); done by superclass
|
||||
|
||||
|
@ -368,7 +367,7 @@ NS_IMETHODIMP nsMsgFolder::SetParent(nsIFolder *aParent)
|
|||
// also set the server itself while we're here.
|
||||
|
||||
nsCOMPtr<nsIMsgIncomingServer> server;
|
||||
nsresult rv = parentMsgFolder->GetServer(getter_AddRefs(server));
|
||||
rv = parentMsgFolder->GetServer(getter_AddRefs(server));
|
||||
if (NS_SUCCEEDED(rv) && server)
|
||||
mServer = getter_AddRefs(NS_GetWeakReference(server));
|
||||
}
|
||||
|
@ -2076,9 +2075,9 @@ nsMsgFolder::NotifyPropertyChanged(nsIAtom *property,
|
|||
|
||||
//Notify listeners who listen to every folder
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kMsgMailSessionCID, &rv);
|
||||
NS_WITH_SERVICE(nsIFolderListener, folderListenerManager, kMsgFolderListenerManagerCID, &rv);
|
||||
if(NS_SUCCEEDED(rv))
|
||||
mailSession->NotifyFolderItemPropertyChanged(supports, property, oldValue, newValue);
|
||||
folderListenerManager->OnItemPropertyChanged(supports, property, oldValue, newValue);
|
||||
|
||||
}
|
||||
|
||||
|
@ -2105,12 +2104,12 @@ nsMsgFolder::NotifyUnicharPropertyChanged(nsIAtom *property,
|
|||
}
|
||||
|
||||
// Notify listeners who listen to every folder
|
||||
NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kMsgMailSessionCID, &rv);
|
||||
NS_WITH_SERVICE(nsIFolderListener, folderListenerManager, kMsgFolderListenerManagerCID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = mailSession->NotifyFolderItemUnicharPropertyChanged(supports,
|
||||
property,
|
||||
oldValue,
|
||||
newValue);
|
||||
rv = folderListenerManager->OnItemUnicharPropertyChanged(supports,
|
||||
property,
|
||||
oldValue,
|
||||
newValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2129,9 +2128,9 @@ nsresult nsMsgFolder::NotifyIntPropertyChanged(nsIAtom *property, PRInt32 oldVal
|
|||
|
||||
//Notify listeners who listen to every folder
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kMsgMailSessionCID, &rv);
|
||||
NS_WITH_SERVICE(nsIFolderListener, folderListenerManager, kMsgFolderListenerManagerCID, &rv);
|
||||
if(NS_SUCCEEDED(rv))
|
||||
mailSession->NotifyFolderItemIntPropertyChanged(supports, property, oldValue, newValue);
|
||||
folderListenerManager->OnItemIntPropertyChanged(supports, property, oldValue, newValue);
|
||||
|
||||
}
|
||||
|
||||
|
@ -2156,9 +2155,9 @@ nsMsgFolder::NotifyBoolPropertyChanged(nsIAtom* property,
|
|||
|
||||
//Notify listeners who listen to every folder
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kMsgMailSessionCID, &rv);
|
||||
NS_WITH_SERVICE(nsIFolderListener, folderListenerManager, kMsgFolderListenerManagerCID, &rv);
|
||||
if(NS_SUCCEEDED(rv))
|
||||
mailSession->NotifyFolderItemBoolPropertyChanged(supports, property, oldValue, newValue);
|
||||
folderListenerManager->OnItemBoolPropertyChanged(supports, property, oldValue, newValue);
|
||||
|
||||
}
|
||||
|
||||
|
@ -2180,9 +2179,9 @@ nsMsgFolder::NotifyPropertyFlagChanged(nsISupports *item, nsIAtom *property,
|
|||
|
||||
//Notify listeners who listen to every folder
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kMsgMailSessionCID, &rv);
|
||||
NS_WITH_SERVICE(nsIFolderListener, folderListenerManager, kMsgFolderListenerManagerCID, &rv);
|
||||
if(NS_SUCCEEDED(rv))
|
||||
mailSession->NotifyFolderItemPropertyFlagChanged(item, property, oldValue, newValue);
|
||||
folderListenerManager->OnItemPropertyFlagChanged(item, property, oldValue, newValue);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2204,9 +2203,9 @@ nsresult nsMsgFolder::NotifyItemAdded(nsISupports *parentItem, nsISupports *item
|
|||
|
||||
//Notify listeners who listen to every folder
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kMsgMailSessionCID, &rv);
|
||||
NS_WITH_SERVICE(nsIFolderListener, folderListenerManager, kMsgFolderListenerManagerCID, &rv);
|
||||
if(NS_SUCCEEDED(rv))
|
||||
mailSession->NotifyFolderItemAdded(parentItem, item, viewString);
|
||||
folderListenerManager->OnItemAdded(parentItem, item, viewString);
|
||||
|
||||
return NS_OK;
|
||||
|
||||
|
@ -2224,9 +2223,9 @@ nsresult nsMsgFolder::NotifyItemDeleted(nsISupports *parentItem, nsISupports *it
|
|||
}
|
||||
//Notify listeners who listen to every folder
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kMsgMailSessionCID, &rv);
|
||||
NS_WITH_SERVICE(nsIFolderListener, folderListenerManager, kMsgFolderListenerManagerCID, &rv);
|
||||
if(NS_SUCCEEDED(rv))
|
||||
mailSession->NotifyFolderItemDeleted(parentItem, item, viewString);
|
||||
folderListenerManager->OnItemRemoved(parentItem, item, viewString);
|
||||
|
||||
return NS_OK;
|
||||
|
||||
|
@ -2243,9 +2242,9 @@ nsresult nsMsgFolder::NotifyFolderLoaded()
|
|||
}
|
||||
//Notify listeners who listen to every folder
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kMsgMailSessionCID, &rv);
|
||||
NS_WITH_SERVICE(nsIFolderListener, folderListenerManager, kMsgFolderListenerManagerCID, &rv);
|
||||
if(NS_SUCCEEDED(rv))
|
||||
mailSession->NotifyFolderLoaded(this);
|
||||
folderListenerManager->OnFolderLoaded(this);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2261,9 +2260,9 @@ nsresult nsMsgFolder::NotifyDeleteOrMoveMessagesCompleted(nsIFolder *folder)
|
|||
}
|
||||
//Notify listeners who listen to every folder
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kMsgMailSessionCID, &rv);
|
||||
NS_WITH_SERVICE(nsIFolderListener, folderListenerManager, kMsgFolderListenerManagerCID, &rv);
|
||||
if(NS_SUCCEEDED(rv))
|
||||
mailSession->NotifyDeleteOrMoveMessagesCompleted(folder);
|
||||
folderListenerManager->OnDeleteOrMoveMessagesCompleted(folder);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2279,9 +2278,9 @@ nsresult nsMsgFolder::NotifyFolderEvent(nsIAtom* aEvent)
|
|||
}
|
||||
//Notify listeners who listen to every folder
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kMsgMailSessionCID, &rv);
|
||||
NS_WITH_SERVICE(nsIFolderListener, folderListenerManager, kMsgFolderListenerManagerCID, &rv);
|
||||
if(NS_SUCCEEDED(rv))
|
||||
mailSession->NotifyFolderEvent(this, aEvent);
|
||||
folderListenerManager->OnItemEvent(this, aEvent);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,6 @@
|
|||
#include "nsMsgTxn.h"
|
||||
#include "nsIFileSpec.h"
|
||||
#include "nsIMessenger.h"
|
||||
#include "nsIMsgMailSession.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
#include "nsMsgI18N.h"
|
||||
#include "nsIWebShell.h"
|
||||
|
@ -1956,10 +1955,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::EndMove()
|
|||
nsCOMPtr<nsIFolder> srcFolder = do_QueryInterface(mCopyState->m_srcSupport);
|
||||
if(srcFolder)
|
||||
{
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kMsgMailSessionCID, &rv);
|
||||
if(NS_SUCCEEDED(rv))
|
||||
mailSession->NotifyDeleteOrMoveMessagesCompleted(srcFolder);
|
||||
srcFolder->NotifyDeleteOrMoveMessagesCompleted(srcFolder);
|
||||
}
|
||||
|
||||
//passing in NS_OK because we only get in here if copy portion succeeded
|
||||
|
|
Загрузка…
Ссылка в новой задаче