Move shortcut keys prefpane to tab of Advanced

[and delete unused "#zotero-prefpane-keys checkbox" (there used to be a checkbox to "Try to override conflicting shortcuts", which has been definely removed by 5b34dce40f )]
This commit is contained in:
gracile-fr 2015-03-05 15:33:20 +01:00 committed by gracile-fr
parent 1ac54c4b13
commit 0a4fcc90ac
9 changed files with 139 additions and 235 deletions

View file

@ -68,11 +68,6 @@
image="chrome://zotero/skin/prefs-styles.png"
src="chrome://zotero/content/preferences/preferences_cite.xul"/>
<prefpane id="zotero-prefpane-keys"
label="&zotero.preferences.prefpane.keys;"
image="chrome://zotero/skin/prefs-keys.png"
src="chrome://zotero/content/preferences/preferences_keys.xul"/>
<prefpane id="zotero-prefpane-advanced"
label="&zotero.preferences.prefpane.advanced;"
image="chrome://zotero/skin/prefs-advanced.png"

View file

@ -31,6 +31,7 @@ Zotero_Preferences.Advanced = {
init: function () {
Zotero_Preferences.Debug_Output.init();
Zotero_Preferences.Keys.init();
},
revealDataDirectory: function () {
@ -811,3 +812,33 @@ Zotero_Preferences.Debug_Output = {
}
}
};
Zotero_Preferences.Keys = {
init: function () {
var rows = document.getElementById('zotero-prefpane-advanced-keys-tab').getElementsByTagName('row');
for (var i=0; i<rows.length; i++) {
// Display the appropriate modifier keys for the platform
rows[i].firstChild.nextSibling.value = Zotero.isMac ? Zotero.getString('general.keys.cmdShift') : Zotero.getString('general.keys.ctrlShift');
}
var textboxes = document.getElementById('zotero-keys-rows').getElementsByTagName('textbox');
for (let i=0; i<textboxes.length; i++) {
let textbox = textboxes[i];
textbox.value = textbox.value.toUpperCase();
// .value takes care of the initial value, and this takes care of direct pref changes
// while the window is open
textbox.setAttribute('onsyncfrompreference', 'return Zotero_Preferences.Keys.capitalizePref(this.id)');
textbox.setAttribute('oninput', 'this.value = this.value.toUpperCase()');
}
},
capitalizePref: function (id) {
var elem = document.getElementById(id);
var pref = document.getElementById(elem.getAttribute('preference'));
if (pref.value) {
return pref.value.toUpperCase();
}
}
};

View file

