Bug 193966. Keyboard navigation prefs don't get set if clicking on OK in a different prefs panel. r=samir, sr=jag

This commit is contained in:
aaronl%netscape.com 2003-03-06 18:55:54 +00:00
Родитель a24f59a714
Коммит 4d4d0d8c29
2 изменённых файлов: 28 добавлений и 47 удалений

Просмотреть файл

@ -35,40 +35,32 @@
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
var gTabNavPref = 7;
var linksOnlyPref = 1;
const kTabToLinks = 4 const kTabToLinks = 4
const kTabToForms = 2; const kTabToForms = 2;
var prefsTreeNode = parent.document.getElementById("prefsTree"); parent.hPrefWindow.registerOKCallbackFunc(saveKeyNavPrefs);
const pref = Components.classes["@mozilla.org/preferences;1"]. var gData;
getService(Components.interfaces.nsIPref);
parent.hPrefWindow.registerOKCallbackFunc(saveKeyNavPrefs);
function initPrefs() function initPrefs()
{ {
try { gData = parent.hPrefWindow.wsm.dataManager.pageData["chrome://communicator/content/pref/pref-keynav.xul"];
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); if (!("tabNavPref" in gData)) {
document.getElementById('tabNavigationForms').setChecked((gTabNavPref & kTabToForms) != 0); // Textboxes are always part of the tab order
gData.tabNavPref = parent.hPrefWindow.getPref('int', 'accessibility.tabfocus') | 1;
// XXX todo: On the mac, only the links checkbox should be exposed. gData.linksOnlyPref = parent.hPrefWindow.getPref('bool', 'accessibility.typeaheadfind.linksonly')? 1: 0;
// 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);}
document.getElementById('tabNavigationLinks').setChecked((gData.tabNavPref & kTabToLinks) != 0);
document.getElementById('tabNavigationForms').setChecked((gData.tabNavPref & 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.
var radioGroup = document.getElementById('findAsYouTypeAutoWhat');
radioGroup.selectedIndex = gData.linksOnlyPref;
setLinksOnlyDisabled();
} }
function setLinksOnlyDisabled() function setLinksOnlyDisabled()
@ -77,23 +69,12 @@ function setLinksOnlyDisabled()
document.getElementById('findAsYouTypeAutoWhat').disabled = document.getElementById('findAsYouTypeAutoWhat').disabled =
(document.getElementById('findAsYouTypeEnableAuto').checked == false); (document.getElementById('findAsYouTypeEnableAuto').checked == false);
} }
catch(e) {dump('\npref-keynav.xul, setLinksOnlyDisabled: ' + e);} catch(e) {}
}
function holdKeyNavPrefs()
{
try {
prefsTreeNode.setAttribute('tabnavpref', gTabNavPref);
prefsTreeNode.setAttribute('linksonlypref', linksOnlyPref);
}
catch(e) {dump('\npref-keynav.xul, holdKeyNavPrefs: ' + e);}
} }
function saveKeyNavPrefs() function saveKeyNavPrefs()
{ {
try { var data = parent.hPrefWindow.wsm.dataManager.pageData["chrome://communicator/content/pref/pref-keynav.xul"];
pref.SetIntPref('accessibility.tabfocus', gTabNavPref); parent.hPrefWindow.setPref("int", "accessibility.tabfocus", data.tabNavPref);
pref.SetBoolPref('accessibility.typeaheadfind.linksonly', linksOnlyPref == 1); parent.hPrefWindow.setPref("bool", "accessibility.typeaheadfind.linksonly", data.linksOnlyPref == 1);
}
catch(e) {dump('\npref-keynav.xul, saveKeyNavPrefs: ' + e);}
} }

Просмотреть файл

@ -42,7 +42,7 @@
<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" <page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="parent.initPanel('chrome://communicator/content/pref/pref-keynav.xul'); initPrefs();" onload="parent.initPanel('chrome://communicator/content/pref/pref-keynav.xul'); initPrefs();"
headertitle="&lHeader;" oncommand="holdKeyNavPrefs();"> headertitle="&lHeader;">
<script type="application/x-javascript" <script type="application/x-javascript"
src="chrome://communicator/content/pref/pref-keynav.js"/> src="chrome://communicator/content/pref/pref-keynav.js"/>
@ -57,13 +57,13 @@
<groupbox align="start"> <groupbox align="start">
<caption label="&tabNavigationBehavior.label;"/> <caption label="&tabNavigationBehavior.label;"/>
<description value="&tabNavigationDesc.label;"/> <description value="&tabNavigationDesc.label;"/>
<!-- gTabNavPref var and kTabTo* consts are declared in pref-keynav.js --> <!-- gData var and kTabTo* consts are declared in pref-keynav.js -->
<checkbox id="tabNavigationLinks" label="&tabNavigationLinks.label;" <checkbox id="tabNavigationLinks" label="&tabNavigationLinks.label;"
accesskey="&tabNavigationLinks.accesskey;" accesskey="&tabNavigationLinks.accesskey;"
oncommand="gTabNavPref ^= kTabToLinks;"/> oncommand="gData.tabNavPref ^= kTabToLinks;"/>
<checkbox id="tabNavigationForms" label="&tabNavigationForms.label;" <checkbox id="tabNavigationForms" label="&tabNavigationForms.label;"
accesskey="&tabNavigationForms.accesskey;" accesskey="&tabNavigationForms.accesskey;"
oncommand="gTabNavPref ^= kTabToForms;"/> oncommand="gData.tabNavPref ^= kTabToForms;"/>
<description value="&tabNavigationTextboxes.label;"/> <description value="&tabNavigationTextboxes.label;"/>
</groupbox> </groupbox>
@ -73,7 +73,7 @@
prefstring="accessibility.typeaheadfind.autostart" prefstring="accessibility.typeaheadfind.autostart"
oncommand="setLinksOnlyDisabled();"/> oncommand="setLinksOnlyDisabled();"/>
<radiogroup id="findAsYouTypeAutoWhat" style="margin-left: 2em" <radiogroup id="findAsYouTypeAutoWhat" style="margin-left: 2em"
oncommand="linksOnlyPref = this.selectedIndex;"> oncommand="gData.linksOnlyPref = this.selectedIndex;">
<radio value="0" label="&findAsYouTypeAutoText.label;" <radio value="0" label="&findAsYouTypeAutoText.label;"
accesskey="&findAsYouTypeAutoText.accesskey;"/> accesskey="&findAsYouTypeAutoText.accesskey;"/>
<radio value="1" label="&findAsYouTypeAutoLinks.label;" <radio value="1" label="&findAsYouTypeAutoLinks.label;"