mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 169489. Preferences panel for Keyboard Navigation and Find As You Type. r=samir, jag. sr=dveditz, ui approval from Jatin, others
This commit is contained in:
parent
f88e30a75d
commit
802a4d2354
@ -22,6 +22,8 @@ comm.jar:
|
||||
content/communicator/pref/pref-cache.xul (prefwindow/resources/content/pref-cache.xul)
|
||||
content/communicator/pref/pref-colors.js (prefwindow/resources/content/pref-colors.js)
|
||||
content/communicator/pref/pref-colors.xul (prefwindow/resources/content/pref-colors.xul)
|
||||
content/communicator/pref/pref-keynav.js (prefwindow/resources/content/pref-keynav.js)
|
||||
content/communicator/pref/pref-keynav.xul (prefwindow/resources/content/pref-keynav.xul)
|
||||
content/communicator/pref/pref-download.xul (prefwindow/resources/content/pref-download.xul)
|
||||
content/communicator/pref/pref-help.js (prefwindow/resources/content/pref-help.js)
|
||||
content/communicator/pref/pref-themes.xul (prefwindow/resources/content/pref-themes.xul)
|
||||
@ -120,6 +122,7 @@ en-US.jar:
|
||||
locale/en-US/communicator/pref/pref-debug.dtd (prefwindow/resources/locale/en-US/pref-debug.dtd)
|
||||
locale/en-US/communicator/pref/pref-debug1.dtd (prefwindow/resources/locale/en-US/pref-debug1.dtd)
|
||||
locale/en-US/communicator/pref/pref-debug2.dtd (prefwindow/resources/locale/en-US/pref-debug2.dtd)
|
||||
locale/en-US/communicator/pref/pref-keynav.dtd (prefwindow/resources/locale/en-US/pref-keynav.dtd)
|
||||
locale/en-US/communicator/pref/pref-download.dtd (prefwindow/resources/locale/en-US/pref-download.dtd)
|
||||
locale/en-US/communicator/pref/pref-fonts.dtd (prefwindow/resources/locale/en-US/pref-fonts.dtd)
|
||||
locale/en-US/communicator/pref/pref-history.dtd (prefwindow/resources/locale/en-US/pref-history.dtd)
|
||||
|
99
xpfe/components/prefwindow/resources/content/pref-keynav.js
Normal file
99
xpfe/components/prefwindow/resources/content/pref-keynav.js
Normal file
@ -0,0 +1,99 @@
|
||||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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.org Code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Aaron Leventhal
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2003
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Aaron Leventhal
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
var gTabNavPref = 7;
|
||||
var linksOnlyPref = 1;
|
||||
const kTabToLinks = 4
|
||||
const kTabToForms = 2;
|
||||
var prefsTreeNode = parent.document.getElementById("prefsTree");
|
||||
const pref = Components.classes["@mozilla.org/preferences;1"].
|
||||
getService(Components.interfaces.nsIPref);
|
||||
parent.hPrefWindow.registerOKCallbackFunc(saveKeyNavPrefs);
|
||||
|
||||
function initPrefs()
|
||||
{
|
||||
try {
|
||||
if (prefsTreeNode.hasAttribute('tabnavpref'))
|
||||
gTabNavPref = prefsTreeNode.getAttribute('tabnavpref');
|
||||
else
|
||||
gTabNavPref = pref.GetIntPref('accessibility.tabfocus');
|
||||
gTabNavPref |= 1; // Textboxes are always part of the tab order
|
||||
|
||||
document.getElementById('tabNavigationLinks').setChecked((gTabNavPref & kTabToLinks) != 0);
|
||||
document.getElementById('tabNavigationForms').setChecked((gTabNavPref & kTabToForms) != 0);
|
||||
|
||||
// XXX todo: On the mac, only the links checkbox should be exposed.
|
||||
// Whether the other form controls are tabbable is a system setting
|
||||
// that we should adhere to.
|
||||
|
||||
if (prefsTreeNode.hasAttribute('linksonlypref'))
|
||||
linksOnlyPref = prefsTreeNode.getAttribute('linksonlypref');
|
||||
else
|
||||
linksOnlyPref = pref.GetBoolPref('accessibility.typeaheadfind.linksonly')? 1: 0;
|
||||
var radioGroup = document.getElementById('findAsYouTypeAutoWhat');
|
||||
radioGroup.selectedIndex = linksOnlyPref;
|
||||
setLinksOnlyDisabled();
|
||||
}
|
||||
catch(e) {dump('\npref-keynav.initPrefs: ' + e);}
|
||||
}
|
||||
|
||||
function setLinksOnlyDisabled()
|
||||
{
|
||||
try {
|
||||
document.getElementById('findAsYouTypeAutoWhat').disabled =
|
||||
(document.getElementById('findAsYouTypeEnableAuto').checked == false);
|
||||
}
|
||||
catch(e) {dump('\npref-keynav.xul, setLinksOnlyDisabled: ' + e);}
|
||||
}
|
||||
|
||||
function holdKeyNavPrefs()
|
||||
{
|
||||
try {
|
||||
prefsTreeNode.setAttribute('tabnavpref', gTabNavPref);
|
||||
prefsTreeNode.setAttribute('linksonlypref', linksOnlyPref);
|
||||
}
|
||||
catch(e) {dump('\npref-keynav.xul, holdKeyNavPrefs: ' + e);}
|
||||
}
|
||||
|
||||
function saveKeyNavPrefs()
|
||||
{
|
||||
try {
|
||||
pref.SetIntPref('accessibility.tabfocus', gTabNavPref);
|
||||
pref.SetBoolPref('accessibility.typeaheadfind.linksonly', linksOnlyPref == 1);
|
||||
}
|
||||
catch(e) {dump('\npref-keynav.xul, saveKeyNavPrefs: ' + e);}
|
||||
}
|
94
xpfe/components/prefwindow/resources/content/pref-keynav.xul
Normal file
94
xpfe/components/prefwindow/resources/content/pref-keynav.xul
Normal file
@ -0,0 +1,94 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla 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/MPL/
|
||||
-
|
||||
- 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.org Code.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Netscape Communications Corporation.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2003
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s): Aaron Leventhal
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
|
||||
<?xul-overlay href="chrome://communicator/content/communicatorOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE page SYSTEM "chrome://communicator/locale/pref/pref-keynav.dtd" >
|
||||
|
||||
<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="parent.initPanel('chrome://communicator/content/pref/pref-keynav.xul'); initPrefs();"
|
||||
headertitle="&lHeader;" oncommand="holdKeyNavPrefs();">
|
||||
|
||||
<script type="application/x-javascript"
|
||||
src="chrome://communicator/content/pref/pref-keynav.js"/>
|
||||
|
||||
<script type="application/x-javascript">
|
||||
<![CDATA[
|
||||
var _elementIDs = ["findAsYouTypeEnableAuto", "findAsYouTypeSound",
|
||||
"findAsYouTypeTimeout"];
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<groupbox align="start">
|
||||
<caption label="&tabNavigationBehavior.label;"/>
|
||||
<description value="&tabNavigationDesc.label;"/>
|
||||
<!-- gTabNavPref var and kTabTo* consts are declared in pref-keynav.js -->
|
||||
<checkbox id="tabNavigationLinks" label="&tabNavigationLinks.label;"
|
||||
accesskey="&tabNavigationLinks.accesskey;"
|
||||
oncommand="gTabNavPref ^= kTabToLinks;"/>
|
||||
<checkbox id="tabNavigationForms" label="&tabNavigationForms.label;"
|
||||
accesskey="&tabNavigationForms.accesskey;"
|
||||
oncommand="gTabNavPref ^= kTabToForms;"/>
|
||||
<description value="&tabNavigationTextboxes.label;"/>
|
||||
</groupbox>
|
||||
|
||||
<groupbox align="start">
|
||||
<caption label="&findAsYouTypeBehavior.label;"/>
|
||||
<checkbox id="findAsYouTypeEnableAuto" label="&findAsYouTypeEnableAuto.label;"
|
||||
prefstring="accessibility.typeaheadfind.autostart"
|
||||
oncommand="setLinksOnlyDisabled();"/>
|
||||
<radiogroup id="findAsYouTypeAutoWhat" style="margin-left: 2em"
|
||||
oncommand="linksOnlyPref = this.selectedIndex;">
|
||||
<radio value="0" label="&findAsYouTypeAutoText.label;"
|
||||
accesskey="&findAsYouTypeAutoText.accesskey;"/>
|
||||
<radio value="1" label="&findAsYouTypeAutoLinks.label;"
|
||||
accesskey="&findAsYouTypeAutoLinks.accesskey;"/>
|
||||
</radiogroup>
|
||||
<description>&findAsYouTypeTip.label;"</description>
|
||||
|
||||
<vbox class="box-padded" align="start">
|
||||
<separator class="thin" />
|
||||
<checkbox id="findAsYouTypeSound" label="&findAsYouTypeSound.label;"
|
||||
accesskey="&findAsYouTypeSound.accesskey;"
|
||||
prefstring="accessibility.typeaheadfind.enablesound"/>
|
||||
<checkbox id="findAsYouTypeTimeout" label="&findAsYouTypeTimeout.label;"
|
||||
accesskey="&findAsYouTypeTimeout.accesskey;"
|
||||
prefstring="accessibility.typeaheadfind.enabletimeout"/>
|
||||
</vbox>
|
||||
</groupbox>
|
||||
</page>
|
@ -25,7 +25,7 @@
|
||||
|
||||
<?xul-overlay href="chrome://communicator/content/pref/platformPrefOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE overlay SYSTEM "chrome://communicator/locale/pref/preftree.dtd" >
|
||||
<!DOCTYPE overlay SYSTEM "chrome://communicator/locale/pref/preftree.dtd">
|
||||
|
||||
<overlay id="prefTreeOverlay"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
@ -132,6 +132,11 @@
|
||||
<treecell url="chrome://communicator/content/pref/pref-scripts.xul" label="&scriptsAndWindows.label;"/>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
<treeitem>
|
||||
<treerow>
|
||||
<treecell url="chrome://communicator/content/pref/pref-keynav.xul" label="&keynav.label;"/>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
<treeitem>
|
||||
<treerow>
|
||||
<treecell url="chrome://communicator/content/pref/pref-cache.xul" label="&cache.label;"/>
|
||||
|
@ -0,0 +1,21 @@
|
||||
<!ENTITY lHeader "Keyboard Navigation">
|
||||
<!ENTITY tabNavigationBehavior.label "Tab Key Navigation">
|
||||
<!ENTITY tabNavigationLinks.label "Links">
|
||||
<!ENTITY tabNavigationLinks.accesskey "L">
|
||||
<!ENTITY tabNavigationForms.label "Buttons, radio buttons, checkboxes, and lists">
|
||||
<!ENTITY tabNavigationForms.accesskey "B">
|
||||
<!ENTITY tabNavigationTextboxes.label "Note: text boxes are always part of the tabbing order.">
|
||||
<!ENTITY tabNavigationDesc.label "When Tab or Shift+Tab is pressed, move between:">
|
||||
<!ENTITY findAsYouTypeBehavior.label "Find As You Type">
|
||||
<!ENTITY findAsYouTypeTip.label "Tip: to manually start Find As You Type, type / to find text or ' to find links, followed by the text you want to find.">
|
||||
<!ENTITY findAsYouTypeTimeout.label "Clear the current search after a few seconds of inactivity">
|
||||
<!ENTITY findAsYouTypeTimeout.accesskey "C">
|
||||
<!ENTITY findAsYouTypeSound.label "Play a sound when typed text isn't found">
|
||||
<!ENTITY findAsYouTypeSound.accesskey "P">
|
||||
<!ENTITY findAsYouTypeEnableAuto.label "Find automatically when typing within a web page:">
|
||||
<!ENTITY findAsYouTypeEnableAuto.accesskey "a">
|
||||
<!ENTITY findAsYouTypeAutoText.label "Any text in the page">
|
||||
<!ENTITY findAsYouTypeAutoText.accesskey "A">
|
||||
<!ENTITY findAsYouTypeAutoLinks.label "Links only">
|
||||
<!ENTITY findAsYouTypeAutoLinks.accesskey "o">
|
||||
|
@ -29,6 +29,7 @@
|
||||
<!ENTITY debug1.label "Events">
|
||||
<!ENTITY debug2.label "Networking">
|
||||
<!ENTITY download.label "Downloads">
|
||||
<!ENTITY keynav.label "Keyboard Navigation">
|
||||
<!ENTITY search.label "Internet Search">
|
||||
<!ENTITY policies.label "Security Policies">
|
||||
<!ENTITY mousewheel.label "Mouse Wheel">
|
||||
|
@ -43,6 +43,25 @@
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="selectedIndex">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var children = this._getRadioChildren();
|
||||
for (var i = 0; i < children.length; ++i) {
|
||||
if (children[i].selected)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
]]>
|
||||
</getter>
|
||||
<setter>
|
||||
<![CDATA[
|
||||
this.selectedItem = this._getRadioChildren()[val];
|
||||
return val;
|
||||
]]>
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<property name="selectedItem">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
|
Loading…
Reference in New Issue
Block a user