Reputation: 21
I want to write a Firefox Add-on which removes some special characters from the default filename (highlighted in red in the image below) in the "Save Page As" dialog in Firefox. Does the Firefox SDK API offer some way to alter this filename?
Upvotes: 1
Views: 345
Reputation: 7192
Check the defaultString of the nsIFilePicker e.g.
var nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp = Components.classes["@mozilla.org/filepicker;1"]
.createInstance(nsIFilePicker);
fp.init(window, "Select a File", nsIFilePicker.modeOpen);
fp.defaultString = defaultString; //Process the string as you want
fp.appendFilter(fileType, "*." + fileType);
var rv = fp.show();
Upvotes: 1