diff --git a/chrome/content/zotero/fileInterface.js b/chrome/content/zotero/fileInterface.js
index 9530d63a7..2d4d9f2e2 100644
--- a/chrome/content/zotero/fileInterface.js
+++ b/chrome/content/zotero/fileInterface.js
@@ -330,27 +330,27 @@ var Zotero_File_Interface = new function() {
var translation;
// Check if the file is an SQLite database
var sample = yield Zotero.File.getSample(file.path);
- if (Zotero.MIME.sniffForMIMEType(sample) == 'application/x-sqlite3'
- // Blacklist the current Zotero database, which would cause a hang
- && file.path != Zotero.DataDirectory.getDatabase()) {
+ if (file.path == Zotero.DataDirectory.getDatabase()) {
+ // Blacklist the current Zotero database, which would cause a hang
+ }
+ else if (Zotero.MIME.sniffForMIMEType(sample) == 'application/x-sqlite3') {
// Mendeley import doesn't use the real translation architecture, but we create a
// translation object with the same interface
translation = yield _getMendeleyTranslation();
translation.createNewCollection = createNewCollection;
- defaultNewCollectionPrefix = "Mendeley Import";
+ defaultNewCollectionPrefix = Zotero.getString(
+ 'fileInterface.appImportCollection', 'Mendeley'
+ );
}
- else {
- // TEMP
- if (file.path.endsWith('.sqlite')) {
- let codes = [];
- for (let i = 0; i < sample.length; i++) {
- codes.push(sample.charCodeAt(i));
- }
- Zotero.debug(codes.join(' '));
- }
- translation = new Zotero.Translate.Import();
+ else if (file.path.endsWith('@www.mendeley.com.sqlite')
+ || file.path.endsWith('online.sqlite')) {
+ // Keep in sync with importWizard.js
+ throw new Error('Encrypted Mendeley database');
}
+ if (!translation) {
+ translation = new Zotero.Translate.Import();
+ }
translation.setLocation(file);
return _finishImport({
translation,
diff --git a/chrome/content/zotero/import/importWizard.js b/chrome/content/zotero/import/importWizard.js
index 4e6fca748..ccc86de34 100644
--- a/chrome/content/zotero/import/importWizard.js
+++ b/chrome/content/zotero/import/importWizard.js
@@ -217,11 +217,23 @@ var Zotero_Import_Wizard = {
);
}
catch (e) {
- this._onDone(
- Zotero.getString('general.error'),
- Zotero.getString('fileInterface.importError'),
- true
- );
+ if (e.message == 'Encrypted Mendeley database') {
+ let url = 'https://www.zotero.org/support/kb/mendeley_import';
+ this._onDone(
+ Zotero.getString('general.error'),
+ // TODO: Localize
+ `The selected Mendeley database cannot be read, likely because it is encrypted. `
+ + `See How do I import a Mendeley library `
+ + `into Zotero? for more information.`
+ );
+ }
+ else {
+ this._onDone(
+ Zotero.getString('general.error'),
+ Zotero.getString('fileInterface.importError'),
+ true
+ );
+ }
throw e;
}
},
@@ -289,7 +301,22 @@ var Zotero_Import_Wizard = {
_onDone: function (label, description, showReportErrorButton) {
var wizard = this._wizard;
wizard.getPageById('page-done').setAttribute('label', label);
- document.getElementById('result-description').textContent = description;
+
+ var xulElem = document.getElementById('result-description');
+ var htmlElem = document.getElementById('result-description-html');
+
+ if (description.includes('href')) {
+ htmlElem.innerHTML = description;
+ Zotero.Utilities.Internal.updateHTMLInXUL(htmlElem);
+ xulElem.hidden = true;
+ htmlElem.setAttribute('display', 'block');
+ }
+ else {
+ xulElem.textContent = description;
+ xulElem.hidden = false;
+ htmlElem.setAttribute('display', 'none');
+ }
+ document.getElementById('result-description')
if (showReportErrorButton) {
let button = document.getElementById('result-report-error');
diff --git a/chrome/content/zotero/import/importWizard.xul b/chrome/content/zotero/import/importWizard.xul
index 2e6115a65..c4e6240a2 100644
--- a/chrome/content/zotero/import/importWizard.xul
+++ b/chrome/content/zotero/import/importWizard.xul
@@ -7,6 +7,7 @@
@@ -64,6 +65,7 @@
+