Skip to content
Snippets Groups Projects
Commit 99c6085b authored by law%netscape.com's avatar law%netscape.com
Browse files

Stop button; r=slamm, a=chofmann

parent cd4fddde
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,7 @@ interface BrowserAppCore : BaseAppCore
void back();
void forward();
void stop();
void loadUrl(in wstring url);
void loadInitialPage();
......
......@@ -39,9 +39,11 @@ public:
NS_IMETHOD Forward()=0;
NS_IMETHOD Stop()=0;
NS_IMETHOD LoadUrl(const nsString& aUrl)=0;
NS_IMETHOD LoadInitialPage()=0;
NS_IMETHOD LoadInitialPage()=0;
NS_IMETHOD WalletEditor()=0;
......@@ -84,8 +86,9 @@ public:
#define NS_DECL_IDOMBROWSERAPPCORE \
NS_IMETHOD Back(); \
NS_IMETHOD Forward(); \
NS_IMETHOD Stop(); \
NS_IMETHOD LoadUrl(const nsString& aUrl); \
NS_IMETHOD LoadInitialPage(); \
NS_IMETHOD LoadInitialPage(); \
NS_IMETHOD WalletEditor(); \
NS_IMETHOD WalletSafeFillin(nsIDOMWindow* aWin); \
NS_IMETHOD WalletQuickFillin(nsIDOMWindow* aWin); \
......@@ -110,7 +113,9 @@ public:
#define NS_FORWARD_IDOMBROWSERAPPCORE(_to) \
NS_IMETHOD Back() { return _to Back(); } \
NS_IMETHOD Forward() { return _to Forward(); } \
NS_IMETHOD Stop() { return _to Stop(); } \
NS_IMETHOD LoadUrl(const nsString& aUrl) { return _to LoadUrl(aUrl); } \
NS_IMETHOD LoadInitialPage() { return _to LoadInitialPage(); } \
NS_IMETHOD WalletEditor() { return _to WalletEditor(); } \
NS_IMETHOD WalletSafeFillin(nsIDOMWindow* aWin) { return _to WalletSafeFillin(aWin); } \
NS_IMETHOD WalletQuickFillin(nsIDOMWindow* aWin) { return _to WalletQuickFillin(aWin); } \
......
......@@ -310,14 +310,13 @@ nsBrowserAppCore::Forward()
return NS_OK;
}
#if 0
NS_IMETHODIMP
nsBrowserAppCore::Stop()
{
mContentAreaWebShell->Stop();
setAttribute( mWebShell, "Browser:Throbber", "busy", "false" );
return NS_OK;
}
#endif /* 0 */
#ifdef ClientWallet
//#define WALLET_EDITOR_URL "resource:/res/samples/walleted.html"
......@@ -559,12 +558,6 @@ nsBrowserAppCore::LoadUrl(const nsString& aUrl)
if (!urlstr)
return NS_OK;
#if NOT_YET
printf("Enabling stop button\n");
//Enable the Stop buton
setAttribute(mWebShell, "canStop", "disabled", "false");
#endif /* NOT_YET */
/* Ask nsWebShell to load the URl */
nsString id;
GetId(id);
......@@ -816,6 +809,10 @@ nsBrowserAppCore::OnStartDocumentLoad(nsIDocumentLoader* loader, nsIURL* aURL, c
{
// Kick start the throbber
setAttribute( mWebShell, "Browser:Throbber", "busy", "true" );
// Enable the Stop buton
setAttribute( mWebShell, "canStop", "disabled", "false" );
return NS_OK;
}
......@@ -917,7 +914,7 @@ done:
setAttribute(mWebShell, "canGoBack", "disabled", (rv == NS_OK) ? "" : "true");
//Disable the Stop button
// setAttribute(mWebShell, "canStop", "disabled", "true");
setAttribute( mWebShell, "canStop", "disabled", "true" );
/* To satisfy a request from the QA group */
if (aStatus == NS_OK) {
......@@ -1325,6 +1322,9 @@ nsBrowserAppCore::HandleUnknownContentType(nsIDocumentLoader* loader,
const char *aCommand ) {
nsresult rv = NS_OK;
// Turn off the indicators in the chrome.
setAttribute( mWebShell, "Browser:Throbber", "busy", "false" );
// Note: The following code is broken. It should rightfully be loading
// some "unknown content type handler" component and giving it control.
// We will change this as soon as nsFileDownloadDialog is moved to a
......
......@@ -63,6 +63,7 @@ class nsBrowserAppCore : public nsBaseAppCore,
NS_IMETHOD Back();
NS_IMETHOD Forward();
NS_IMETHOD Stop();
NS_IMETHOD WalletEditor();
NS_IMETHOD WalletSafeFillin(nsIDOMWindow* aWin);
......
......@@ -140,6 +140,63 @@
}
function BrowserCanStop() {
var stop = document.getElementById("canStop");
if ( stop ) {
var stopDisabled = stop.getAttribute("disabled");
var stopButton = document.getElementById( "stop-button" );
if ( stopButton ) {
if ( stopDisabled ) {
stopButton.setAttribute( "disabled", "" );
} else {
stopButton.removeAttribute( "disabled" );
}
}
}
}
function BrowserStop() {
// Get a handle to the "canStop" broadcast id
var stopBElem = document.getElementById("canStop");
if (!stopBElem) {
dump("Couldn't obtain handle to stop Broadcast element\n");
return;
}
var canStop = stopBElem.getAttribute("disabled");
var sb = document.getElementById("stop-button");
if (!sb) {
dump("Could not obtain handle to stop button\n");
return;
}
// If the stop button is currently disabled, just return
if ((sb.getAttribute("disabled")) == "true") {
return;
}
//Stop button has just been pressed. Disable it.
sb.setAttribute("disabled", "");
// Get a handle to the stop menu item.
var sm = document.getElementById("menuitem-stop");
if (!sm) {
dump("Couldn't obtain menu item Stop\n");
} else {
// Disable the stop menu-item.
sm.setAttribute("disabled", "true");
}
//Call in to BrowserAppcore to stop the current loading
if (appCore != null) {
dump("Going to Stop\n");
appCore.stop();
} else {
dump("BrowserAppCore has not been created!\n");
}
}
function BrowserSetBack()
{
var backBElem = document.getElementById("canGoBack");
......@@ -616,7 +673,7 @@
<separator />
<menuitem name="Reload" onclick="BrowserReload();"/>
<menuitem name="Show Images" onclick="BrowserReload();"/>
<menuitem name="Stop" onclick="BrowserReload();"/>
<menuitem name="Stop" onclick="BrowserStop();"/>
<separator />
<menuitem name="Page Source" onclick="BrowserViewSource();"/>
<menuitem name="Page Info" onclick="BrowserReload();"/>
......@@ -820,8 +877,8 @@
</titledbutton>
<titledbutton id="stop-button" align="bottom" value="Stop"
onclick="window.frames[0].frames[1].stop()">
<observes element="canStop" attribute="disabled"/>
onclick="BrowserStop()">
<observes element="canStop" attribute="disabled" onchange="BrowserCanStop()"/>
</titledbutton>
<box align="vertical" flex="100%">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment