зеркало из https://github.com/mozilla/pjs.git
Bug 316756 option is listed twice in type dropdown box for export.
patch by Stefan Sitter (ssitter@googlemail.com), r=mvl
This commit is contained in:
Родитель
0039965119
Коммит
f25d3e0ca5
|
@ -79,16 +79,15 @@ function loadEventsFromFile()
|
|||
var types = exporter.getFileTypes({});
|
||||
var type;
|
||||
for each (type in types) {
|
||||
fp.appendFilter(type.description, "*."+type.extension);
|
||||
fp.appendFilter(type.description, type.extensionFilter);
|
||||
contractids.push(contractid);
|
||||
}
|
||||
}
|
||||
|
||||
fp.show();
|
||||
|
||||
var filePath = fp.file.path;
|
||||
|
||||
if (filePath) {
|
||||
if (fp.file && fp.file.path && fp.file.path.length > 0) {
|
||||
var filePath = fp.file.path;
|
||||
var importer = Components.classes[contractids[fp.filterIndex]]
|
||||
.getService(Components.interfaces.calIImporter);
|
||||
|
||||
|
@ -218,7 +217,7 @@ function saveEventsToFile(calendarEventArray)
|
|||
var types = exporter.getFileTypes({});
|
||||
var type;
|
||||
for each (type in types) {
|
||||
fp.appendFilter(type.description, "*."+type.extension);
|
||||
fp.appendFilter(type.description, type.extensionFilter);
|
||||
contractids.push(contractid);
|
||||
}
|
||||
}
|
||||
|
@ -239,7 +238,7 @@ function saveEventsToFile(calendarEventArray)
|
|||
|
||||
var filePath = fp.file.path;
|
||||
if(filePath.indexOf(".") == -1 )
|
||||
filePath += "."+exporter.getFileTypes({})[0].extension;
|
||||
filePath += "."+exporter.getFileTypes({})[0].defaultExtension;
|
||||
|
||||
const LOCALFILE_CTRID = "@mozilla.org/file/local;1";
|
||||
const FILEOUT_CTRID = "@mozilla.org/network/file-output-stream;1";
|
||||
|
|
|
@ -46,9 +46,18 @@ interface nsIOutputStream;
|
|||
interface calIFileType : nsISupports
|
||||
{
|
||||
/**
|
||||
* The extension to use in the filepicker's filter list
|
||||
* The default extension that should be associated
|
||||
* with files of this type.
|
||||
*/
|
||||
readonly attribute AString extension;
|
||||
readonly attribute AString defaultExtension;
|
||||
|
||||
/**
|
||||
* The extension filter to use in the filepicker's filter list.
|
||||
* Separate multiple extensions with semicolon and space.
|
||||
* For example "*.html; *.htm".
|
||||
*/
|
||||
readonly attribute AString extensionFilter;
|
||||
|
||||
/**
|
||||
* The description to show to the user in the filter list.
|
||||
*/
|
||||
|
|
|
@ -54,9 +54,10 @@ function QueryInterface(aIID) {
|
|||
|
||||
calHtmlExporter.prototype.getFileTypes =
|
||||
function getFileTypes(aCount) {
|
||||
aCount.value = 2;
|
||||
return([{extension:'html',description:'HTML'},
|
||||
{extension:'htm',description:'HTML'}]);
|
||||
aCount.value = 1;
|
||||
return([{defaultExtension:'html',
|
||||
extensionFilter:'*.html; *.htm',
|
||||
description:'HTML'}]);
|
||||
};
|
||||
|
||||
// not prototype.export. export is reserved.
|
||||
|
|
|
@ -54,7 +54,9 @@ function QueryInterface(aIID) {
|
|||
calIcsImporter.prototype.getFileTypes =
|
||||
function getFileTypes(aCount) {
|
||||
aCount.value = 1;
|
||||
return([{extension:'ics',description:'iCalendar'}]);
|
||||
return([{defaultExtension:'ics',
|
||||
extensionFilter:'*.ics',
|
||||
description:'iCalendar'}]);
|
||||
};
|
||||
|
||||
calIcsImporter.prototype.importFromStream =
|
||||
|
@ -136,7 +138,9 @@ function QueryInterface(aIID) {
|
|||
calIcsExporter.prototype.getFileTypes =
|
||||
function getFileTypes(aCount) {
|
||||
aCount.value = 1;
|
||||
return([{extension:'ics',description:'iCalendar'}]);
|
||||
return([{defaultExtension:'ics',
|
||||
extensionFilter:'*.ics',
|
||||
description:'iCalendar'}]);
|
||||
};
|
||||
|
||||
// not prototype.export. export is reserved.
|
||||
|
|
|
@ -55,7 +55,9 @@ function QueryInterface(aIID) {
|
|||
calOutlookCSVImporter.prototype.getFileTypes =
|
||||
function getFileTypes(aCount) {
|
||||
aCount.value = 1;
|
||||
return([{extension:'csv',description:'Comma Separated Values (from Outlook)'}]);
|
||||
return([{defaultExtension:'csv',
|
||||
extensionFilter:'*.csv',
|
||||
description:'Comma Separated Values (from Outlook)'}]);
|
||||
};
|
||||
|
||||
const localeEn = {
|
||||
|
@ -398,7 +400,9 @@ function QueryInterface(aIID) {
|
|||
calOutlookCSVExporter.prototype.getFileTypes =
|
||||
function getFileTypes(aCount) {
|
||||
aCount.value = 1;
|
||||
return([{extension:'csv',description:'Comma Separated Values (for Outlook)'}]);
|
||||
return([{defaultExtension:'csv',
|
||||
extensionFilter:'*.csv',
|
||||
description:'Comma Separated Values (from Outlook)'}]);
|
||||
};
|
||||
|
||||
// not prototype.export. export is reserved.
|
||||
|
|
Загрузка…
Ссылка в новой задаче