add method to find out if folder is in open window r=putterman

This commit is contained in:
bienvenu%netscape.com 1999-10-31 22:21:55 +00:00
Родитель b20f02431f
Коммит b19191c4a1
2 изменённых файлов: 31 добавлений и 4 удалений

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

@ -67,5 +67,6 @@ interface nsIMsgMailSession : nsISupports {
void AddMsgWindow(in nsIMsgWindow msgWindow);
void RemoveMsgWindow(in nsIMsgWindow msgWindow);
readonly attribute nsISupportsArray msgWindowsArray;
boolean IsFolderOpenInWindow(in nsIMsgFolder folder);
};

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

@ -28,6 +28,7 @@
#include "nsIFileLocator.h"
#include "nsFileLocations.h"
#include "nsIMsgStatusFeedback.h"
#include "nsIMsgWindow.h"
NS_IMPL_ISUPPORTS(nsMsgMailSession, nsCOMTypeInfo<nsIMsgMailSession>::GetIID());
@ -36,10 +37,6 @@ static NS_DEFINE_CID(kMsgFolderCacheCID, NS_MSGFOLDERCACHE_CID);
static NS_DEFINE_IID(kIFileLocatorIID, NS_IFILELOCATOR_IID);
static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID);
//static NS_DEFINE_CID(kMsgIdentityCID, NS_MSGIDENTITY_CID);
//static NS_DEFINE_CID(kPop3IncomingServerCID, NS_POP3INCOMINGSERVER_CID);
//static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
nsMsgMailSession::nsMsgMailSession():
mRefCnt(0),
@ -320,3 +317,32 @@ NS_IMETHODIMP nsMsgMailSession::GetMsgWindowsArray(nsISupportsArray * *aWindowsA
return NS_OK;
}
NS_IMETHODIMP nsMsgMailSession::IsFolderOpenInWindow(nsIMsgFolder *folder, PRBool *aResult)
{
if (!aResult)
return NS_ERROR_NULL_POINTER;
*aResult = PR_FALSE;
PRUint32 count;
nsresult rv = mWindows->Count(&count);
if (NS_FAILED(rv)) return rv;
if (mWindows)
{
for(PRUint32 i = 0; i < count; i++)
{
nsCOMPtr<nsIMsgWindow> openWindow = getter_AddRefs((nsIMsgWindow*)mWindows->ElementAt(i));
nsCOMPtr<nsIMsgFolder> openFolder;
if (openWindow)
openWindow->GetOpenFolder(getter_AddRefs(openFolder));
if (folder == openFolder.get())
{
*aResult = PR_TRUE;
break;
}
}
}
return NS_OK;
}