2006-06-29 00:56:50 +00:00
|
|
|
Scholar_File_Interface = new function() {
|
|
|
|
this.exportFile = exportFile;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Creates Scholar.Translate instance and shows file picker for file export
|
|
|
|
*/
|
|
|
|
function exportFile() {
|
|
|
|
var translation = new Scholar.Translate("export");
|
|
|
|
var translators = translation.getTranslators();
|
|
|
|
|
|
|
|
const nsIFilePicker = Components.interfaces.nsIFilePicker;
|
|
|
|
var fp = Components.classes["@mozilla.org/filepicker;1"]
|
|
|
|
.createInstance(nsIFilePicker);
|
|
|
|
fp.init(window, "Export", nsIFilePicker.modeSave);
|
|
|
|
for(var i in translators) {
|
|
|
|
fp.appendFilter(translators[i].label, translators[i].target);
|
|
|
|
}
|
|
|
|
var rv = fp.show();
|
2006-07-05 22:08:25 +00:00
|
|
|
if (rv == nsIFilePicker.returnOK || rv == nsIFilePicker.returnReplace) {
|
2006-06-29 00:56:50 +00:00
|
|
|
translation.setLocation(fp.file);
|
|
|
|
translation.setTranslator(translators[fp.filterIndex]);
|
2006-07-06 21:55:46 +00:00
|
|
|
//translation.setHandler("done", _exportDone);
|
2006-06-29 00:56:50 +00:00
|
|
|
translation.translate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|