зеркало из https://github.com/mozilla/gecko-dev.git
Prefs tweaks in preparation for 0.1
This commit is contained in:
Родитель
00b25b97bf
Коммит
1a81e4574f
|
@ -30,7 +30,9 @@
|
|||
onload="parent.initPanel('chrome://communicator/content/pref/pref-advanced.xul');"
|
||||
headertitle="&lHeader;">
|
||||
|
||||
<description>All your favorite geeky, advanced prefs will be making a comeback in the near future.</description>
|
||||
<spacer flex="1"/>
|
||||
<description>All your favorite prefs will be making a comeback in the near future.</description>
|
||||
<spacer flex="1"/>
|
||||
</page>
|
||||
|
||||
|
||||
|
|
|
@ -11,40 +11,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";
|
||||
|
||||
function Startup()
|
||||
{
|
||||
var clearHistButton = document.getElementById("browserClearHistory");
|
||||
try {
|
||||
var urlBarHist = Components.classes["@mozilla.org/browser/urlbarhistory;1"]
|
||||
.getService(Components.interfaces.nsIUrlbarHistory);
|
||||
var isBtnLocked = parent.hPrefWindow.getPrefIsLocked(clearHistButton.getAttribute("prefstring"));
|
||||
var globalHistory = Components.classes["@mozilla.org/browser/global-history;1"]
|
||||
.getService(Components.interfaces.nsIBrowserHistory);
|
||||
clearHistButton.disabled = ( urlBarHist.count == 0 && globalHistory.count == 0) || isBtnLocked;
|
||||
}
|
||||
catch(ex) {
|
||||
}
|
||||
}
|
||||
|
||||
function selectFile()
|
||||
{
|
||||
var fp = Components.classes[FILEPICKER_CONTRACTID]
|
||||
.createInstance(nsIFilePicker);
|
||||
|
||||
var prefutilitiesBundle = document.getElementById("bundle_prefutilities");
|
||||
var title = prefutilitiesBundle.getString("choosehomepage");
|
||||
fp.init(window, title, nsIFilePicker.modeOpen);
|
||||
fp.appendFilters(nsIFilePicker.filterAll | nsIFilePicker.filterText |
|
||||
nsIFilePicker.filterXML | nsIFilePicker.filterHTML |
|
||||
nsIFilePicker.filterImages);
|
||||
|
||||
var ret = fp.show();
|
||||
if (ret == nsIFilePicker.returnOK) {
|
||||
var folderField = document.getElementById("browserStartupHomepage");
|
||||
folderField.value = fp.fileURL.spec;
|
||||
}
|
||||
}
|
||||
|
||||
function setHomePageToCurrentPage()
|
||||
{
|
||||
var windowManager = Components.classes[WINDOWMEDIATOR_CONTRACTID]
|
||||
|
@ -71,13 +37,3 @@ function setHomePageToDefaultPage()
|
|||
var homePageField = document.getElementById("browserStartupHomepage");
|
||||
homePageField.value = url;
|
||||
}
|
||||
|
||||
function prefClearGlobalHistory()
|
||||
{
|
||||
var globalHistory = Components.classes["@mozilla.org/browser/global-history;1"]
|
||||
.getService(Components.interfaces.nsIBrowserHistory);
|
||||
globalHistory.removeAllPages();
|
||||
var urlBarHistory = Components.classes["@mozilla.org/browser/urlbarhistory;1"]
|
||||
.getService(Components.interfaces.nsIUrlbarHistory);
|
||||
urlBarHistory.clearHistory();
|
||||
}
|
||||
|
|
|
@ -36,23 +36,10 @@
|
|||
|
||||
<script type="application/x-javascript">
|
||||
<![CDATA[
|
||||
var _elementIDs = ["startupPage", "browserStartupHomepage"];
|
||||
var _elementIDs = ["browserStartupHomepage"];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<hbox id="pref-nav-platform-extensions">
|
||||
<!-- navigator starts with -->
|
||||
<groupbox flex="1">
|
||||
<caption label="&navRadio;"/>
|
||||
<radiogroup id="startupPage" prefstring="browser.startup.page">
|
||||
<radio value="0" label="&blankPageRadio.label;" accesskey="&blankPageRadio.accesskey;"/>
|
||||
<radio value="1" label="&homePageRadio.label;" accesskey="&homePageRadio.accesskey;"/>
|
||||
<radio value="2" label="&lastPageRadio.label;" accesskey="&lastPageRadio.accesskey;"/>
|
||||
</radiogroup>
|
||||
|
||||
</groupbox>
|
||||
</hbox>
|
||||
|
||||
<!-- homepage specification -->
|
||||
<groupbox>
|
||||
<caption label="&header2.label;"/>
|
||||
|
@ -70,16 +57,13 @@
|
|||
oncommand="setHomePageToCurrentPage();"
|
||||
id="browserUseCurrent"
|
||||
prefstring="pref.browser.homepage.disable_button.current_page"/>
|
||||
<button label="&browseFile.label;" accesskey="&browseFile.accesskey;"
|
||||
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"/>
|
||||
<button label="&useBlank.label;" accesskey="&useBlank.accesskey;"
|
||||
oncommand="document.getElementById('browserStartupHomepage').value = 'about:blank';"
|
||||
id="browserUseBlank"
|
||||
prefstring="pref.browser.homepage.disable_button.blank_page"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</groupbox>
|
||||
<groupbox id="pref-nav-platform-extensions"/>
|
||||
</page>
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
<stringbundle id="bundle_navigator"
|
||||
src="chrome://navigator/locale/navigator.properties"/>
|
||||
|
||||
<script type="application/x-javascript" src="chrome://communicator/content/pref/pref-themes.js"/>
|
||||
<script type="application/x-javascript" src="chrome://browser/content/pref/pref-themes.js"/>
|
||||
|
||||
<description>&skinIntro.label;</description>
|
||||
|
||||
|
|
|
@ -34,58 +34,14 @@
|
|||
<overlay id="platformPreferencesOverlay"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<!-- Windows integration is (obviously) only applicable on Windows. -->
|
||||
<treechildren id="advancedChildren">
|
||||
<treeitem id="winhooks">
|
||||
<treerow>
|
||||
<treecell url="chrome://communicator/content/pref/pref-winhooks.xul" label="&winhooks.label;"/>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
|
||||
<!-- Add "set default browser" button to Navigator panel. -->
|
||||
<hbox id="pref-nav-platform-extensions">
|
||||
<groupbox flex="1">
|
||||
<groupbox id="pref-nav-platform-extensions" orient="horizontal" align="center" pack="center">
|
||||
<caption label="&defaultBrowserGroup.label;"/>
|
||||
<deck id="defaultBrowserDeck" flex="1">
|
||||
<!-- We use a deck for the three cases:
|
||||
o If not already the default, then use child 0 (with button enabled)
|
||||
o If already the default, then use child 1 (with disabled button).
|
||||
o If the user has already pushed the "Set As Default" button, then use child 2
|
||||
(with different text and a disabled button).
|
||||
-->
|
||||
<vbox flex="1">
|
||||
<description>&makeDefaultText;</description>
|
||||
<hbox>
|
||||
<label value="&makeDefaultText;"/>
|
||||
<spacer flex="1"/>
|
||||
<button label="&defaultBrowserButton.label;"
|
||||
oncommand="makeDefault()"/>
|
||||
<spacer flex="1"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
<vbox flex="1">
|
||||
<description>&alreadyDefaultText;</description>
|
||||
<hbox>
|
||||
<spacer flex="1"/>
|
||||
<button label="&defaultBrowserButton.label;"
|
||||
autostretch="never"
|
||||
disabled="true"/>
|
||||
<spacer flex="1"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
<vbox flex="1">
|
||||
<description pack="start">&defaultPendingText;</description>
|
||||
<hbox>
|
||||
<spacer flex="1"/>
|
||||
<button label="&defaultBrowserButton.label;"
|
||||
autostretch="never"
|
||||
disabled="true"/>
|
||||
<spacer flex="1"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</deck>
|
||||
</groupbox>
|
||||
</hbox>
|
||||
<script type="application/x-javascript">
|
||||
<![CDATA[
|
||||
// This overlay is pulled into multiple places. We only want this
|
||||
|
@ -117,64 +73,6 @@
|
|||
parent.winHooks.prefs = parent.winHooks.winhooks.settings;
|
||||
}
|
||||
|
||||
// Ensure our additional state info is set.
|
||||
if (!("makeDefaultPending" in parent.winHooks)) {
|
||||
parent.winHooks.makeDefaultPending = false;
|
||||
}
|
||||
|
||||
// Figure out which <deck> child should be activated.
|
||||
// Default is child 0 (with button enabled).
|
||||
var deckState = 0;
|
||||
// Start by checking http/https/ftp and html/xhtml/xml.
|
||||
var prefs = parent.winHooks.prefs;
|
||||
if (prefs.isHandlingHTTP &&
|
||||
prefs.isHandlingHTTPS &&
|
||||
prefs.isHandlingFTP &&
|
||||
prefs.isHandlingHTML &&
|
||||
prefs.isHandlingXHTML &&
|
||||
prefs.isHandlingXML) {
|
||||
// The user *wants* us to be the default, apparently. This means
|
||||
// that the deck *might* be in one of the other two states (with
|
||||
// button disabled), depending on whether the registry matches.
|
||||
// We test the registry settings using a scratch copy of the
|
||||
// settings because we don't care about some of them, but we
|
||||
// don't want to mess up the user's choices from the
|
||||
// Advanced/System panel.
|
||||
var testSettings = parent.winHooks.winhooks.settings;
|
||||
// Test that these are set.
|
||||
testSettings.isHandlingHTTP = true;
|
||||
testSettings.isHandlingHTTPS = true;
|
||||
testSettings.isHandlingFTP = true;
|
||||
testSettings.isHandlingHTML = true;
|
||||
testSettings.isHandlingXHTML = true;
|
||||
testSettings.isHandlingXML = true;
|
||||
// Ignore the rest.
|
||||
testSettings.isHandlingCHROME = false;
|
||||
testSettings.isHandlingGOPHER = false;
|
||||
testSettings.isHandlingJPEG = false;
|
||||
testSettings.isHandlingGIF = false;
|
||||
testSettings.isHandlingMNG = false;
|
||||
testSettings.isHandlingPNG = false;
|
||||
testSettings.isHandlingBMP = false;
|
||||
testSettings.isHandlingICO = false;
|
||||
testSettings.isHandlingXUL = false;
|
||||
// Now test whether the registry matches that.
|
||||
if ( testSettings.registryMatches ) {
|
||||
// Disable the button. The only remaining question
|
||||
// is what text appears alongside it. That will
|
||||
// vary depending on whether the user has pressed
|
||||
// the "Set As Default" button already.
|
||||
if ( parent.winHooks.makeDefaultPending ) {
|
||||
deckState = 2;
|
||||
} else {
|
||||
deckState = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Now, switch the deck to the appropriate state.
|
||||
document.getElementById("defaultBrowserDeck").selectedIndex = deckState;
|
||||
|
||||
// Return true to tell caller to process the standard pref fields.
|
||||
return true;
|
||||
}
|
||||
|
@ -198,12 +96,6 @@
|
|||
// Apply the settings.
|
||||
parent.winHooks.winhooks.settings = parent.winHooks.prefs;
|
||||
} );
|
||||
|
||||
// Flip the deck to the "make-default pending" state.
|
||||
document.getElementById("defaultBrowserDeck").selectedIndex = 2;
|
||||
|
||||
// Remember this state when next displayed.
|
||||
parent.winHooks.makeDefaultPending = true;
|
||||
}
|
||||
}
|
||||
]]>
|
||||
|
|
Загрузка…
Ссылка в новой задаче