@ -38,12 +38,24 @@
<preference id="pref-debug-output-enableAfterRestart" name="extensions.zotero.debug.store" type="bool"/>
<preference id="pref-openURL-resolver" name="extensions.zotero.openURL.resolver" type="string"/>
<preference id="pref-openURL-version" name="extensions.zotero.openURL.version" type="string"/>
<preference id="pref-keys-openZotero" name="extensions.zotero.keys.openZotero" type="string"/>
<preference id="pref-keys-saveToZotero" name="extensions.zotero.keys.saveToZotero" type="string"/>
<preference id="pref-keys-toggleFullscreen" name="extensions.zotero.keys.toggleFullscreen" type="string"/>
<preference id="pref-keys-library" name="extensions.zotero.keys.library" type="string"/>
<preference id="pref-keys-quicksearch" name="extensions.zotero.keys.quicksearch" type="string"/>
<preference id="pref-keys-toggleTagSelector" name="extensions.zotero.keys.toggleTagSelector" type="string"/>
<preference id="pref-keys-newItem" name="extensions.zotero.keys.newItem" type="string"/>
<preference id="pref-keys-newNote" name="extensions.zotero.keys.newNote" type="string"/>
<preference id="pref-keys-importFromClipboard" name="extensions.zotero.keys.importFromClipboard" type="string"/>
<preference id="pref-keys-copySelectedItemCitationsToClipboard" name="extensions.zotero.keys.copySelectedItemCitationsToClipboard" type="string"/>
<preference id="pref-keys-copySelectedItemsToClipboard" name="extensions.zotero.keys.copySelectedItemsToClipboard" type="string"/>
</preferences>
<tabbox id="zotero-prefpane-advanced-tabs">
<tabs>
<tab label="&zotero.preferences.prefpane.general;"/>
<tab label="&zotero.preferences.advanced.filesAndFolders;"/>
<tab label="&zotero.preferences.advanced.keys;"/>
</tabs>
<tabpanels id="zotero-prefpane-advanced-tabpanels">
@ -194,6 +206,75 @@
</hbox>
</groupbox>
</tabpanel>
<tabpanel id="zotero-prefpane-advanced-keys-tab" orient="vertical">
<grid id="zotero-keys-grid">
<columns>
<column flex="1"/>
<column/>
<column/>
</columns>
<rows id="zotero-keys-rows">
<row id="zotero-keys-new-item">
<label value="&zotero.preferences.keys.newItem;" control="textbox-newItem"/>
<label/>
<textbox id="textbox-newItem" maxlength="1" size="1" preference="pref-keys-newItem"/>
</row>
<row>
<label value="&zotero.preferences.keys.newNote;" control="textbox-newNote"/>
<label/>
<textbox id="textbox-newNote" maxlength="1" size="1" preference="pref-keys-newNote"/>
</row>
<row>
<label value="&zotero.preferences.keys.importFromClipboard;" control="textbox-importFromClipboard"/>
<label/>
<textbox id="textbox-importFromClipboard" maxlength="1" size="1" preference="pref-keys-importFromClipboard"/>
</row>
<row id="zotero-keys-focus-libraries-pane">
<label value="&zotero.preferences.keys.focusLibrariesPane;" control="textbox-library"/>
<label/>
<textbox id="textbox-library" maxlength="1" size="1" preference="pref-keys-library"/>
</row>
<row>
<label value="&zotero.preferences.keys.quicksearch;" control="textbox-quicksearch"/>
<label/>
<textbox id="textbox-quicksearch" maxlength="1" size="1" preference="pref-keys-quicksearch"/>
</row>
<row>
<label value="&zotero.preferences.keys.copySelectedItemCitationsToClipboard;" control="textbox-copySelectedItemCitationsToClipboard"/>
<label/>
<textbox id="textbox-copySelectedItemCitationsToClipboard" maxlength="1" size="1"
preference="pref-keys-copySelectedItemCitationsToClipboard"
onchange="if (Zotero_Preferences.Export) { Zotero_Preferences.Export.updateQuickCopyInstructions(); }"/>
</row>
<row>
<label value="&zotero.preferences.keys.copySelectedItemsToClipboard;" control="textbox-copySelectedItemsToClipboard"/>
<label/>
<textbox id="textbox-copySelectedItemsToClipboard" maxlength="1" size="1"
preference="pref-keys-copySelectedItemsToClipboard"
onchange="if (Zotero_Preferences.Export) { Zotero_Preferences.Export.updateQuickCopyInstructions(); }"/>
</row>
<row>
<label value="&zotero.preferences.keys.toggleTagSelector;" control="textbox-toggleTagSelector"/>
<label/>
<textbox id="textbox-toggleTagSelector" maxlength="1" size="1" preference="pref-keys-toggleTagSelector"/>
</row>
</rows>
</grid>
<label class="statusLine" value="&zotero.preferences.keys.changesTakeEffect;"/>
<separator/>
</tabpanel>
</tabpanels>
</tabbox>

View file

@ -45,6 +45,30 @@
insertbefore="zotero-prefpane-advanced-openbuttons"/>
</groupbox>
</tabpanel>
<tabpanel id="zotero-prefpane-advanced-keys-tab">
<grid id="zotero-keys-grid">
<rows id="zotero-keys-rows">
<row insertbefore="zotero-keys-new-item">
<label value="&zotero.preferences.keys.openZotero;" control="key-textbox-openZotero"/>
<label/>
<textbox id="textbox-openZotero" maxlength="1" size="1" preference="pref-keys-openZotero"/>
</row>
<row insertbefore="zotero-keys-new-item">
<label value="&zotero.preferences.keys.toggleFullscreen;" control="textbox-toggleFullscreen"/>
<label/>
<textbox id="textbox-toggleFullscreen" maxlength="1" size="1" preference="pref-keys-toggleFullscreen"/>
</row>
<row insertbefore="zotero-keys-new-item">
<label value="&zotero.preferences.keys.saveToZotero;" control="key-textbox-saveToZotero"/>
<label/>
<textbox id="textbox-saveToZotero" maxlength="1" size="1" preference="pref-keys-saveToZotero"/>
</row>
</rows>
</grid>
</tabpanel>
</tabpanels>
</tabbox>
</prefpane>

View file

