commit 024b428fe6320e4ba064dd967b704277849d2f89
parent 17f2025c53085b808ea8506a30d8aada8517a097
Author: Dan Stillman <dstillman@zotero.org>
Date: Tue, 5 Jun 2018 19:54:46 -0400
Mendeley import: Add "Other…" button for selecting another DB
E.g., for selecting a DB from a backup
Addresses #1451
Diffstat:
4 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/chrome/content/zotero/import/importWizard.js b/chrome/content/zotero/import/importWizard.js
@@ -57,14 +57,38 @@ var Zotero_Import_Wizard = {
},
+ /**
+ * When a file is clicked on in the file list
+ */
onFileSelected: async function () {
this._wizard.canAdvance = true;
},
+ /**
+ * When the user clicks "Other…" to choose a file not in the list
+ */
+ chooseMendeleyDB: async function () {
+ const nsIFilePicker = Components.interfaces.nsIFilePicker;
+ var fp = Components.classes["@mozilla.org/filepicker;1"]
+ .createInstance(nsIFilePicker);
+ fp.init(window, Zotero.getString('fileInterface.import'), nsIFilePicker.modeOpen);
+ fp.appendFilter("Mendeley Database", "*.sqlite"); // TODO: Localize
+ var rv = fp.show();
+ if (rv != nsIFilePicker.returnOK) {
+ return false;
+ }
+ this._file = fp.file.path;
+ this._wizard.canAdvance = true;
+ this._wizard.advance();
+ },
+
+
onFileChosen: async function () {
- var index = document.getElementById('file-list').selectedIndex;
- this._file = this._dbs[index].path;
+ if (!this._file) {
+ let index = document.getElementById('file-list').selectedIndex;
+ this._file = this._dbs[index].path;
+ }
this._disableCancel();
this._wizard.canRewind = false;
this._wizard.canAdvance = false;
diff --git a/chrome/content/zotero/import/importWizard.xul b/chrome/content/zotero/import/importWizard.xul
@@ -42,6 +42,9 @@
<listcol/>
</listcols>
</listbox>
+ <hbox>
+ <button label="&zotero.general.other;" oncommand="Zotero_Import_Wizard.chooseMendeleyDB()"/>
+ </hbox>
</wizardpage>
<wizardpage pageid="page-progress"
diff --git a/chrome/locale/en-US/zotero/zotero.dtd b/chrome/locale/en-US/zotero/zotero.dtd
@@ -16,6 +16,7 @@
<!ENTITY zotero.general.loading "Loading…">
<!ENTITY zotero.general.close "Close">
<!ENTITY zotero.general.minimize "Minimize">
+<!ENTITY zotero.general.other "Other…">
<!ENTITY zotero.errorReport.title "Zotero Error Report">
diff --git a/chrome/skin/default/zotero/importWizard.css b/chrome/skin/default/zotero/importWizard.css
@@ -37,8 +37,11 @@ listbox, #result-description {
font-size: 13px;
}
+button {
+ font-size: 13px;
+}
+
#result-report-error {
margin-top: 13px;
margin-left: 0;
- font-size: 13px;
}