more work to hook up stop button, r=mscott 17743

This commit is contained in:
bienvenu%netscape.com 1999-11-02 21:36:59 +00:00
Родитель c5ae2f5e74
Коммит 41638ccfc8
22 изменённых файлов: 105 добавлений и 33 удалений

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

@ -55,7 +55,7 @@ interface nsIMsgFolder : nsIFolder {
void endFolderLoading();
/* get new headers for db */
void updateFolder();
void updateFolder(in nsIMsgWindow aWindow);
nsIMsgThread getThreadForMessage(in nsIMessage message);
boolean hasMessage(in nsIMessage message);
@ -153,7 +153,7 @@ interface nsIMsgFolder : nsIFolder {
readonly attribute boolean locked;
nsIMessage createMessageFromMsgDBHdr(in nsIMsgDBHdr msgDBHdr);
void getNewMessages();
void getNewMessages(in nsIMsgWindow aWindow);
void writeToFolderCache(in nsIMsgFolderCache folderCache);
attribute wstring charset;

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

@ -24,6 +24,7 @@ interface nsIUrlListener;
interface nsIMsgStatusFeedback;
interface nsIMsgIncomingServer;
interface nsIMsgWindow;
interface nsILoadGroup;
[scriptable, uuid(6CFFCEB0-CB8C-11d2-8065-006008128C4E)]
interface nsIMsgMailNewsUrl : nsIURL {
@ -55,6 +56,8 @@ interface nsIMsgMailNewsUrl : nsIURL {
void SetMsgWindow(in nsIMsgWindow aMsgWindow);
void GetMsgWindow(out nsIMsgWindow aMsgWindow);
// the load group is computed from the msgWindow
readonly attribute nsILoadGroup loadGroup;
attribute boolean updatingFolder;
};

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

@ -214,7 +214,7 @@ function ChangeFolderByURI(uri)
{
gCurrentLoadingFolderURI = uri;
msgfolder.startFolderLoading();
msgfolder.updateFolder();
msgfolder.updateFolder(msgWindow);
}
catch(ex)
{
@ -223,7 +223,7 @@ function ChangeFolderByURI(uri)
else
{
gCurrentLoadingFolderURI = "";
msgfolder.updateFolder();
msgfolder.updateFolder(msgWindow);
RerootFolder(uri, msgfolder);
}
}

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

@ -289,7 +289,7 @@ nsMsgCopyService::FindRequest(nsISupports* aSupport,
NS_IMPL_THREADSAFE_ISUPPORTS(nsMsgCopyService, nsCOMTypeInfo<nsIMsgCopyService>::GetIID())
NS_IMETHODIMP
nsMsgCopyService::CopyMessages(nsIMsgFolder* srcFolder, /* UI src foler */
nsMsgCopyService::CopyMessages(nsIMsgFolder* srcFolder, /* UI src folder */
nsISupportsArray* messages,
nsIMsgFolder* dstFolder,
PRBool isMove,

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

@ -599,7 +599,7 @@ nsMsgFolderDataSource::DoCommand(nsISupportsArray/*<nsIRDFResource>*/* aSources,
}
else if((aCommand == kNC_GetNewMessages))
{
rv = folder->GetNewMessages();
rv = folder->GetNewMessages(mWindow);
}
else if((aCommand == kNC_Copy))
{

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

@ -201,7 +201,7 @@ nsMsgStatusFeedback::StartMeteors()
if (!m_meteorsSpinning)
{
// meteors are horribly slow, so turn them off for now
// setAttribute( mWebShell, "Messenger:Throbber", "busy", "true" );
setAttribute( mWebShell, "Messenger:Throbber", "busy", "true" );
m_meteorsSpinning = PR_TRUE;
}
return NS_OK;
@ -214,7 +214,7 @@ nsMsgStatusFeedback::StopMeteors()
if (m_meteorsSpinning)
{
// meteors are horribly slow, so turn them off for now
// setAttribute( mWebShell, "Messenger:Throbber", "busy", "false" );
setAttribute( mWebShell, "Messenger:Throbber", "busy", "false" );
m_meteorsSpinning = PR_FALSE;
}
return NS_OK;

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

@ -21,6 +21,9 @@
#include "nsMsgBaseCID.h"
#include "nsIMsgMailSession.h"
#include "nsXPIDLString.h"
#include "nsIDocumentLoader.h"
#include "nsILoadGroup.h"
#include "nsIWebShell.h"
static NS_DEFINE_CID(kUrlListenerManagerCID, NS_URLLISTENERMANAGER_CID);
static NS_DEFINE_CID(kStandardUrlCID, NS_STANDARDURL_CID);
@ -249,6 +252,37 @@ NS_IMETHODIMP nsMsgMailNewsUrl::GetStatusFeedback(nsIMsgStatusFeedback **aMsgFee
return rv;
}
NS_IMETHODIMP nsMsgMailNewsUrl::GetLoadGroup(nsILoadGroup **aLoadGroup)
{
nsresult rv = NS_OK;
// note: it is okay to return a null load group and not return an error
// it's possible the url really doesn't have load group
if (!m_loadGroup)
{
if (m_msgWindow)
{
nsCOMPtr <nsIWebShell> webShell;
m_msgWindow->GetRootWebShell(getter_AddRefs(webShell));
if (webShell)
{
nsCOMPtr <nsIDocumentLoader> docLoader;
webShell->GetDocumentLoader(*getter_AddRefs(docLoader));
if (docLoader)
docLoader->GetLoadGroup(getter_AddRefs(m_loadGroup));
}
}
}
if (aLoadGroup)
{
*aLoadGroup = m_loadGroup;
NS_IF_ADDREF(*aLoadGroup);
}
else
rv = NS_ERROR_NULL_POINTER;
return rv;
}
NS_IMETHODIMP nsMsgMailNewsUrl::GetUpdatingFolder(PRBool *aResult)
{

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

@ -28,6 +28,7 @@
#include "nsCOMPtr.h"
#include "nsIMsgMailNewsUrl.h"
#include "nsIURL.h"
#include "nsILoadGroup.h"
///////////////////////////////////////////////////////////////////////////////////
// Okay, I found that all of the mail and news url interfaces needed to support
@ -56,6 +57,8 @@ protected:
nsCOMPtr<nsIURL> m_baseURL;
nsCOMPtr<nsIMsgStatusFeedback> m_statusFeedback;
nsCOMPtr<nsIMsgWindow> m_msgWindow;
nsCOMPtr<nsILoadGroup> m_loadGroup;
char *m_errorMessage;
PRBool m_runningUrl;
PRBool m_updatingFolder;

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

@ -45,7 +45,7 @@ class nsIUrlListener;
class nsIURI;
class nsIEventQueue;
class nsIMsgFolder;
class nsIMsgStatusFeedback;
class nsIMsgWindow;
class nsIImapService : public nsISupports
{
@ -59,7 +59,7 @@ public:
NS_IMETHOD SelectFolder(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIMsgStatusFeedback *aMsgStatusFeedback,
nsIMsgWindow *aMsgWindow,
nsIURI ** aURL) = 0;
NS_IMETHOD LiteSelectFolder(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,

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

@ -183,6 +183,8 @@ public:
NS_IMETHOD GetMockChannel(nsIImapMockChannel ** aChannel) = 0;
NS_IMETHOD SetMockChannel(nsIImapMockChannel * aChannel) = 0;
NS_IMETHOD AddChannelToLoadGroup() = 0;
};
#endif /* nsIImapUrl_h___ */

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

@ -471,7 +471,7 @@ NS_IMETHODIMP nsImapIncomingServer::PerformBiff()
{
nsCOMPtr<nsIMsgFolder> rootMsgFolder = do_QueryInterface(rootFolder);
if(rootMsgFolder)
rv = rootMsgFolder->GetNewMessages();
rv = rootMsgFolder->GetNewMessages(nsnull);
}
return rv;

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

@ -419,7 +419,7 @@ nsresult nsImapMailFolder::GetDatabase()
}
NS_IMETHODIMP
nsImapMailFolder::UpdateFolder()
nsImapMailFolder::UpdateFolder(nsIMsgWindow *msgWindow)
{
nsresult rv = NS_ERROR_NULL_POINTER;
PRBool selectFolder = PR_FALSE;
@ -1162,7 +1162,7 @@ nsImapMailFolder::DeleteSubFolders(nsISupportsArray* folders)
return nsMsgFolder::DeleteSubFolders(folders);
}
NS_IMETHODIMP nsImapMailFolder::GetNewMessages()
NS_IMETHODIMP nsImapMailFolder::GetNewMessages(nsIMsgWindow *aWindow)
{
nsresult rv = NS_ERROR_FAILURE;
NS_WITH_SERVICE(nsIImapService, imapService, kCImapService, &rv);
@ -1180,7 +1180,7 @@ NS_IMETHODIMP nsImapMailFolder::GetNewMessages()
if (NS_SUCCEEDED(rv) && pEventQService)
pEventQService->GetThreadEventQueue(PR_GetCurrentThread(),
getter_AddRefs(eventQ));
rv = imapService->SelectFolder(eventQ, inbox, this, nsnull, nsnull);
rv = imapService->SelectFolder(eventQ, inbox, this, aWindow, nsnull);
return rv;
}
@ -2511,7 +2511,11 @@ nsImapMailFolder::OnStopRunningUrl(nsIURI *aUrl, nsresult aExitCode)
NS_WITH_SERVICE(nsIMsgMailSession, session, kMsgMailSessionCID, &rv);
if (aUrl)
{
nsCOMPtr<nsIMsgWindow> aWindow;
nsCOMPtr<nsIMsgMailNewsUrl> mailUrl = do_QueryInterface(aUrl);
nsCOMPtr<nsIImapUrl> imapUrl = do_QueryInterface(aUrl);
if (mailUrl)
mailUrl->GetMsgWindow(getter_AddRefs(aWindow));
if (imapUrl)
{
nsIImapUrl::nsImapAction imapAction = nsIImapUrl::nsImapTest;
@ -2556,7 +2560,7 @@ nsImapMailFolder::OnStopRunningUrl(nsIURI *aUrl, nsresult aExitCode)
PRBool folderOpen = PR_FALSE;
session->IsFolderOpenInWindow(this, &folderOpen);
if (folderOpen)
UpdateFolder();
UpdateFolder(aWindow);
else
UpdatePendingCounts(PR_TRUE, PR_FALSE);
}
@ -2573,7 +2577,7 @@ nsImapMailFolder::OnStopRunningUrl(nsIURI *aUrl, nsresult aExitCode)
ClearCopyState(aExitCode);
}
}
UpdateFolder();
UpdateFolder(aWindow);
break;
default:
break;
@ -2582,7 +2586,6 @@ nsImapMailFolder::OnStopRunningUrl(nsIURI *aUrl, nsresult aExitCode)
// 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)
rv = mailUrl->UnRegisterListener(this);
}

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

@ -105,7 +105,7 @@ public:
NS_IMETHOD AddUnique(nsISupports* element);
NS_IMETHOD ReplaceElement(nsISupports* element, nsISupports* newElement);
NS_IMETHOD GetMessages(nsISimpleEnumerator* *result);
NS_IMETHOD UpdateFolder();
NS_IMETHOD UpdateFolder(nsIMsgWindow *aWindow);
NS_IMETHOD CreateSubfolder(const char *folderName);
@ -155,7 +155,7 @@ public:
nsIMsgCopyServiceListener* listener);
NS_IMETHOD CreateMessageFromMsgDBHdr(nsIMsgDBHdr *msgHdr, nsIMessage
**message);
NS_IMETHOD GetNewMessages();
NS_IMETHOD GetNewMessages(nsIMsgWindow *aWindow);
NS_IMETHOD GetPath(nsIFileSpec** aPathName);

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

@ -6323,6 +6323,12 @@ NS_IMETHODIMP nsImapMockChannel::IsPending(PRBool *result)
NS_IMETHODIMP nsImapMockChannel::Cancel()
{
if (m_channelContext)
{
nsCOMPtr<nsIImapProtocol> protocol = do_QueryInterface(m_channelContext);
if (protocol)
protocol->TellThreadToDie(PR_TRUE);
}
return NS_ERROR_NOT_IMPLEMENTED;
}

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

@ -39,7 +39,7 @@
#include "nsEscape.h"
#include "nsIMsgStatusFeedback.h"
#include "nsIPref.h"
#include "nsILoadGroup.h"
#include "nsIFileLocator.h"
#include "nsFileLocations.h"
@ -98,7 +98,7 @@ NS_IMETHODIMP
nsImapService::SelectFolder(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIMsgStatusFeedback *aStatusFeedback,
nsIMsgWindow *aMsgWindow,
nsIURI ** aURL)
{
@ -123,8 +123,9 @@ nsImapService::SelectFolder(nsIEventQueue * aClientEventQueue,
rv = imapUrl->SetImapAction(nsIImapUrl::nsImapSelectFolder);
nsCOMPtr <nsIMsgMailNewsUrl> mailNewsUrl = do_QueryInterface(imapUrl);
mailNewsUrl->SetStatusFeedback(aStatusFeedback);
mailNewsUrl->SetMsgWindow(aMsgWindow);
mailNewsUrl->SetUpdatingFolder(PR_TRUE);
imapUrl->AddChannelToLoadGroup();
rv = SetImapUrlSink(aImapMailFolder, imapUrl);
if (NS_SUCCEEDED(rv))
@ -435,7 +436,12 @@ nsImapService::FetchMessage(nsIImapUrl * aImapUrl,
if (NS_SUCCEEDED(rv) && aStreamListener)
{
nsCOMPtr<nsIChannel> aChannel;
rv = NewChannel(nsnull, url, nsnull, nsnull, nsnull, getter_AddRefs(aChannel));
nsCOMPtr<nsILoadGroup> aLoadGroup;
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(aImapUrl, &rv);
if (NS_SUCCEEDED(rv) && mailnewsUrl)
mailnewsUrl->GetLoadGroup(getter_AddRefs(aLoadGroup));
rv = NewChannel(nsnull, url, aLoadGroup, nsnull, nsnull, getter_AddRefs(aChannel));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsISupports> aCtxt = do_QueryInterface(url);

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

@ -53,7 +53,7 @@ public:
NS_IMETHOD SelectFolder(nsIEventQueue * aClientEventQueue,
nsIMsgFolder *aImapMailFolder,
nsIUrlListener * aUrlListener,
nsIMsgStatusFeedback *aMsgStatusFeedback,
nsIMsgWindow *aMsgWindow,
nsIURI ** aURL);
NS_IMETHOD LiteSelectFolder(nsIEventQueue * aClientEventQueue,
nsIMsgFolder * aImapMailFolder,

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

@ -932,6 +932,20 @@ NS_IMETHODIMP nsImapUrl::SetMockChannel(nsIImapMockChannel * aChannel)
return rv;
}
NS_IMETHODIMP nsImapUrl::AddChannelToLoadGroup()
{
nsCOMPtr <nsILoadGroup> aLoadGroup;
if (m_mockChannel)
{
GetLoadGroup(getter_AddRefs(aLoadGroup));
if (aLoadGroup)
{
aLoadGroup->AddChannel(m_mockChannel, nsnull /* context isupports */);
}
}
return NS_OK;
}
NS_IMETHODIMP nsImapUrl::GetAllowContentChange(PRBool *result)
{
if (!result)

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

@ -94,6 +94,7 @@ public:
NS_IMETHOD GetMockChannel(nsIImapMockChannel ** aChannel);
NS_IMETHOD SetMockChannel(nsIImapMockChannel * aChannel);
NS_IMETHOD AddChannelToLoadGroup();
// nsIMsgMessageUrl
NS_DECL_NSIMSGMESSAGEURL

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

@ -513,7 +513,7 @@ nsresult nsMsgLocalMailFolder::GetDatabase()
}
NS_IMETHODIMP
nsMsgLocalMailFolder::UpdateFolder()
nsMsgLocalMailFolder::UpdateFolder(nsIMsgWindow *aWindow)
{
return GetDatabase(); // this will cause a reparse, if needed.
}
@ -1492,7 +1492,7 @@ nsMsgLocalMailFolder::CreateMessageFromMsgDBHdr(nsIMsgDBHdr *msgDBHdr,
return rv;
}
NS_IMETHODIMP nsMsgLocalMailFolder::GetNewMessages()
NS_IMETHODIMP nsMsgLocalMailFolder::GetNewMessages(nsIMsgWindow *aWindow)
{
nsresult rv = NS_OK;

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

@ -86,7 +86,7 @@ public:
NS_IMETHOD AddUnique(nsISupports* element);
NS_IMETHOD ReplaceElement(nsISupports* element, nsISupports* newElement);
NS_IMETHOD GetMessages(nsISimpleEnumerator* *result);
NS_IMETHOD UpdateFolder();
NS_IMETHOD UpdateFolder(nsIMsgWindow *aWindow);
NS_IMETHOD CreateSubfolder(const char *folderName);
@ -125,7 +125,7 @@ public:
nsIMsgWindow *msgWindow,
nsIMsgCopyServiceListener* listener);
NS_IMETHOD CreateMessageFromMsgDBHdr(nsIMsgDBHdr *msgDBHdr, nsIMessage **message);
NS_IMETHOD GetNewMessages();
NS_IMETHOD GetNewMessages(nsIMsgWindow *aWindow);
// nsIMsgMailFolder
NS_IMETHOD GetPath(nsIFileSpec ** aPathName);

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

@ -376,10 +376,10 @@ nsresult nsMsgNewsFolder::GetDatabase()
NS_IMETHODIMP
nsMsgNewsFolder::UpdateFolder()
nsMsgNewsFolder::UpdateFolder(nsIMsgWindow *aWindow)
{
GetDatabase(); // want this cached...
return GetNewMessages();
return GetNewMessages(aWindow);
}
NS_IMETHODIMP
@ -892,7 +892,7 @@ NS_IMETHODIMP nsMsgNewsFolder::DeleteMessages(nsISupportsArray *messages,
return rv;
}
NS_IMETHODIMP nsMsgNewsFolder::GetNewMessages()
NS_IMETHODIMP nsMsgNewsFolder::GetNewMessages(nsIMsgWindow *aWindow)
{
nsresult rv = NS_OK;

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

@ -55,7 +55,7 @@ public:
NS_IMETHOD AddUnique(nsISupports* element);
NS_IMETHOD ReplaceElement(nsISupports* element, nsISupports* newElement);
NS_IMETHOD GetMessages(nsISimpleEnumerator* *result);
NS_IMETHOD UpdateFolder();
NS_IMETHOD UpdateFolder(nsIMsgWindow *aWindow);
NS_IMETHOD CreateSubfolder(const char *folderName);
@ -87,7 +87,7 @@ public:
NS_IMETHOD DeleteMessages(nsISupportsArray *messages,
nsIMsgWindow *msgWindow, PRBool deleteStorage);
NS_IMETHOD CreateMessageFromMsgDBHdr(nsIMsgDBHdr *msgDBHdr, nsIMessage **message);
NS_IMETHOD GetNewMessages();
NS_IMETHOD GetNewMessages(nsIMsgWindow *aWindow);
NS_IMETHOD GetPath(nsIFileSpec** aPathName);