13084 [PP]Use current page to set homepage doesn't work

git-svn-id: svn://10.0.0.236/trunk@47533 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
davidm%netscape.com 1999-09-15 05:08:22 +00:00
parent 1e6491f90d
commit 826bda7a3e
3 changed files with 26 additions and 2 deletions

View File

@ -76,7 +76,7 @@
<html:input name="homepage" type="text" id="pref:string:browser.startup.homepage" size="30" />
<html:div>
<spring flex="100%"/>
<titledbutton name="starts" type="button" value="&useCurrent;" />
<titledbutton name="starts" type="button" value="&useCurrent;" onclick="SetHomePageToCurrentPage();" />
<titledbutton name="browse" type="button" value="&browseFile;" />
</html:div>
</html:fieldset>

View File

@ -49,3 +49,27 @@ function StartUp(windowName)
browser.openWindow();
toolkit.CloseWindow( window );
}
function SetHomePageToCurrentPage()
{
dump("SetHomePageToCurrentPage() \n ");
var windowManager = Components.classes['component://netscape/rdf/datasource?name=window-mediator'].getService();
var windowManagerInterface = windowManager.QueryInterface( Components.interfaces.nsIWindowMediator);
var topWindowOfType = windowManagerInterface.GetMostRecentWindow( "navigator:browser" );
if ( topWindowOfType )
{
var inputfield = document.getElementById("pref:string:browser.startup.homepage");
dump( "window found "+inputfield+"\n");
if ( inputfield )
{
dump("setting home page to "+topWindowOfType.content.location.href+"\n");
inputfield.value = topWindowOfType.content.location.href;
}
}
else
{
dump(" No browser window. Should be disabling this button \n");
}
}

View File

@ -76,7 +76,7 @@
<html:input name="homepage" type="text" id="pref:string:browser.startup.homepage" size="30" />
<html:div>
<spring flex="100%"/>
<titledbutton name="starts" type="button" value="&useCurrent;" />
<titledbutton name="starts" type="button" value="&useCurrent;" onclick="SetHomePageToCurrentPage();" />
<titledbutton name="browse" type="button" value="&browseFile;" />
</html:div>
</html:fieldset>