84809 - autocomplete prefs customization, r=matt, sr=blake

This commit is contained in:
hewitt%netscape.com 2006-05-17 02:31:10 +00:00
parent f81179e161
commit 2113726a81
7 changed files with 157 additions and 5 deletions

View File

@ -0,0 +1,120 @@
<?xml version="1.0"?>
<!--
The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
Contributor(s):
Joe Hewitt <hewitt@netscape.com>
-->
<!DOCTYPE window SYSTEM "chrome://communicator/locale/pref/pref-smart_browsing.dtd" >
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://communicator/skin/dialogOverlay.css" type="text/css"?>
<?xml-stylesheet href="chrome://communicator/skin/prefpanels.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
<window id="pref-smart_browsing-ac" title="&autoCompleteAdvanced.title;"
orient="vertical"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript"><![CDATA[
window.onload = function()
{
doSetOKCancel(onOk);
setCheck("cbxAutoFill", window.arguments[0]);
setCheck("cbxShowPopup", window.arguments[1]);
setCheck("cbxShowSearch", window.arguments[2]);
updateImage("AutoFill");
updateImage("ShowPopup");
updateImage("ShowSearch");
updateShowPopup();
}
function onOk()
{
window.opener.receiveACPrefs(getCheck("cbxAutoFill"),
getCheck("cbxShowPopup"),
getCheck("cbxShowSearch"));
return true;
}
function getCheck(aName)
{
return document.getElementById(aName).checked;
}
function setCheck(aName, aTruth)
{
document.getElementById(aName).setAttribute("checked", aTruth);
}
function updateImage(aImg)
{
var img = document.getElementById("img"+aImg);
var checked = document.getElementById("cbx"+aImg).checked;
if (aImg == "AutoFill") {
img.setAttribute("src", "chrome://communicator/content/pref/autocomplete-autofill-"+(checked?"on":"off")+".gif");
} else if (aImg == "ShowPopup") {
img.setAttribute("hidden", !checked);
updateImage("ShowSearch");
} else if (aImg == "ShowSearch") {
var checked2 = document.getElementById("cbxShowPopup").checked;
img.setAttribute("hidden", !checked2 || !checked);
}
}
function updateShowPopup()
{
var spChecked = document.getElementById("cbxShowPopup").checked;
var showSearch = document.getElementById("cbxShowSearch");
showSearch.disabled = !spChecked;
}
]]></script>
<groupbox>
<label value="&autoCompleteAdvanced.title;"/>
<vbox>
<checkbox id="cbxAutoFill" label="&autoCompleteAutoFill.label;"
oncommand="updateImage('AutoFill')"/>
<checkbox id="cbxShowPopup" label="&autoCompleteShowPopup.label;"
oncommand="updateShowPopup(); updateImage('ShowPopup')"/>
<checkbox id="cbxShowSearch" label="&autoCompleteShowSearch.label;"
oncommand="updateImage('ShowSearch')"/>
</vbox>
</groupbox>
<text class="label" value="&autocompletePreview.label;"/>
<vbox id="bxExample" class="box-smallheader">
<vbox height="159">
<image id="imgAutoFill"/>
<image id="imgShowPopup" src="chrome://communicator/content/pref/autocomplete-showpopup.gif"/>
<image id="imgShowSearch" src="chrome://communicator/content/pref/autocomplete-showsearch.gif"/>
</vbox>
</vbox>
<hbox id="okCancelButtonsRight"/>
</window>

View File

@ -45,7 +45,8 @@
<![CDATA[
var _elementIDs = ["browserRelatedDisabledForDomains", "addDomain",
"browserGoBrowsingEnabled", "browserAutoCompleteEnabled"];
"browserGoBrowsingEnabled", "browserAutoCompleteEnabled",
"browserUrlbarAutoFill", "browserUrlbarShowPopup", "browserUrlbarShowSearch"];
function Startup()
{
@ -178,7 +179,23 @@
window.openDialog( browserURL, "_blank", "chrome,all,dialog=no", smartBrowsingURL );
}
}
function showACAdvanced()
{
window.openDialog("chrome://communicator/content/pref/pref-smart_browsing-ac.xul", "",
"modal=yes,chrome,resizable=yes",
document.getElementById("browserUrlbarAutoFill").getAttribute("value"),
document.getElementById("browserUrlbarShowPopup").getAttribute("value"),
document.getElementById("browserUrlbarShowSearch").getAttribute("value"));
}
function receiveACPrefs(aAutoFill, aShowPopup, aShowSearch)
{
document.getElementById("browserUrlbarAutoFill").setAttribute("value", aAutoFill);
document.getElementById("browserUrlbarShowPopup").setAttribute("value", aShowPopup);
document.getElementById("browserUrlbarShowSearch").setAttribute("value", aShowSearch);
}
]]>
</script>
@ -209,7 +226,7 @@
</vbox>
</row>
<row>
<hbox align="center">
<hbox autostretch="never">
<text class="label small-margin" id="domainText" value="&domain.label;" accesskey="&domain.accesskey;" for="addDomain"/>
<textbox class="small-margin" id="addDomain" flex="1" oninput="doButtonEnabling();"
prefstring="pref.browser.smartbrowsing.disable_textbox.add" prefattribute="disabled"/>
@ -231,7 +248,7 @@
<html class="small-margin">&internetKeywordsDescription.label;</html>
<hbox align="center">
<hbox autostretch="never">
<checkbox class="small-margin" id="browserGoBrowsingEnabled" label="&keywordsEnabled.label;" accesskey="&keywordsEnabled.accesskey;"
pref="true" preftype="bool" prefstring="keyword.enabled"
prefattribute="checked"/>
@ -246,11 +263,18 @@
<groupbox orient="vertical">
<label value="&autoCompleteHeader.label;"/>
<html class="small-margin">&autoCompleteDescription.label;</html>
<hbox align="center">
<hbox autostretch="never">
<checkbox class="small-margin" id="browserAutoCompleteEnabled" label="&autoCompleteEnabled.label;" accesskey="&autoCompleteEnabled.accesskey;"
pref="true" preftype="bool" prefstring="browser.urlbar.autocomplete.enabled"
prefattribute="checked"/>
<spring flex="1"/>
<button label="&autoCompleteAdvanced.label;" oncommand="showACAdvanced()"/>
<data id="browserUrlbarAutoFill" pref="true" preftype="bool" prefattribute="value"
prefstring="browser.urlbar.autoFill"/>"
<data id="browserUrlbarShowPopup" pref="true" preftype="bool" prefattribute="value"
prefstring="browser.urlbar.showPopup"/>"
<data id="browserUrlbarShowSearch" pref="true" preftype="bool" prefattribute="value"
prefstring="browser.urlbar.showSearch"/>"
</hbox>
</groupbox>
</window>

Binary file not shown.

After

Width:  |  Height:  |  Size: 621 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 743 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 723 B

View File

@ -33,3 +33,11 @@
<!ENTITY autoCompleteDescription.label "Automatically completes text typed into the Location bar.">
<!ENTITY autoCompleteEnabled.label "Enable Location bar autocomplete">
<!ENTITY autoCompleteEnabled.accesskey "l">
<!ENTITY autoCompleteAdvanced.label "Advanced...">
<!ENTITY autoCompleteAdvanced.title "Autocomplete Preferences">
<!ENTITY autoCompleteAutoFill.label "Autocomplete best match as you type">
<!ENTITY autoCompleteShowPopup.label "Show list of matching results">
<!ENTITY autoCompleteShowSearch.label "Show internet search engine">
<!ENTITY autocompletePreview.label "Preview">