@ -1,55 +0,0 @@
/*
***** BEGIN LICENSE BLOCK *****
Copyright © 20062013 Center for History and New Media
George Mason University, Fairfax, Virginia, USA
http://zotero.org
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
*/
"use strict";
Zotero_Preferences.Keys = {
init: function () {
var rows = document.getElementById('zotero-prefpane-keys').getElementsByTagName('row');
for (var i=0; i<rows.length; i++) {
// Display the appropriate modifier keys for the platform
rows[i].firstChild.nextSibling.value = Zotero.isMac ? Zotero.getString('general.keys.cmdShift') : Zotero.getString('general.keys.ctrlShift');
}
var textboxes = document.getElementById('zotero-keys-rows').getElementsByTagName('textbox');
for (let i=0; i<textboxes.length; i++) {
let textbox = textboxes[i];
textbox.value = textbox.value.toUpperCase();
// .value takes care of the initial value, and this takes care of direct pref changes
// while the window is open
textbox.setAttribute('onsyncfrompreference', 'return Zotero_Preferences.Keys.capitalizePref(this.id)');
textbox.setAttribute('oninput', 'this.value = this.value.toUpperCase()');
}
},
capitalizePref: function (id) {
var elem = document.getElementById(id);
var pref = document.getElementById(elem.getAttribute('preference'));
if (pref.value) {
return pref.value.toUpperCase();
}
}
};

View file

@ -1,114 +0,0 @@
<?xml version="1.0"?>
<!--
***** BEGIN LICENSE BLOCK *****
Copyright © 20062013 Center for History and New Media
George Mason University, Fairfax, Virginia, USA
http://zotero.org
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
-->
<!DOCTYPE prefwindow SYSTEM "chrome://zotero/locale/preferences.dtd">
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<prefpane id="zotero-prefpane-keys"
onpaneload="Zotero_Preferences.Keys.init()"
helpTopic="shortcut_keys">
<preferences>
<preference id="pref-keys-openZotero" name="extensions.zotero.keys.openZotero" type="string"/>
<preference id="pref-keys-saveToZotero" name="extensions.zotero.keys.saveToZotero" type="string"/>
<preference id="pref-keys-toggleFullscreen" name="extensions.zotero.keys.toggleFullscreen" type="string"/>
<preference id="pref-keys-library" name="extensions.zotero.keys.library" type="string"/>
<preference id="pref-keys-quicksearch" name="extensions.zotero.keys.quicksearch" type="string"/>
<preference id="pref-keys-toggleTagSelector" name="extensions.zotero.keys.toggleTagSelector" type="string"/>
<preference id="pref-keys-newItem" name="extensions.zotero.keys.newItem" type="string"/>
<preference id="pref-keys-newNote" name="extensions.zotero.keys.newNote" type="string"/>
<preference id="pref-keys-importFromClipboard" name="extensions.zotero.keys.importFromClipboard" type="string"/>
<preference id="pref-keys-copySelectedItemCitationsToClipboard" name="extensions.zotero.keys.copySelectedItemCitationsToClipboard" type="string"/>
<preference id="pref-keys-copySelectedItemsToClipboard" name="extensions.zotero.keys.copySelectedItemsToClipboard" type="string"/>
</preferences>
<grid id="zotero-keys-grid">
<columns>
<column flex="1"/>
<column/>
<column/>
</columns>
<rows id="zotero-keys-rows">
<row id="zotero-keys-new-item">
<label value="&zotero.preferences.keys.newItem;" control="textbox-newItem"/>
<label/>
<textbox id="textbox-newItem" maxlength="1" size="1" preference="pref-keys-newItem"/>
</row>
<row>
<label value="&zotero.preferences.keys.newNote;" control="textbox-newNote"/>
<label/>
<textbox id="textbox-newNote" maxlength="1" size="1" preference="pref-keys-newNote"/>
</row>
<row>
<label value="&zotero.preferences.keys.importFromClipboard;" control="textbox-importFromClipboard"/>
<label/>
<textbox id="textbox-importFromClipboard" maxlength="1" size="1" preference="pref-keys-importFromClipboard"/>
</row>
<row id="zotero-keys-focus-libraries-pane">
<label value="&zotero.preferences.keys.focusLibrariesPane;" control="textbox-library"/>
<label/>
<textbox id="textbox-library" maxlength="1" size="1" preference="pref-keys-library"/>
</row>
<row>
<label value="&zotero.preferences.keys.quicksearch;" control="textbox-quicksearch"/>
<label/>
<textbox id="textbox-quicksearch" maxlength="1" size="1" preference="pref-keys-quicksearch"/>
</row>
<row>
<label value="&zotero.preferences.keys.copySelectedItemCitationsToClipboard;" control="textbox-copySelectedItemCitationsToClipboard"/>
<label/>
<textbox id="textbox-copySelectedItemCitationsToClipboard" maxlength="1" size="1"
preference="pref-keys-copySelectedItemCitationsToClipboard"
onchange="if (Zotero_Preferences.Export) { Zotero_Preferences.Export.updateQuickCopyInstructions(); }"/>
</row>
<row>
<label value="&zotero.preferences.keys.copySelectedItemsToClipboard;" control="textbox-copySelectedItemsToClipboard"/>
<label/>
<textbox id="textbox-copySelectedItemsToClipboard" maxlength="1" size="1"
preference="pref-keys-copySelectedItemsToClipboard"
onchange="if (Zotero_Preferences.Export) { Zotero_Preferences.Export.updateQuickCopyInstructions(); }"/>
</row>
<row>
<label value="&zotero.preferences.keys.toggleTagSelector;" control="textbox-toggleTagSelector"/>
<label/>
<textbox id="textbox-toggleTagSelector" maxlength="1" size="1" preference="pref-keys-toggleTagSelector"/>
</row>
</rows>
</grid>
<label class="statusLine" value="&zotero.preferences.keys.changesTakeEffect;"/>
<separator/>
</prefpane>
<script src="preferences_keys.js" type="application/javascript;version=1.8"/>
</overlay>

