Mendeley import: Add "Other…" button for selecting another DB

E.g., for selecting a DB from a backup

Addresses #1451
This commit is contained in:
Dan Stillman 2018-06-05 19:54:46 -04:00
parent 17f2025c53
commit 024b428fe6
4 changed files with 34 additions and 3 deletions

View file

@ -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;
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;

View file

@ -42,6 +42,9 @@
<listcol/>
</listcols>
</listbox>
<hbox>
<button label="&zotero.general.other;" oncommand="Zotero_Import_Wizard.chooseMendeleyDB()"/>
</hbox>
</wizardpage>
<wizardpage pageid="page-progress"

View file

@ -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">

View file

@ -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;
}