RealRaven2000 / FiltaQuilla

Adds many new mail filter actions to Thunderbird
http://quickfilters.quickfolders.org/filtaquilla.html
GNU General Public License v3.0
82 stars 15 forks source link

Fix file picker which is broken in Thunderbird 125 #265

Open RealRaven2000 opened 4 weeks ago

RealRaven2000 commented 4 weeks ago

According to bug 1878401 a parameter was changed in mozilla-central for the interface nsIFilePicker.init() - it will fail when we pass in window as first parameter. The c-c source code shows that instead we need to plug in window.browsingContext. This needs to be fixed in a way so that filtaQuilla stays compatible with Thunderbird 115 but is also compatible with Thunderbird 125 and later.

RealRaven2000 commented 4 weeks ago

Here is an example for a "file open" UI element (in edit filter) that is broken by this bug: image

RealRaven2000 commented 2 weeks 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
    }
RealRaven2000 commented 2 weeks ago

Here is a version that fixes the issue - compatible with Tb 128.*, tested on current beta 128.0b3.

filtaquilla-4.1pre27.zip


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)