RealRaven2000 / quickFilters

Thunderbird Add-on: quickFilters
http://quickfilters.quickfolders.org/
Other
46 stars 11 forks source link

Fix file picker which is broken in Thunderbird 125 #244

Open RealRaven2000 opened 2 weeks ago

RealRaven2000 commented 2 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 quickFilters stays compatible with Thunderbird 115 but is also compatible with Thunderbird 125 and later.

RealRaven2000 commented 2 weeks ago

This is a toolbar added by quickFilters (in message filters dialog) with the affected buttons to backup / restore filters:

image

these buttons don't work anymore in the current beta (128.0b1)

RealRaven2000 commented 1 week 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 1 week ago

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

quickFilters-wx-6.5pre21.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)