View file

@ -1,52 +0,0 @@
<?xml version="1.0"?>
<!--
***** BEGIN LICENSE BLOCK *****
Copyright © 20062013 Center for History and New Media
George Mason University, Fairfax, Virginia, USA
http://zotero.org
This file is part of Zotero.
Zotero is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Zotero is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Zotero. If not, see <http://www.gnu.org/licenses/>.
***** END LICENSE BLOCK *****
-->
<!DOCTYPE prefwindow SYSTEM "chrome://zotero/locale/preferences.dtd">
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<prefpane id="zotero-prefpane-keys">
<grid id="zotero-keys-grid">
<rows id="zotero-keys-rows">
<row position="1">
<label value="&zotero.preferences.keys.openZotero;" control="key-textbox-openZotero"/>
<label/>
<textbox id="textbox-openZotero" maxlength="1" size="1" preference="pref-keys-openZotero"/>
</row>
<row position="2">
<label value="&zotero.preferences.keys.toggleFullscreen;" control="textbox-toggleFullscreen"/>
<label/>
<textbox id="textbox-toggleFullscreen" maxlength="1" size="1" preference="pref-keys-toggleFullscreen"/>
</row>
<row insertbefore="zotero-keys-new-item">
<label value="&zotero.preferences.keys.saveToZotero;" control="key-textbox-saveToZotero"/>
<label/>
<textbox id="textbox-saveToZotero" maxlength="1" size="1" preference="pref-keys-saveToZotero"/>
</row>
</rows>
</grid>
</prefpane>
</overlay>

View file

@ -123,8 +123,6 @@
<!ENTITY zotero.preferences.cite.styles.styleManager.csl "CSL">
<!ENTITY zotero.preferences.export.getAdditionalStyles "Get additional styles...">
<!ENTITY zotero.preferences.prefpane.keys "Shortcuts">
<!ENTITY zotero.preferences.keys.openZotero "Open/Close Zotero Pane">
<!ENTITY zotero.preferences.keys.saveToZotero "Save to Zotero (address bar icon)">
<!ENTITY zotero.preferences.keys.toggleFullscreen "Toggle Fullscreen Mode">
@ -162,6 +160,7 @@
<!ENTITY zotero.preferences.prefpane.advanced "Advanced">
<!ENTITY zotero.preferences.advanced.filesAndFolders "Files and Folders">
<!ENTITY zotero.preferences.advanced.keys "Shortcuts">
<!ENTITY zotero.preferences.prefpane.locate "Locate">
<!ENTITY zotero.preferences.locate.locateEngineManager "Article Lookup Engine Manager">

View file

@ -242,21 +242,16 @@ grid row hbox:first-child
}
/* Shortcut Keys pane */
#zotero-prefpane-keys row
#zotero-prefpane-advanced-keys-tab row
{
-moz-box-align: center;
}
#zotero-prefpane-keys textbox
#zotero-prefpane-advanced-keys-tab textbox
{
margin-left: -1px;
}
#zotero-prefpane-keys checkbox
{
margin: .75em 0;
}
treechildren::-moz-tree-checkbox {
/* unchecked checkbox treecells. This style MUST come before treechildren::-moz-tree-checkbox(checked) otherwise it won't take effect. */
list-style-image: none;