diff options
author | Pale Moon <git-repo@palemoon.org> | 2016-12-06 18:06:02 +0100 |
---|---|---|
committer | Pale Moon <git-repo@palemoon.org> | 2016-12-06 18:06:02 +0100 |
commit | 61fe0513d64d5fca0be7d812cf33dc002d745b8e (patch) | |
tree | 3d61c6240948f7685c658be0a55d39d261fb2748 | |
parent | 3a7a617fbac3fce8c00738522d4a0ef7e0d5a0be (diff) | |
download | palemoon-gre-61fe0513d64d5fca0be7d812cf33dc002d745b8e.tar.gz |
Update preferences with refactored location bar suggestion options.
This fixes #740.
-rw-r--r-- | browser/app/profile/firefox.js | 15 | ||||
-rw-r--r-- | browser/components/preferences/privacy.js | 23 | ||||
-rw-r--r-- | browser/components/preferences/privacy.xul | 46 | ||||
-rw-r--r-- | browser/locales/en-US/chrome/browser/preferences/privacy.dtd | 10 |
4 files changed, 46 insertions, 48 deletions
diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index a2f7c5bae..b4b33f568 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -283,13 +283,14 @@ pref("browser.urlbar.match.title", "#"); pref("browser.urlbar.match.url", "@"); // The default behavior for the urlbar can be configured to use any combination -// of the restrict or match filters with each additional filter restricting -// more (intersection). Add the following values to set the behavior as the -// default: 1: history, 2: bookmark, 4: tag, 8: title, 16: url, 32: typed, -// 64: javascript, 128: tabs -// E.g., 0 = show all results (no filtering), 1 = only visited pages in history, -// 2 = only bookmarks, 3 = visited bookmarks, 1+16 = history matching in the url -pref("browser.urlbar.default.behavior", 0); +// of the match filters with each additional filter adding more results (union). +pref("browser.urlbar.suggest.history", true); +pref("browser.urlbar.suggest.bookmark", true); +pref("browser.urlbar.suggest.openpage", true); + +// Restrictions to current suggestions can also be applied (intersection). +// Typed suggestion works only if history is set to true. +pref("browser.urlbar.suggest.history.onlyTyped", false); pref("browser.urlbar.formatting.enabled", true); pref("browser.urlbar.trimURLs", true); diff --git a/browser/components/preferences/privacy.js b/browser/components/preferences/privacy.js index 2a26fae7e..ebb47bd74 100644 --- a/browser/components/preferences/privacy.js +++ b/browser/components/preferences/privacy.js @@ -322,23 +322,16 @@ var gPrivacyPane = { }, /** - * Write the location bar enabled and suggestion prefs when necessary - * @return Bool value for enabled pref + * Update browser.urlbar.autocomplete.enabled when a + * browser.urlbar.suggest.* pref is changed from the ui. */ - writeSuggestionPref: function PPP_writeSuggestionPref() - { - let menuVal = document.getElementById("locationBarSuggestion").value; - let enabled = menuVal != -1; - - // Only update default.behavior if we're giving suggestions - if (enabled) { - // Put the selected menu item's value directly into the bottom 2 bits - let behavior = document.getElementById("browser.urlbar.default.behavior"); - behavior.value = behavior.value >> 2 << 2 | menuVal; + writeSuggestionPref: function PPP_writeSuggestionPref() { + let getVal = (aPref) => { + return document.getElementById("browser.urlbar.suggest." + aPref).value; } - - // Always update the enabled pref - return enabled; + // autocomplete.enabled is true if any of the suggestions is true + let enabled = ["history", "bookmark", "openpage"].map(getVal).some(v => v); + Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", enabled); }, /* diff --git a/browser/components/preferences/privacy.xul b/browser/components/preferences/privacy.xul index d85523d1d..37e05c202 100644 --- a/browser/components/preferences/privacy.xul +++ b/browser/components/preferences/privacy.xul @@ -42,10 +42,15 @@ <preference id="browser.urlbar.autocomplete.enabled" name="browser.urlbar.autocomplete.enabled" type="bool"/> - <preference id="browser.urlbar.default.behavior" - name="browser.urlbar.default.behavior" - type="int" - onchange="document.getElementById('browser.urlbar.autocomplete.enabled').updateElements();"/> + <preference id="browser.urlbar.suggest.bookmark" + name="browser.urlbar.suggest.bookmark" + type="bool"/> + <preference id="browser.urlbar.suggest.history" + name="browser.urlbar.suggest.history" + type="bool"/> + <preference id="browser.urlbar.suggest.openpage" + name="browser.urlbar.suggest.openpage" + type="bool"/> <!-- History --> <preference id="places.history.enabled" @@ -242,23 +247,22 @@ <groupbox id="locationBarGroup"> <caption label="&locationBar.label;"/> - <hbox align="center"> - <label id="locationBarSuggestionLabel" - control="locationBarSuggestion" - accesskey="&locbar.pre.accessKey;">&locbar.pre.label;</label> - <menulist id="locationBarSuggestion" - preference="browser.urlbar.autocomplete.enabled" - onsyncfrompreference="return gPrivacyPane.readSuggestionPref();" - onsynctopreference="return gPrivacyPane.writeSuggestionPref();"> - <menupopup> - <menuitem label="&locbar.both.label;" value="0"/> - <menuitem label="&locbar.history.label;" value="1"/> - <menuitem label="&locbar.bookmarks.label;" value="2"/> - <menuitem label="&locbar.nothing.label;" value="-1"/> - </menupopup> - </menulist> - <label>&locbar.post.label;</label> - </hbox> + <label id="locationBarSuggestionLabel">&locbar.suggest.label;</label> + + <vbox id="tabPrefsBox" align="start" flex="1"> + <checkbox id="historySuggestion" label="&locbar.history.label;" + onsyncfrompreference="return gPrivacyPane.writeSuggestionPref();" + accesskey="&locbar.history.accesskey;" + preference="browser.urlbar.suggest.history"/> + <checkbox id="bookmarkSuggestion" label="&locbar.bookmarks.label;" + onsyncfrompreference="return gPrivacyPane.writeSuggestionPref();" + accesskey="&locbar.bookmarks.accesskey;" + preference="browser.urlbar.suggest.bookmark"/> + <checkbox id="openpageSuggestion" label="&locbar.openpage.label;" + onsyncfrompreference="return gPrivacyPane.writeSuggestionPref();" + accesskey="&locbar.openpage.accesskey;" + preference="browser.urlbar.suggest.openpage"/> + </vbox> </groupbox> </prefpane> diff --git a/browser/locales/en-US/chrome/browser/preferences/privacy.dtd b/browser/locales/en-US/chrome/browser/preferences/privacy.dtd index d8ce26a05..eae607092 100644 --- a/browser/locales/en-US/chrome/browser/preferences/privacy.dtd +++ b/browser/locales/en-US/chrome/browser/preferences/privacy.dtd @@ -16,13 +16,13 @@ <!ENTITY locationBar.label "Location Bar"> -<!ENTITY locbar.pre.label "When using the location bar, suggest:"> -<!ENTITY locbar.pre.accessKey "u"> -<!ENTITY locbar.post.label ""> -<!ENTITY locbar.both.label "History and Bookmarks"> +<!ENTITY locbar.suggest.label "When using the location bar, suggest:"> <!ENTITY locbar.history.label "History"> +<!ENTITY locbar.history.accesskey "H"> <!ENTITY locbar.bookmarks.label "Bookmarks"> -<!ENTITY locbar.nothing.label "Nothing"> +<!ENTITY locbar.bookmarks.accesskey "k"> +<!ENTITY locbar.openpage.label "Open tabs"> +<!ENTITY locbar.openpage.accesskey "O"> <!ENTITY acceptCookies.label "Accept cookies from sites"> <!ENTITY acceptCookies.accesskey "A"> |