Closed Bug 316756 Opened 14 years ago Closed 14 years ago

HTML option is listed twice in type dropdown box for export

Categories

(Calendar :: Sunbird Only, defect, trivial)

Sunbird 0.3a1
x86
Windows 2000
defect
Not set
trivial

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: kristof.coomans, Assigned: mostafah)

Details

Attachments

(2 files, 1 obsolete file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8) Gecko/20051025 Firefox/1.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a1) Gecko/20051104 Mozilla Sunbird/0.3a1

When I want to export my calendar, I get a "save as" dialog. In the "Save as type:" dropdown box, the option "HTML" is listed twice.

Reproducible: Always

Steps to Reproduce:
1. In the menu, choose File > Export Selection...
2. Open the dropdown box with the caption "Save as type:".
3. You will see the option "HTML" twice.



Expected Results:  
The HTML option should be only listed once, or if it or two different types of HTML exports then the option names chouldn't be the same.
Version: unspecified → Sunbird 0.3a1
According to http://lxr.mozilla.org/mozilla/source/calendar/import-export/calHtmlExport.js#58 one entry is for *.htm file extension and the other one for *.html file extension:

    calHtmlExporter.prototype.getFileTypes =
    function getFileTypes(aCount) {
        aCount.value = 2;
        return([{extension:'html',description:'HTML'},
                {extension:'htm',description:'HTML'}]);
    };
    
The simplest solution would be to change the description entries.

The better solution (in my opinion) would be to return the extensions already in the right format for filepicker's filter list, allowing multiple extensions for one entry like:

    [...]
    return([{extension:'*.html; *.htm',description:'HTML'}]);
    [...]

This would require changes to calHtmlExporter, calIcsExporter, calOutlookCSVExporter, loadEventsFromFile() and update of description for calIFileType.

Same for the importers if desired.

Comments?
Status: UNCONFIRMED → NEW
Ever confirmed: true
This is the "Save as" dialog of Microsoft Excel, as it is a good example of how it can be done. In the "Save as type:" dropdown box, there's only one option: Web page (*.htm, *.html)
Attached patch use filter mask (obsolete) — Splinter Review
This implements the solution proposed in comment #1; allowing flexible filter masks with multiple extensions for importer and exporter.

This also fixes an error that happend when you left the filepicker dialog with cancel (fp.file has no property ...).
Attachment #203456 - Flags: first-review?(mvl)
Comment on attachment 203456 [details] [diff] [review]
use filter mask

Looks good, but i think that for clarity you should rename calIFileType.extension to .extensionMask or .extensionFilter. It no longer is just one, and no longer just the extension.
Attachment #203456 - Flags: first-review?(mvl) → first-review-
Patch updated according to comment #4.
Renamed calIFileType.extension to calIFileType.extensionFilter.
Added calIFileType.defaultExtension to save the problem in saveEventsToFile() if no extension was specified.
Attachment #203456 - Attachment is obsolete: true
Attachment #203575 - Flags: first-review?
Attachment #203575 - Flags: first-review? → first-review?(mvl)
Comment on attachment 203575 [details] [diff] [review]
use filter mask, v2

r=mvl
Attachment #203575 - Flags: first-review?(mvl) → first-review+
patch checked in
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.