From 647463cc616c0d817a133ea6fa8388d49f5d7272 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 7 Mar 2018 04:20:26 -0500 Subject: [PATCH] Reorganize file prefs and add UI for choosing PDF handler - Add a File Handling section to the General pane of the preferences, and move several prefs from Miscellaneous to there - Add a UI to that section for choosing the PDF handler - Update Zotero.launchFileWithApplication() to use /usr/bin/open on macOS if the handler is an .app (which it will be if set through the chooser, since it's limited to Mac applications, though an executable can still be set via the hidden pref if desired for some reason) - Move prefs for style/translator updates and translator error reporting (which isn't particularly relevant anymore in the client) to Advanced By default the PDF handler chooser says "System Default", which isn't the nicest thing, and there's probably a way to get/guess the system default, since Firefox seems to know it (at least on macOS), but I couldn't quickly find a way to do it. Addresses #1450 --- .../preferences/preferences_advanced.js | 22 +++++ .../preferences/preferences_advanced.xul | 12 +++ .../zotero/preferences/preferences_general.js | 95 ++++++++++++++++--- .../preferences/preferences_general.xul | 33 ++++--- chrome/content/zotero/xpcom/zotero.js | 12 ++- chrome/locale/en-US/zotero/preferences.dtd | 13 ++- chrome/locale/en-US/zotero/zotero.properties | 2 + 7 files changed, 158 insertions(+), 31 deletions(-) diff --git a/chrome/content/zotero/preferences/preferences_advanced.js b/chrome/content/zotero/preferences/preferences_advanced.js index e6e6987f61..210f449e3b 100644 --- a/chrome/content/zotero/preferences/preferences_advanced.js +++ b/chrome/content/zotero/preferences/preferences_advanced.js @@ -42,6 +42,28 @@ Zotero_Preferences.Advanced = { }, + updateTranslators: Zotero.Promise.coroutine(function* () { + var updated = yield Zotero.Schema.updateFromRepository(Zotero.Schema.REPO_UPDATE_MANUAL); + var button = document.getElementById('updateButton'); + if (button) { + if (updated===-1) { + var label = Zotero.getString('zotero.preferences.update.upToDate'); + } + else if (updated) { + var label = Zotero.getString('zotero.preferences.update.updated'); + } + else { + var label = Zotero.getString('zotero.preferences.update.error'); + } + button.setAttribute('label', label); + + if (updated && Zotero_Preferences.Cite) { + yield Zotero_Preferences.Cite.refreshStylesList(); + } + } + }), + + migrateDataDirectory: Zotero.Promise.coroutine(function* () { var currentDir = Zotero.DataDirectory.dir; var defaultDir = Zotero.DataDirectory.defaultDir; diff --git a/chrome/content/zotero/preferences/preferences_advanced.xul b/chrome/content/zotero/preferences/preferences_advanced.xul index b811225b38..05ff72d9d8 100644 --- a/chrome/content/zotero/preferences/preferences_advanced.xul +++ b/chrome/content/zotero/preferences/preferences_advanced.xul @@ -37,12 +37,16 @@ onpaneload="Zotero_Preferences.Advanced.init()" helpTopic="advanced"> + + + + @@ -74,6 +78,14 @@ + + +