diff --git a/chrome/content/zotero/about.xul b/chrome/content/zotero/about.xul
index 4b1e64857..247ca4066 100644
--- a/chrome/content/zotero/about.xul
+++ b/chrome/content/zotero/about.xul
@@ -10,7 +10,7 @@
orient="vertical"
buttons="accept"
buttonlabelaccept="&zotero.about.close;"
- onload="onLoad();"
+ onload="moveToAlertPosition(); onLoad();"
ondialogaccept="return true;">
+
+ modifiers="accel alt" />
\ No newline at end of file
diff --git a/chrome/content/zotero/preferences.js b/chrome/content/zotero/preferences.js
index db484922d..862c4ae89 100644
--- a/chrome/content/zotero/preferences.js
+++ b/chrome/content/zotero/preferences.js
@@ -20,13 +20,6 @@
***** END LICENSE BLOCK *****
*/
-var autoUpdateBox;
-var reportTranslationFailure;
-var positionMenu;
-var parseEndnoteBox;
-var automaticSnapshots;
-var openURLMenu;
-var openURLResolvers;
var openURLServerField;
var openURLVersionMenu;
var zoteroPaneOnTopInitial;
@@ -45,58 +38,49 @@ var zoteroPaneOnTopInitial;
*/
function init()
-{
- autoUpdateBox = document.getElementById('autoUpdateBox');
- autoUpdateBox.checked = Zotero.Prefs.get('automaticScraperUpdates');
-
- reportTranslationFailure = document.getElementById('reportTranslationFailure');
- reportTranslationFailure.checked = Zotero.Prefs.get('reportTranslationFailure');
-
- positionMenu = document.getElementById('positionMenu');
- positionMenu.selectedIndex = zoteroPaneOnTopInitial = Zotero.Prefs.get('zoteroPaneOnTop') ? 0 : 1;
-
- parseEndnoteBox = document.getElementById('parseEndnoteBox');
- parseEndnoteBox.checked = Zotero.Prefs.get('parseEndNoteMIMETypes');
-
- automaticSnapshots = document.getElementById('automaticSnapshots');
- automaticSnapshots.checked = Zotero.Prefs.get('automaticSnapshots');
-
- openURLServerField = document.getElementById('openURLServerField');
- openURLServerField.value = Zotero.Prefs.get('openURL.resolver');
- openURLVersionMenu = document.getElementById('openURLVersionMenu');
- openURLVersionMenu.value = Zotero.Prefs.get('openURL.version');
-
- openURLMenu = document.getElementById('openURLMenu');
-
- openURLResolvers = Zotero.OpenURL.discoverResolvers();
- for(var i in openURLResolvers)
- {
- openURLMenu.insertItemAt(i,openURLResolvers[i]['name']);
- if(openURLResolvers[i]['url'] == Zotero.Prefs.get('openURL.resolver') && openURLResolvers[i]['version'] == Zotero.Prefs.get('openURL.version'))
- openURLMenu.selectedIndex = i;
- }
-}
-
-function accept()
{
- Zotero.Prefs.set('automaticScraperUpdates', autoUpdateBox.checked);
- Zotero.Prefs.set('reportTranslationFailure', reportTranslationFailure.checked);
- Zotero.Prefs.set('zoteroPaneOnTop', positionMenu.selectedIndex == 0);
-
- if(Zotero.Prefs.get('parseEndNoteMIMETypes') != parseEndnoteBox.checked)
- {
- Zotero.Prefs.set('parseEndNoteMIMETypes', parseEndnoteBox.checked);
- Zotero.Ingester.MIMEHandler.init();
+ // Display the appropriate modifier keys for the platform
+ var rows = document.getElementById('zotero-prefpane-keys').getElementsByTagName('row');
+ for (var i=0; i
-
+
-
+
+
+
-
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js
index 7c7bee393..e9ae5b508 100644
--- a/chrome/content/zotero/xpcom/zotero.js
+++ b/chrome/content/zotero/xpcom/zotero.js
@@ -122,6 +122,8 @@ var Zotero = new function(){
.getService(Components.interfaces.nsIStringBundleService);
_localizedStringBundle = stringBundleService.createBundle(src, appLocale);
+ Zotero.Keys.init();
+
// Add notifier queue callbacks to the DB layer
Zotero.DB.addCallback('begin', Zotero.Notifier.begin);
Zotero.DB.addCallback('commit', Zotero.Notifier.commit);
@@ -356,7 +358,7 @@ var Zotero = new function(){
function getString(name, params){
try {
- if (params){
+ if (params != undefined){
if (typeof params != 'object'){
params = [params];
}
@@ -543,7 +545,7 @@ Zotero.Prefs = new function(){
this.observe = observe;
// Public properties
- this.prefBranch; // set in Zotero.init()
+ this.prefBranch;
function init(){
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
@@ -558,8 +560,16 @@ Zotero.Prefs = new function(){
/**
* Retrieve a preference
**/
- function get(pref){
+ function get(pref, global){
try {
+ if (global) {
+ var service = Components.classes["@mozilla.org/preferences-service;1"]
+ .getService(Components.interfaces.nsIPrefService);
+ }
+ else {
+ var service = this.prefBranch;
+ }
+
switch (this.prefBranch.getPrefType(pref)){
case this.prefBranch.PREF_BOOL:
return this.prefBranch.getBoolPref(pref);
@@ -630,6 +640,77 @@ Zotero.Prefs = new function(){
}
+Zotero.Keys = new function() {
+ this.init = init;
+ this.windowInit = windowInit;
+ this.getCommand = getCommand;
+
+ _actions = ['library', 'quicksearch', 'newItem', 'newNote', 'toggleTagSelector',
+ 'toggleFullscreen'];
+ _keys = {};
+
+
+ function init() {
+ // Get the key=>command mappings from the prefs
+ for each (var action in _actions) {
+ _keys[Zotero.Prefs.get('keys.' + action)] = action;
+ }
+ }
+
+
+ function windowInit(document) {
+ var useShift = Zotero.isMac;
+
+ // Zotero pane shortcut
+ var zKey = Zotero.Prefs.get('keys.openZotero');
+ var keyElem = document.getElementById('key_openZotero');
+ // Only override the default with the pref if the hasn't been manually changed
+ // and the pref has been
+ if (keyElem.getAttribute('key') == 'Z' && keyElem.getAttribute('modifiers') == 'accel alt'
+ && (zKey != 'Z' || useShift)) {
+ keyElem.setAttribute('key', zKey);
+ if (useShift) {
+ keyElem.setAttribute('modifiers', 'accel shift');
+ }
+ }
+
+ if (Zotero.Prefs.get('keys.overrideGlobal')) {
+ var keys = document.getElementsByTagName('key');
+ for each(var key in keys) {
+ try {
+ var id = key.getAttribute('id');
+ }
+ // A couple keys are always invalid
+ catch (e) {
+ continue;
+ }
+
+ if (id == 'key_openZotero') {
+ continue;
+ }
+
+ var mods = key.getAttribute('modifiers').split(/[\,\s]/);
+ var second = useShift ? 'shift' : 'alt';
+ // Key doesn't match a Zotero shortcut
+ if (mods.length != 2 || !((mods[0] == 'accel' && mods[1] == second) ||
+ (mods[0] == second && mods[1] == 'accel'))) {
+ continue;
+ }
+
+ if (_keys[key.getAttribute('key')] || key.getAttribute('key') == zKey) {
+ Zotero.debug('Removing key ' + id + ' with accesskey ' + key.getAttribute('key'));
+ key.parentNode.removeChild(key);
+ }
+ }
+ }
+ }
+
+
+ function getCommand(key) {
+ return _keys[key] ? _keys[key] : false;
+ }
+}
+
/**
* Class for creating hash arrays that behave a bit more sanely
diff --git a/chrome/locale/en-US/zotero/preferences.dtd b/chrome/locale/en-US/zotero/preferences.dtd
index e8ccea9ff..d4c6233a0 100644
--- a/chrome/locale/en-US/zotero/preferences.dtd
+++ b/chrome/locale/en-US/zotero/preferences.dtd
@@ -1,13 +1,27 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties
index 9436935e3..ccef0cc71 100644
--- a/chrome/locale/en-US/zotero/zotero.properties
+++ b/chrome/locale/en-US/zotero/zotero.properties
@@ -213,6 +213,9 @@ zotero.preferences.update.updated = Updated
zotero.preferences.update.upToDate = Up to date
zotero.preferences.update.error = Error
zotero.preferences.status.positionChange = Position change will take effect in new windows only
+zotero.preferences.openurl.resolversFound.zero = %S resolvers found
+zotero.preferences.openurl.resolversFound.singular = %S resolver found
+zotero.preferences.openurl.resolversFound.plural = %S resolvers found
fileInterface.itemsImported = Importing items...
fileInterface.itemsExported = Exporting items...
diff --git a/chrome/skin/default/zotero/preferences.css b/chrome/skin/default/zotero/preferences.css
new file mode 100644
index 000000000..18a9ca86e
--- /dev/null
+++ b/chrome/skin/default/zotero/preferences.css
@@ -0,0 +1,59 @@
+prefwindow .chromeclass-toolbar
+{
+ display: -moz-box !important; /* Ignore toolbar collapse button on OS X */
+}
+
+radio[pane=zotero-prefpane-general]
+{
+ -moz-image-region: rect(0px, 32px, 32px, 0px);
+}
+radio[pane=zotero-prefpane-general]:hover,
+radio[pane=zotero-prefpane-general]:active,
+radio[pane=zotero-prefpane-general][selected="true"]
+{
+ -moz-image-region: rect(32px, 32px, 64px, 0px);
+}
+
+/* Use the Gear icon until we find a keyboard icon */
+radio[pane=zotero-prefpane-keys]
+{
+ -moz-image-region: rect(0px, 224px, 32px, 192px);
+}
+radio[pane=zotero-prefpane-keys]:hover,
+radio[pane=zotero-prefpane-keys]:active,
+radio[pane=zotero-prefpane-keys][selected="true"]
+{
+ -moz-image-region: rect(32px, 224px, 64px, 192px);
+}
+
+
+/* General pane */
+
+#statusLine
+{
+ margin-bottom:.75em;
+ color: red;
+}
+
+
+/* Shortcut Keys pane */
+#zotero-prefpane-keys row
+{
+ -moz-box-align: center;
+}
+
+#zotero-prefpane-keys textbox
+{
+ margin-left: -1px;
+}
+
+#zotero-prefpane-keys checkbox
+{
+ margin: .75em 0;
+}
+
+#zotero-prefpane-keys .statusLine
+{
+ margin: .75em 0;
+ font-size: 10px;
+}
diff --git a/defaults/preferences/zotero.js b/defaults/preferences/zotero.js
index 516da939f..df7047b69 100644
--- a/defaults/preferences/zotero.js
+++ b/defaults/preferences/zotero.js
@@ -14,3 +14,13 @@ pref("extensions.zotero.downloadAssociatedFiles",false);
pref("extensions.zotero.reportTranslationFailure",true);
pref("extensions.zotero.enableMacClipboard",false);
pref("extensions.zotero.lastCreatorFieldMode",0);
+
+// Keyboard shortcuts
+pref("extensions.zotero.keys.overrideGlobal", true);
+pref("extensions.zotero.keys.openZotero", 'Z');
+pref("extensions.zotero.keys.toggleFullscreen", 'F');
+pref("extensions.zotero.keys.library", 'L');
+pref("extensions.zotero.keys.quicksearch", 'K');
+pref("extensions.zotero.keys.newItem", 'N');
+pref("extensions.zotero.keys.newNote", 'O');
+pref("extensions.zotero.keys.toggleTagSelector", 'T');