Closed RealRaven2000 closed 4 months ago
To make this possible I made a wrapper function Util.getFileInitArg(window)
which passes back either depending on the Thunderbird version:
getFileInitArg: function(win) {
if (!win) return null;
if (this.versionGreaterOrEqual(this.AppverFull, "125")) {
return win.browsingContext;
}
return win;
},
this can then be used within filepicker.init()
like this:
let fp = Cc['@mozilla.org/filepicker;1'].createInstance(Ci.nsIFilePicker);
if (fileType=='folder') {
fp.init(SmartTemplate4.Util.getFileInitArg(window), "", fp.modeGetFolder);
} else {
fp.init(SmartTemplate4.Util.getFileInitArg(window), "", fp.modeOpen); // second parameter: prompt
}
Here is a version that fixes the issue - compatible with Tb 128.*, tested on current beta 128.0b3.
To try the version above download zip file and drag the file into Thunderbird Add-ons Manager (do not extract contents, it won't install like that)
Implemented in 4.6 - published 14/07/2024
According to bug 1878401 a parameter was changed in mozilla-central for the interface
nsIFilePicker.init()
- it will fail when we pass inwindow
as first parameter. The c-c source code shows that instead we need to plug inwindow.browsingContext
. This needs to be fixed in a way so that SmartTemplates stays compatible with Thunderbird 115 but is also compatible with Thunderbird 125 and later.