Adding protocol icon support.

This commit is contained in:
dougt%netscape.com 1999-08-27 21:39:40 +00:00
parent 6361c09f47
commit 8fdac273fb

View File

@ -832,7 +832,7 @@ PRInt32
newWind(char* urlName)
{
nsresult rv;
char * urlstr=urlName;
char * urlstr=urlName;
/*
* Create the Application Shell instance...
@ -1578,6 +1578,38 @@ nsBrowserAppCore::OnStartDocumentLoad(nsIDocumentLoader* aLoader, nsIURI* aURL,
//Disable the reload button
setAttribute(mWebShell, "canReload", "disabled", "true");
//Set the "at-work" protocol icon.
char* scheme;
aURL->GetScheme(&scheme);
nsIFileSpec* chrome = NS_LocateFileOrDirectory( nsSpecialFileSpec::App_ChromeDirectory);
if (chrome)
{
chrome->AppendRelativeUnixPath("netwerk/content/default/");
chrome->AppendRelativeUnixPath(scheme);
PRBool exists;
chrome->Exists(&exists);
if (exists)
{
nsAutoString iconURIString;
iconURIString.SetString("chrome://netwerk/content/default/");
iconURIString.Append(scheme);
iconURIString.Append("/working.gif");
setAttribute(mWebShell, "Browser:ProtocolIcon", "uri", iconURIString);
}
else
{
setAttribute(mWebShell, "Browser:ProtocolIcon", "uri", "");
}
NS_RELEASE(chrome);
}
return NS_OK;
}
@ -1659,7 +1691,7 @@ done:
if (aStatus == NS_OK)
setAttribute( mWebShell, "urlbar", "value", url);
/* To satisfy a request from the QA group */
/* To satisfy a request from the QA group */
if (aStatus == NS_OK) {
fprintf(stdout, "Document %s loaded successfully\n", url);
fflush(stdout);
@ -1701,9 +1733,45 @@ end:
//Disable the Stop button
setAttribute( mWebShell, "canStop", "disabled", "true" );
//Enable the reload button
setAttribute(mWebShell, "canReload", "disabled", "");
//Enable the reload button
setAttribute(mWebShell, "canReload", "disabled", "");
//Set the protocol icon.
char* scheme;
aUrl->GetScheme(&scheme);
nsIFileSpec* chrome = NS_LocateFileOrDirectory( nsSpecialFileSpec::App_ChromeDirectory);
if (chrome)
{
chrome->AppendRelativeUnixPath("netwerk/content/default/");
chrome->AppendRelativeUnixPath(scheme);
PRBool exists;
chrome->Exists(&exists);
if (exists)
{
char* scheme;
aUrl->GetScheme(&scheme);
nsAutoString iconURIString;
iconURIString.SetString("chrome://netwerk/content/default/");
iconURIString.Append(scheme);
if (NS_SUCCEEDED(aStatus))
iconURIString.Append("/successful.gif");
else
iconURIString.Append("/failure.gif");
setAttribute(mWebShell, "Browser:ProtocolIcon", "uri", iconURIString);
}
else
{
setAttribute(mWebShell, "Browser:ProtocolIcon", "uri", "");
}
NS_RELEASE(chrome);
}
//Update the go menu with history entries. Not ready yet
//UpdateGoMenu();
#ifdef NECKO