commit 2681a508b4f4af485fbba10269257ae9855d5631
parent 3194f4629f6b1d8c21477b1b0efb703cf90bfd0f
Author: Dan Stillman <dstillman@zotero.org>
Date: Mon, 9 Mar 2015 18:54:39 -0400
Merge pull request #664 from gracile-fr/prefs-pane
Move shortcut keys prefpane to tab of Advanced (#646)
Diffstat:
9 files changed, 142 insertions(+), 238 deletions(-)
diff --git a/chrome/content/zotero/preferences/preferences.xul b/chrome/content/zotero/preferences/preferences.xul
@@ -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"
diff --git a/chrome/content/zotero/preferences/preferences_advanced.js b/chrome/content/zotero/preferences/preferences_advanced.js
@@ -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();
+ }
+ }
+};
diff --git a/chrome/content/zotero/preferences/preferences_advanced.xul b/chrome/content/zotero/preferences/preferences_advanced.xul
@@ -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>
diff --git a/chrome/content/zotero/preferences/preferences_advanced_firefox.xul b/chrome/content/zotero/preferences/preferences_advanced_firefox.xul
@@ -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>
diff --git a/chrome/content/zotero/preferences/preferences_keys.js b/chrome/content/zotero/preferences/preferences_keys.js
@@ -1,55 +0,0 @@
-/*
- ***** BEGIN LICENSE BLOCK *****
-
- Copyright © 2006–2013 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();
- }
- }
-};
diff --git a/chrome/content/zotero/preferences/preferences_keys.xul b/chrome/content/zotero/preferences/preferences_keys.xul
@@ -1,114 +0,0 @@
-<?xml version="1.0"?>
-<!--
- ***** BEGIN LICENSE BLOCK *****
-
- Copyright © 2006–2013 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>
diff --git a/chrome/content/zotero/preferences/preferences_keys_firefox.xul b/chrome/content/zotero/preferences/preferences_keys_firefox.xul
@@ -1,52 +0,0 @@
-<?xml version="1.0"?>
-<!--
- ***** BEGIN LICENSE BLOCK *****
-
- Copyright © 2006–2013 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>
diff --git a/chrome/locale/en-US/zotero/preferences.dtd b/chrome/locale/en-US/zotero/preferences.dtd
@@ -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">
diff --git a/chrome/skin/default/zotero/preferences.css b/chrome/skin/default/zotero/preferences.css
@@ -236,25 +236,20 @@ grid row hbox:first-child
height: 250px;
}
-/* Shortcut Keys pane */
-#zotero-prefpane-keys row
-{
- -moz-box-align: center;
-}
-
#styleManager-updated
{
width: 105px;
}
-#zotero-prefpane-keys textbox
+/* Shortcut Keys pane */
+#zotero-prefpane-advanced-keys-tab row
{
- margin-left: -1px;
+ -moz-box-align: center;
}
-#zotero-prefpane-keys checkbox
+#zotero-prefpane-advanced-keys-tab textbox
{
- margin: .75em 0;
+ margin-left: -1px;
}
treechildren::-moz-tree-checkbox {