commit e567ad25aa1d32ede8f752f24dcbeaece905fedd
parent 1a47d79716db73f114fa844a9caaa14227d35a85
Author: Dan Stillman <dstillman@zotero.org>
Date: Wed, 1 Apr 2015 16:23:12 -0400
More PDF tools tweaks
- If one tool is missing, reinstall it automatically during translator
update check
- Account for pdfinfo 3.02pl1 on Linux
Diffstat:
3 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/chrome/content/zotero/preferences/preferences_search.js b/chrome/content/zotero/preferences/preferences_search.js
@@ -187,13 +187,17 @@ Zotero_Preferences.Search = {
var converterVersionAvailable = (!converterIsRegistered ||
Zotero.Fulltext.pdfConverterVersion == 'UNKNOWN'
|| latestVersion > Zotero.Fulltext.pdfConverterVersion
- || (latestVersion != '3.02' && Zotero.Fulltext.pdfConverterVersion == '3.02')
- || (latestVersion != '3.02' && latestVersion != '3.04' && Zotero.Fulltext.pdfConverterVersion == '3.04'));
+ || (!latestVersion.startsWith('3.02')
+ && Zotero.Fulltext.pdfConverterVersion.startsWith('3.02'))
+ || (!latestVersion.startsWith('3.02') && latestVersion != '3.04'
+ && Zotero.Fulltext.pdfConverterVersion == '3.04'));
var infoVersionAvailable = (!infoIsRegistered ||
Zotero.Fulltext.pdfInfoVersion == 'UNKNOWN'
|| latestVersion > Zotero.Fulltext.pdfInfoVersion
- || (latestVersion != '3.02' && Zotero.Fulltext.pdfInfoVersion == '3.02')
- || (latestVersion != '3.02' && latestVersion != '3.04' && Zotero.Fulltext.pdfInfoVersion == '3.04'));
+ || (!latestVersion.startsWith('3.02')
+ && Zotero.Fulltext.pdfInfoVersion.startsWith('3.02'))
+ || (!latestVersion.startsWith('3.02') && latestVersion != '3.04'
+ && Zotero.Fulltext.pdfInfoVersion == '3.04'));
var bothAvailable = converterVersionAvailable && infoVersionAvailable;
// Up to date -- disable update button
diff --git a/chrome/content/zotero/xpcom/fulltext.js b/chrome/content/zotero/xpcom/fulltext.js
@@ -339,7 +339,7 @@ Zotero.Fulltext = new function(){
case 'info':
// Modified 3.02 version doesn't use redirection script
- if (version == '3.02') break;
+ if (version.startsWith('3.02')) break;
var script = Zotero.getZoteroDirectory();
script.append('pdfinfo.' + _getScriptExtension())
@@ -600,7 +600,7 @@ Zotero.Fulltext = new function(){
cacheFile.append(this.pdfConverterCacheFile);
// Modified 3.02 version that can output a text file directly
- if (_pdfInfo && _pdfInfoVersion == '3.02') {
+ if (_pdfInfo && _pdfInfoVersion.startsWith('3.02')) {
var infoFile = cacheFile.parent;
infoFile.append(this.pdfInfoCacheFile);
diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js
@@ -1606,18 +1606,26 @@ Zotero.Schema = new function(){
if (Zotero.Fulltext.pdfInfoIsRegistered()) {
let currentVersion = Zotero.Fulltext.pdfInfoVersion;
- if (currentVersion < availableVersion || currentVersion == '3.02'
+ if (currentVersion < availableVersion || currentVersion.startsWith('3.02')
|| currentVersion == 'UNKNOWN') {
installInfo = true;
}
}
+ // Install missing component if one is installed
+ else if (Zotero.Fulltext.pdfConverterIsRegistered()) {
+ installInfo = true;
+ }
if (Zotero.Fulltext.pdfConverterIsRegistered()) {
let currentVersion = Zotero.Fulltext.pdfConverterVersion;
- if (currentVersion < availableVersion || currentVersion == '3.02'
+ if (currentVersion < availableVersion || currentVersion.startsWith('3.02')
|| currentVersion == 'UNKNOWN') {
installConverter = true;
}
}
+ // Install missing component if one is installed
+ else if (Zotero.Fulltext.pdfInfoIsRegistered()) {
+ installConverter = true;
+ }
let prefKey = 'pdfToolsInstallError';
let lastTry = 0, delay = 43200000; // half a day, so doubles to a day initially