fix for #2658, allow the user to set the mailnews start page via prefs.

I'm re-using some of the js in PrefWindow.js to do this, since it very much like
setting the users home page. a=sdagley
This commit is contained in:
sspitzer%netscape.com 1999-12-22 06:09:02 +00:00
Родитель 6a74d4ea6a
Коммит a2c775a4b9
3 изменённых файлов: 11 добавлений и 9 удалений

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

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

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

@ -89,9 +89,11 @@ function openit() {
toolkit.CloseWindow( window );
}
function SetHomePageToCurrentPage()
function SetPrefToCurrentPage(prefID)
{
dump("SetHomePageToCurrentPage() \n ");
dump("SetPrefToCurrentPage("+ prefID +") \n ");
if ((prefID == null) || (prefID == "")) return;
var windowManager = Components.classes['component://netscape/rdf/datasource?name=window-mediator'].getService();
var windowManagerInterface = windowManager.QueryInterface( Components.interfaces.nsIWindowMediator);
@ -99,7 +101,7 @@ function openit() {
var topWindowOfType = windowManagerInterface.GetMostRecentWindow( "navigator:browser" );
if ( topWindowOfType )
{
var inputfield = document.getElementById("pref:string:browser.startup.homepage");
var inputfield = document.getElementById(prefID);
dump( "window found "+inputfield+"\n");
if ( inputfield )
{
@ -118,12 +120,12 @@ function createInstance( progid, iidName ) {
return Components.classes[ progid ].createInstance( iid );
}
function PrefNavSelectFile() {
function PrefNavSelectFile(prefID) {
// Get filespecwithui component.
var fileSpec = createInstance( "component://netscape/filespecwithui", "nsIFileSpecWithUI" );
try {
var url = fileSpec.chooseFile( "" );
var field = document.getElementById( "pref:string:browser.startup.homepage" );
var field = document.getElementById(prefID);
field.setAttribute( "value", fileSpec.nativePath );
}
catch( exception ) {

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

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