add code for hooking up stop button,r=putterman 12016

This commit is contained in:
bienvenu%netscape.com 1999-11-02 03:34:45 +00:00
parent 8ad1e0aeeb
commit 21d54004e2
4 changed files with 61 additions and 8 deletions

View File

@ -22,7 +22,8 @@
#include "nsIMsgFolder.idl"
interface nsITransactionManager;
interface nsIWebShell;
interface nsIDOMWindow;
/*
* This interface can be used to set data specific to a window.
*/
@ -35,4 +36,8 @@ interface nsIMsgWindow : nsISupports {
attribute nsITransactionManager transactionManager;
attribute nsIMessageView messageView;
attribute nsIMsgFolder openFolder;
attribute nsIWebShell rootWebShell;
void SetDOMWindow(in nsIDOMWindow window);
void StopUrls();
};

View File

@ -231,7 +231,7 @@ function InitMsgWindow()
{
msgWindow.statusFeedback = statusFeedback;
msgWindow.messageView = messageView;
msgWindow.SetDOMWindow(window);
}
function AddDataSources()
@ -388,9 +388,7 @@ function ClearMessagePane()
function StopUrls()
{
dump("sorry, stop doesn't work yet.\n");
var windowData = folderDataSource.QueryInterface(Components.interfaces.nsIMsgWindowData);
msgWindow.StopUrls();
}

View File

@ -17,15 +17,16 @@
*/
#include "nsMsgWindow.h"
#include "nsIScriptGlobalObject.h"
#include "nsIDOMElement.h"
#include "nsIDOMWindow.h"
NS_IMPL_ISUPPORTS(nsMsgWindow, nsCOMTypeInfo<nsIMsgWindow>::GetIID())
nsMsgWindow::nsMsgWindow()
{
NS_INIT_REFCNT();
mRootWebShell = nsnull;
}
nsMsgWindow::~nsMsgWindow()
@ -102,3 +103,49 @@ NS_IMETHODIMP nsMsgWindow::SetOpenFolder(nsIMsgFolder * aOpenFolder)
mOpenFolder = aOpenFolder;
return NS_OK;
}
NS_IMETHODIMP nsMsgWindow::GetRootWebShell(nsIWebShell * *aWebShell)
{
if(!aWebShell)
return NS_ERROR_NULL_POINTER;
*aWebShell = mRootWebShell;
NS_IF_ADDREF(*aWebShell);
return NS_OK;
}
NS_IMETHODIMP nsMsgWindow::SetRootWebShell(nsIWebShell * aWebShell)
{
mRootWebShell = aWebShell;
return NS_OK;
}
NS_IMETHODIMP nsMsgWindow::SetDOMWindow(nsIDOMWindow *aWindow)
{
if (!aWindow)
return NS_ERROR_NULL_POINTER;
nsresult rv = NS_OK;
nsCOMPtr<nsIScriptGlobalObject>
globalScript(do_QueryInterface(aWindow));
nsCOMPtr<nsIWebShell> webshell, rootWebshell;
if (globalScript)
globalScript->GetWebShell(getter_AddRefs(webshell));
if (webshell)
{
webshell->GetRootWebShell(mRootWebShell);
nsIWebShell *root = mRootWebShell;
NS_RELEASE(root); // don't hold reference
}
return rv;
}
NS_IMETHODIMP nsMsgWindow::StopUrls()
{
if (mRootWebShell)
return mRootWebShell->Stop();
return NS_ERROR_NULL_POINTER;
}

View File

@ -24,6 +24,7 @@
#include "nsITransactionManager.h"
#include "nsIMessageView.h"
#include "nsIMsgFolder.h"
#include "nsIWebShell.h"
#include "nsCOMPtr.h"
@ -43,6 +44,8 @@ protected:
nsCOMPtr<nsITransactionManager> mTransactionManager;
nsCOMPtr<nsIMessageView> mMessageView;
nsCOMPtr<nsIMsgFolder> mOpenFolder;
// let's not make this a strong ref - we don't own it.
nsIWebShell *mRootWebShell;
};