зеркало из https://github.com/mozilla/pjs.git
Bug 172012: clean up pref-navigator.*. r=bryner, sr=hewitt
This commit is contained in:
Родитель
f1d250353c
Коммит
cb954d57d2
|
@ -158,7 +158,6 @@ pref("browser.search.basic.min_ver", "0.0");
|
|||
pref("browser.urlbar.autocomplete.enabled", true);
|
||||
pref("browser.urlbar.clickSelectsAll", true);
|
||||
|
||||
pref("browser.history.last_page_visited", "");
|
||||
pref("browser.history_expire_days", 9);
|
||||
pref("browser.history.grouping", "day");
|
||||
pref("browser.sessionhistory.max_entries", 50);
|
||||
|
|
|
@ -48,7 +48,6 @@ const FILEPICKER_CONTRACTID = "@mozilla.org/filepicker;1";
|
|||
const WINDOWMEDIATOR_CONTRACTID = "@mozilla.org/appshell/window-mediator;1";
|
||||
const PREFSERVICE_CONTRACTID = "@mozilla.org/preferences-service;1";
|
||||
|
||||
var gData;
|
||||
var gDefaultPage;
|
||||
|
||||
function selectFile()
|
||||
|
@ -112,57 +111,16 @@ function getDefaultPage()
|
|||
nsIPrefLocalizedString).data;
|
||||
}
|
||||
|
||||
function Startup()
|
||||
function locationInputHandler()
|
||||
{
|
||||
var radiogroup = document.getElementById("startupPage");
|
||||
radiogroup.addEventListener("RadioStateChange", onRadioCheck, false);
|
||||
|
||||
var textbox = document.getElementById("browserStartupHomepage");
|
||||
textbox.addEventListener("input", updateHomePageButtons, false);
|
||||
|
||||
updateHomePageButtons();
|
||||
|
||||
gData = parent.hPrefWindow.wsm.dataManager
|
||||
.pageData["chrome://communicator/content/pref/pref-navigator.xul"];
|
||||
|
||||
if (!("navigatorData" in gData)) {
|
||||
gData.navigatorData = [];
|
||||
gData.navigatorData["startupPage"] = [];
|
||||
gData.navigatorData["startupPage"].changed = false;
|
||||
gData.navigatorData["startupPage"].originalValue = radiogroup.value;
|
||||
gData.navigatorData["startupPage"].value = radiogroup.value;
|
||||
}
|
||||
|
||||
gDefaultPage = getDefaultPage();
|
||||
parent.hPrefWindow.registerOKCallbackFunc(doOnOk);
|
||||
}
|
||||
|
||||
function doOnOk()
|
||||
function Startup()
|
||||
{
|
||||
var newPrefValue;
|
||||
updateHomePageButtons();
|
||||
|
||||
// We'll have a null gData if we are clicking OK from a different pref panel.
|
||||
// Doing |if (!gData)| will throw an exception so just try and get the value,
|
||||
// and set gData if we don't yet have it.
|
||||
try {
|
||||
newPrefValue = gData.navigatorData["startupPage"].value;
|
||||
}
|
||||
catch(ex) {
|
||||
gData = parent.hPrefWindow.wsm.dataManager
|
||||
.pageData["chrome://communicator/content/pref/pref-navigator.xul"];
|
||||
newPrefValue = gData.navigatorData["startupPage"].value;
|
||||
}
|
||||
|
||||
if (gData.navigatorData["startupPage"].changed) {
|
||||
// if our home page isn't the last page visited anymore,
|
||||
// set the last_page_visited to "" for privacy reasons.
|
||||
if (gData.navigatorData["startupPage"].originalValue == 2) {
|
||||
parent.hPrefWindow.setPref("string", "browser.history.last_page_visited", "");
|
||||
}
|
||||
else if (newPrefValue == 2) {
|
||||
parent.hPrefWindow.setPref("string", "browser.history.last_page_visited", getCurrentPage());
|
||||
}
|
||||
}
|
||||
gDefaultPage = getDefaultPage();
|
||||
}
|
||||
|
||||
function updateHomePageButtons()
|
||||
|
@ -174,9 +132,3 @@ function updateHomePageButtons()
|
|||
defaultPageButton.disabled = (homepage == gDefaultPage);
|
||||
}
|
||||
|
||||
function onRadioCheck(event)
|
||||
{
|
||||
gData.navigatorData["startupPage"].value = document.getElementById("startupPage").value;
|
||||
gData.navigatorData["startupPage"].changed =
|
||||
gData.navigatorData["startupPage"].value != gData.navigatorData["startupPage"].originalValue;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,8 @@
|
|||
<hbox align="center">
|
||||
<label value="&location.label;" accesskey="&location.accesskey;" control="browserStartupHomepage"/>
|
||||
<textbox id="browserStartupHomepage" type="autocomplete" flex="1"
|
||||
searchSessions="history" timeout="50" maxrows="6" preftype="localizedstring"
|
||||
searchSessions="history" timeout="50" maxrows="6"
|
||||
oninput="locationInputHandler();" preftype="localizedstring"
|
||||
prefstring="browser.startup.homepage"/> <!-- we may wish to change this to data
|
||||
when we support fancy formatted local filenames -->
|
||||
</hbox>
|
||||
|
|
Загрузка…
Ссылка в новой задаче