зеркало из https://github.com/mozilla/gecko-dev.git
add folder loaded notifications
This commit is contained in:
Родитель
313baf741f
Коммит
1120b750bf
|
@ -50,6 +50,8 @@ interface nsIMsgMailNewsUrl : nsIURL {
|
|||
// the ownership model for msg feedback
|
||||
void SetStatusFeedback(in nsIMsgStatusFeedback aMsgFeedback);
|
||||
void GetStatusFeedback(out nsIMsgStatusFeedback aMsgFeedback);
|
||||
|
||||
attribute boolean updatingFolder;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "nsIMsgFolderCacheElement.h"
|
||||
#include "nsIMsgMailSession.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
#include "nsIMsgMailNewsUrl.h"
|
||||
|
||||
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
|
||||
static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID);
|
||||
|
@ -40,6 +41,10 @@ NS_IMETHODIMP nsMsgDBFolder::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
{
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIDBChangeListener*, this);
|
||||
}
|
||||
else if (aIID.Equals(nsCOMTypeInfo<nsIUrlListener>::GetIID()))
|
||||
{
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIUrlListener*, this);
|
||||
}
|
||||
|
||||
if(*aInstancePtr)
|
||||
{
|
||||
|
@ -485,3 +490,33 @@ nsMsgDBFolder::MarkAllMessagesRead(void)
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgDBFolder::OnStartRunningUrl(nsIURI *aUrl)
|
||||
{
|
||||
NS_PRECONDITION(aUrl, "just a sanity check");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgDBFolder::OnStopRunningUrl(nsIURI *aUrl, nsresult aExitCode)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_PRECONDITION(aUrl, "just a sanity check");
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> mailUrl = do_QueryInterface(aUrl);
|
||||
if (mailUrl)
|
||||
{
|
||||
PRBool updatingFolder = PR_FALSE;
|
||||
if (NS_SUCCEEDED(mailUrl->GetUpdatingFolder(&updatingFolder)) && updatingFolder)
|
||||
{
|
||||
PRInt32 i;
|
||||
for(i = 0; i < mListeners->Count(); i++)
|
||||
{
|
||||
//Folderlistener's aren't refcounted.
|
||||
nsIFolderListener *listener = (nsIFolderListener*)mListeners->ElementAt(i);
|
||||
listener->OnFolderLoaded(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "nsIMessage.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDBChangeListener.h"
|
||||
#include "nsIUrlListener.h"
|
||||
|
||||
class nsIMsgFolderCacheElement;
|
||||
/*
|
||||
|
@ -33,7 +34,7 @@ class nsIMsgFolderCacheElement;
|
|||
* class derived from nsMsgFolder for those folders that use an nsIMsgDatabase
|
||||
*/
|
||||
|
||||
class NS_MSG_BASE nsMsgDBFolder: public nsMsgFolder, public nsIDBChangeListener
|
||||
class NS_MSG_BASE nsMsgDBFolder: public nsMsgFolder, public nsIDBChangeListener, public nsIUrlListener
|
||||
{
|
||||
public:
|
||||
nsMsgDBFolder(void);
|
||||
|
@ -50,6 +51,8 @@ public:
|
|||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
NS_DECL_NSIURLLISTENER
|
||||
|
||||
NS_IMETHOD WriteToFolderCache(nsIMsgFolderCache *folderCache);
|
||||
NS_IMETHOD WriteToFolderCacheElem(nsIMsgFolderCacheElement *element);
|
||||
NS_IMETHOD ManyHeadersToDownload(PRBool *_retval);
|
||||
|
|
|
@ -33,6 +33,7 @@ nsMsgMailNewsUrl::nsMsgMailNewsUrl()
|
|||
// nsIURI specific state
|
||||
m_errorMessage = nsnull;
|
||||
m_runningUrl = PR_FALSE;
|
||||
m_updatingFolder = PR_FALSE;
|
||||
|
||||
nsComponentManager::CreateInstance(kUrlListenerManagerCID, nsnull, nsCOMTypeInfo<nsIUrlListenerManager>::GetIID(), (void **) getter_AddRefs(m_urlListeners));
|
||||
nsComponentManager::CreateInstance(kStandardUrlCID, nsnull, nsCOMTypeInfo<nsIURL>::GetIID(), (void **) getter_AddRefs(m_baseURL));
|
||||
|
@ -214,6 +215,21 @@ NS_IMETHODIMP nsMsgMailNewsUrl::GetStatusFeedback(nsIMsgStatusFeedback **aMsgFee
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgMailNewsUrl::GetUpdatingFolder(PRBool *aResult)
|
||||
{
|
||||
if (!aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*aResult = m_updatingFolder;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgMailNewsUrl::SetUpdatingFolder(PRBool updatingFolder)
|
||||
{
|
||||
m_updatingFolder = updatingFolder;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
// End nsIMsgMailNewsUrl specific support
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -355,3 +371,4 @@ NS_IMETHODIMP nsMsgMailNewsUrl::DirFile(char **o_DirFile)
|
|||
{
|
||||
return m_baseURL->DirFile(o_DirFile);
|
||||
}
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ protected:
|
|||
nsCOMPtr<nsIMsgStatusFeedback> m_statusFeedback;
|
||||
char *m_errorMessage;
|
||||
PRBool m_runningUrl;
|
||||
PRBool m_updatingFolder;
|
||||
|
||||
// manager of all of current url listeners....
|
||||
nsCOMPtr<nsIUrlListenerManager> m_urlListeners;
|
||||
|
|
|
@ -2563,6 +2563,8 @@ nsImapMailFolder::OnStopRunningUrl(nsIURI *aUrl, nsresult aExitCode)
|
|||
break;
|
||||
}
|
||||
}
|
||||
// give base class a chance to send folder loaded notification...
|
||||
rv = nsMsgDBFolder::OnStopRunningUrl(aUrl, aExitCode);
|
||||
// query it for a mailnews interface for now....
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> mailUrl = do_QueryInterface(aUrl);
|
||||
if (mailUrl)
|
||||
|
|
|
@ -87,8 +87,7 @@ class nsImapMailFolder : public nsMsgDBFolder,
|
|||
public nsIImapExtensionSink,
|
||||
public nsIImapMiscellaneousSink,
|
||||
public nsICopyMessageListener,
|
||||
public nsIUrlListener
|
||||
,public nsIMsgFilterHitNotify
|
||||
public nsIMsgFilterHitNotify
|
||||
{
|
||||
public:
|
||||
nsImapMailFolder();
|
||||
|
|
|
@ -122,7 +122,7 @@ nsImapService::SelectFolder(nsIEventQueue * aClientEventQueue,
|
|||
|
||||
nsCOMPtr <nsIMsgMailNewsUrl> mailNewsUrl = do_QueryInterface(imapUrl);
|
||||
mailNewsUrl->SetStatusFeedback(aStatusFeedback);
|
||||
|
||||
mailNewsUrl->SetUpdatingFolder(PR_TRUE);
|
||||
rv = SetImapUrlSink(aImapMailFolder, imapUrl);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
|
|
|
@ -313,7 +313,7 @@ nsresult nsMsgLocalMailFolder::ParseFolder(nsFileSpec& path)
|
|||
if(!parser)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = mailboxService->ParseMailbox(path, parser, nsnull, nsnull);
|
||||
rv = mailboxService->ParseMailbox(path, parser, this, nsnull);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -99,6 +99,7 @@ nsresult nsMailboxService::ParseMailbox(nsFileSpec& aMailboxPath, nsIStreamListe
|
|||
nsCOMPtr<nsIMsgMailNewsUrl> url = do_QueryInterface(mailboxurl);
|
||||
// okay now generate the url string
|
||||
nsFilePath filePath(aMailboxPath); // convert to file url representation...
|
||||
url->SetUpdatingFolder(PR_TRUE);
|
||||
char * urlSpec = PR_smprintf("mailbox://%s", (const char *) filePath);
|
||||
url->SetSpec(urlSpec);
|
||||
PR_FREEIF(urlSpec);
|
||||
|
|
Загрузка…
Ссылка в новой задаче