Bug 127337. Restore Default for Home Page button in Navigator. Patch by Stephen Walker <walk84@yahoo.com> r=samir, sr=alecf.

This commit is contained in:
stephend%netscape.com 2006-05-17 02:32:42 +00:00
Родитель ca010d46df
Коммит a7c75d51bc
3 изменённых файлов: 23 добавлений и 1 удалений

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

@ -4,9 +4,12 @@
const nsIFilePicker = Components.interfaces.nsIFilePicker;
const nsIWindowMediator = Components.interfaces.nsIWindowMediator;
const nsIPrefService = Components.interfaces.nsIPrefService;
const nsIPrefLocalizedString = Components.interfaces.nsIPrefLocalizedString;
const FILEPICKER_CONTRACTID = "@mozilla.org/filepicker;1";
const WINDOWMEDIATOR_CONTRACTID = "@mozilla.org/appshell/window-mediator;1";
const PREFSERVICE_CONTRACTID = "@mozilla.org/preferences-service;1";
function selectFile()
{
@ -42,3 +45,16 @@ function setHomePageToCurrentPage()
}
}
}
function setHomePageToDefaultPage()
{
var prefService = Components.classes[PREFSERVICE_CONTRACTID]
.getService(nsIPrefService);
var pref = prefService.getDefaultBranch(null);
var url = pref.getComplexValue("browser.startup.homepage",
nsIPrefLocalizedString).data;
var homePageField = document.getElementById("browserStartupHomepage");
homePageField.value = url;
}

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

@ -39,7 +39,7 @@
var _elementIDs = ["startupPage", "browserStartupHomepage",
"bookmarksButton", "goButton",
"homeButton", "printButton",
"searchButton" ];
"searchButton"];
]]>
</script>
@ -75,6 +75,10 @@
oncommand="selectFile();"
id="browserChooseFile"
prefstring="pref.browser.homepage.disable_button.select_file"/>
<button label="&useDefault.label;" accesskey="&useDefault.accesskey;"
oncommand="setHomePageToDefaultPage();"
id="browserUseDefault"
prefstring="pref.browser.homepage.disable_button.default_page"/>
</hbox>
</vbox>
</groupbox>

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

@ -16,6 +16,8 @@
<!ENTITY useCurrent.accesskey "u">
<!ENTITY browseFile.label "Choose File...">
<!ENTITY browseFile.accesskey "c">
<!ENTITY useDefault.label "Restore Default">
<!ENTITY useDefault.accesskey "r">
<!ENTITY toolbarIntro.label "Select the buttons you want to see in the toolbars">