diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js
index cfad71d48..d6ba521bb 100644
--- a/chrome/content/zotero/overlay.js
+++ b/chrome/content/zotero/overlay.js
@@ -1478,8 +1478,8 @@ var ZoteroPane = new function()
createBib: 11,
loadReport: 12,
sep4: 13,
- reindexItem: 14,
- recognizePDF: 15
+ recognizePDF: 14,
+ reindexItem: 15
};
var menu = document.getElementById('zotero-itemmenu');
@@ -1505,40 +1505,41 @@ var ZoteroPane = new function()
m.attachLink, m.sep2, m.duplicateItem);
// If all items can be reindexed, or all items can be recognized, show option
- if (Zotero.Fulltext.pdfConverterIsRegistered()) {
- var items = this.getSelectedItems();
- var canIndex = true;
- var canRecognize = true;
- for (var i=0; i
-
+
@@ -141,7 +141,7 @@
+ oncommand="ZoteroPane.openPreferences()"/>
diff --git a/chrome/content/zotero/preferences/preferences.js b/chrome/content/zotero/preferences/preferences.js
index b5e1793ba..d3739195f 100644
--- a/chrome/content/zotero/preferences/preferences.js
+++ b/chrome/content/zotero/preferences/preferences.js
@@ -24,6 +24,7 @@ var openURLServerField;
var openURLVersionMenu;
var proxies;
var charsets;
+var _io;
function init()
{
@@ -45,6 +46,17 @@ function init()
charsetMenu.selectedItem =
charsetMap[Zotero.Prefs.get("import.charset")] ?
charsetMap[Zotero.Prefs.get("import.charset")] : charsetMap["auto"];
+
+ _io = window.arguments[0];
+
+ if (_io.pane) {
+ var pane = document.getElementById(_io.pane);
+ document.getElementById('zotero-prefs').showPane(pane);
+ // Quick hack to support install prompt from PDF recognize option
+ if (_io.action && _io.action == 'pdftools-install') {
+ checkPDFToolsDownloadVersion();
+ }
+ }
}
diff --git a/chrome/content/zotero/recognizePDF.js b/chrome/content/zotero/recognizePDF.js
index f2c00533b..c4d73b0a6 100644
--- a/chrome/content/zotero/recognizePDF.js
+++ b/chrome/content/zotero/recognizePDF.js
@@ -39,7 +39,7 @@ var Zotero_RecognizePDF = new function() {
* @returns {Boolean} True if the PDF can be recognized, false if it cannot be
*/
this.canRecognize = function(/**Zotero.Item*/ item) {
- return (Zotero.Fulltext.pdfConverterIsRegistered() && item.attachmentMIMEType &&
+ return (item.attachmentMIMEType &&
item.attachmentMIMEType == "application/pdf" && !item.getSource());
}
@@ -48,6 +48,27 @@ var Zotero_RecognizePDF = new function() {
* of the new items
*/
this.recognizeSelected = function() {
+ if (!Zotero.Fulltext.pdfConverterIsRegistered()) {
+ var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
+ .getService(Components.interfaces.nsIPromptService);
+ var buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
+ + (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL);
+ var index = ps.confirmEx(
+ null,
+ // TODO: localize
+ "PDF Tools Not Installed",
+ "To use this feature, you must first install the PDF tools in "
+ + "the Zotero preferences.",
+ buttonFlags,
+ "Open Preferences",
+ null, null, null, {}
+ );
+ if (index == 0) {
+ ZoteroPane.openPreferences('zotero-prefpane-search', 'pdftools-install');
+ }
+ return;
+ }
+
var items = ZoteroPane.getSelectedItems();
if (!items) return;
var itemRecognizer = new Zotero_RecognizePDF.ItemRecognizer();