From 2951a4073aa4564c01e1f41b48a70cc3d158e532 Mon Sep 17 00:00:00 2001 From: Betterbird Date: Fri, 7 Jul 2023 09:45:43 +0200 Subject: [PATCH] [102] Feature/Bug 580252 - Introduce pref gloda.list.immediate to open Gloda result list immediately, take 4: More hackery to display the list when ready (Issue #169) --- ...-pref-to-open-gloda-list-immediately.patch | 72 ++++++++++++++++++- ...-pref-to-open-gloda-list-immediately.patch | 70 +++++++++++++++++- 2 files changed, 137 insertions(+), 5 deletions(-) diff --git a/102/features/feature-580252-introduce-pref-to-open-gloda-list-immediately.patch b/102/features/feature-580252-introduce-pref-to-open-gloda-list-immediately.patch index f14dc083..56e6145d 100644 --- a/102/features/feature-580252-introduce-pref-to-open-gloda-list-immediately.patch +++ b/102/features/feature-580252-introduce-pref-to-open-gloda-list-immediately.patch @@ -1,13 +1,13 @@ # HG changeset patch # User Betterbird -# Date 1688025052 -7200 -# Parent 2d4670803d7d53cd565135a29a94734a3d10da12 +# Date 1688715193 -7200 +# Parent d9dd94ec690913d8b52234a3147b4321c162f2bb Bug 580252 - Introduce pref gloda.list.immediate to open Gloda result list immediately. diff --git a/mail/app/profile/all-thunderbird.js b/mail/app/profile/all-thunderbird.js --- a/mail/app/profile/all-thunderbird.js +++ b/mail/app/profile/all-thunderbird.js -@@ -631,16 +631,20 @@ pref("media.autoplay.enabled", false); +@@ -606,16 +606,20 @@ pref("media.autoplay.enabled", false); pref("gloda.facetview.hidetimeline", true); // Behavior of sort-by setting in search results: @@ -63,3 +63,69 @@ diff --git a/mail/base/content/glodaFacetTab.js b/mail/base/content/glodaFacetTa "src", "chrome://messenger/content/glodaFacetViewWrapper.xhtml" ); +diff --git a/mail/base/content/glodaFacetView.js b/mail/base/content/glodaFacetView.js +--- a/mail/base/content/glodaFacetView.js ++++ b/mail/base/content/glodaFacetView.js +@@ -452,16 +452,17 @@ ActiveNonSingularConstraint.prototype = + isExcludedGroup(aGroupValue) { + let valId = aGroupValue[this.facetDef.groupIdAttr]; + return valId in this.excludedGroupIds; + }, + }; + + var FacetContext = { + facetDriver: new FacetDriver(Gloda.lookupNounDef("message"), window), ++ _readyToShow: false, + + /** + * The root collection which our active set is a subset of. We hold onto this + * for garbage collection reasons, although the tab that owns us should also + * be holding on. + */ + _collection: null, + set collection(aCollection) { +@@ -698,16 +699,17 @@ var FacetContext = { + } + } + + if (!this._timelineShown) { + this._hideTimeline(true); + } + + this._showResults(); ++ this._readyToShow = true; + + if (this._callbackOnFacetComplete) { + let callback = this._callbackOnFacetComplete; + this._callbackOnFacetComplete = null; + callback(); + } + }, + +@@ -989,17 +991,25 @@ var FacetContext = { + this.tab.searcher.andTerms = !this.tab.searcher.andTerms; + this._resetUI(); + this.collection = this.tab.searcher.getCollection(this); + }, + + /** + * Show the active message set in a glodaList tab. + */ +- showActiveSetInTab() { ++ async showActiveSetInTab() { ++ let count = 0; ++ while (count++ < 20 && !this._readyToShow) { ++ await new Promise(r => top.window.setTimeout(r, 100)); ++ } ++ if (!this._readyToShow) { ++ return; ++ } ++ + let tabmail = this.rootWin.document.getElementById("tabmail"); + tabmail.openTab("glodaList", { + collection: Gloda.explicitCollection(Gloda.NOUN_MESSAGE, this.activeSet), + title: this.tab.title, + }); + }, + + /** diff --git a/115/features/feature-580252-introduce-pref-to-open-gloda-list-immediately.patch b/115/features/feature-580252-introduce-pref-to-open-gloda-list-immediately.patch index f14dc083..084323e2 100644 --- a/115/features/feature-580252-introduce-pref-to-open-gloda-list-immediately.patch +++ b/115/features/feature-580252-introduce-pref-to-open-gloda-list-immediately.patch @@ -1,7 +1,7 @@ # HG changeset patch # User Betterbird -# Date 1688025052 -7200 -# Parent 2d4670803d7d53cd565135a29a94734a3d10da12 +# Date 1688715703 -7200 +# Parent d3541986f0555cfad42873068f6536909e09785c Bug 580252 - Introduce pref gloda.list.immediate to open Gloda result list immediately. diff --git a/mail/app/profile/all-thunderbird.js b/mail/app/profile/all-thunderbird.js @@ -63,3 +63,69 @@ diff --git a/mail/base/content/glodaFacetTab.js b/mail/base/content/glodaFacetTa "src", "chrome://messenger/content/glodaFacetViewWrapper.xhtml" ); +diff --git a/mail/base/content/glodaFacetView.js b/mail/base/content/glodaFacetView.js +--- a/mail/base/content/glodaFacetView.js ++++ b/mail/base/content/glodaFacetView.js +@@ -457,16 +457,17 @@ ActiveNonSingularConstraint.prototype = + isExcludedGroup(aGroupValue) { + let valId = aGroupValue[this.facetDef.groupIdAttr]; + return valId in this.excludedGroupIds; + }, + }; + + var FacetContext = { + facetDriver: new FacetDriver(Gloda.lookupNounDef("message"), window), ++ _readyToShow: false, + + /** + * The root collection which our active set is a subset of. We hold onto this + * for garbage collection reasons, although the tab that owns us should also + * be holding on. + */ + _collection: null, + set collection(aCollection) { +@@ -703,16 +704,17 @@ var FacetContext = { + } + } + + if (!this._timelineShown) { + this._hideTimeline(true); + } + + this._showResults(); ++ this._readyToShow = true; + + if (this._callbackOnFacetComplete) { + let callback = this._callbackOnFacetComplete; + this._callbackOnFacetComplete = null; + callback(); + } + }, + +@@ -994,17 +996,25 @@ var FacetContext = { + this.tab.searcher.andTerms = !this.tab.searcher.andTerms; + this._resetUI(); + this.collection = this.tab.searcher.getCollection(this); + }, + + /** + * Show the active message set in a 3-pane tab. + */ +- showActiveSetInTab() { ++ async showActiveSetInTab() { ++ let count = 0; ++ while (count++ < 20 && !this._readyToShow) { ++ await new Promise(r => top.window.setTimeout(r, 100)); ++ } ++ if (!this._readyToShow) { ++ return; ++ } ++ + let tabmail = this.rootWin.document.getElementById("tabmail"); + tabmail.openTab("mail3PaneTab", { + folderPaneVisible: false, + syntheticView: new GlodaSyntheticView({ + collection: Gloda.explicitCollection( + GlodaConstants.NOUN_MESSAGE, + this.activeSet + ),