Skip to content

Commit

Permalink
Feature/Bug 580252 - Introduce pref gloda.list.immediate to open Glod…
Browse files Browse the repository at this point in the history
…a result list immediately, take 2, numeric pref. (Issue #169)
  • Loading branch information
Betterbird committed Jun 28, 2023
1 parent c5aa194 commit b876d89
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# HG changeset patch
# User Betterbird <[email protected]>
# Date 1687990089 -7200
# Date 1687991707 -7200
# Parent 2d4670803d7d53cd565135a29a94734a3d10da12
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,17 @@ pref("media.autoplay.enabled", false);
@@ -631,16 +631,20 @@ pref("media.autoplay.enabled", false);
pref("gloda.facetview.hidetimeline", true);

// Behavior of sort-by setting in search results:
Expand All @@ -16,7 +16,10 @@ diff --git a/mail/app/profile/all-thunderbird.js b/mail/app/profile/all-thunderb
// 2 - default to "relevance", but remember user preference when it is changed
// 3 - default to "date", but remember user preference when it is changed
pref("gloda.facetview.sortby", 2);
+pref("gloda.list.immediate", false);
+// 0 - Open facet view
+// 1 - Open facet view and list view
+// 2 - Open list view only (closing facet view)
+pref("gloda.list.immediate", 0);

// Enable gloda by default!
pref("mailnews.database.global.indexer.enabled", true);
Expand All @@ -28,7 +31,7 @@ diff --git a/mail/app/profile/all-thunderbird.js b/mail/app/profile/all-thunderb
diff --git a/mail/base/content/glodaFacetTab.js b/mail/base/content/glodaFacetTab.js
--- a/mail/base/content/glodaFacetTab.js
+++ b/mail/base/content/glodaFacetTab.js
@@ -82,16 +82,25 @@ var glodaFacetTabType = {
@@ -82,16 +82,30 @@ var glodaFacetTabType = {
"chrome://messenger/content/glodaFacetView.xhtml"
);

Expand All @@ -37,13 +40,18 @@ diff --git a/mail/base/content/glodaFacetTab.js b/mail/base/content/glodaFacetTa
searchInput.focus();
}

+ if (Services.prefs.getBoolPref("gloda.list.immediate", false)) {
+ let listImmediate = Services.prefs.getIntPref("gloda.list.immediate", 0);
+ if (listImmediate) {
+ aTab.iframe.contentWindow.addEventListener("DOMContentLoaded", async () => {
+ let win = aTab.iframe.contentDocument.getElementById("browser").contentWindow;
+ while (!win.FacetContext) {
+ await new Promise(r => top.window.setTimeout(r, 100));
+ }
+ win.FacetContext.showActiveSetInTab();
+ if (listImmediate == 2) {
+ let tabmail = top.window.document.getElementById("tabmail");
+ tabmail.closeTab(aTab);
+ }
+ }, { once: true });
+ }
aTab.iframe.contentWindow.addEventListener("load", xulLoadHandler, {
Expand Down

0 comments on commit b876d89

Please sign in to comment.