Revision control
Copy as Markdown
Other Tools
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
ChromeUtils.defineESModuleGetters(this, {
});
/**
* Tab type that opens Gloda search results directly as a mail3PaneTab list
* view, bypassing the faceted search interface.
*/
const glodaTableListTabType = {
name: "glodaTableList",
perTabPanel: "vbox",
lastTabId: 0,
strings: Services.strings.createBundle(
),
modes: {
glodaTableList: {
type: "glodaSearch",
},
},
openTab(aTab, aArgs) {
aTab.panel.setAttribute("id", "glodaListTab" + this.lastTabId);
const tabmail = document.getElementById("tabmail");
// Already-resolved items (e.g. from the facet view's active set button).
if ("items" in aArgs) {
tabmail.openTab("mail3PaneTab", {
folderPaneVisible: false,
syntheticView: new GlodaSyntheticView({
collection: Gloda.explicitCollection(
GlodaConstants.NOUN_MESSAGE,
aArgs.items
),
}),
title:
aArgs.title ||
this.strings.GetStringFromName("glodaFacetView.tab.query.label"),
});
this.lastTabId++;
tabmail.closeTab(aTab);
return;
}
// Async query/searcher: open once the collection finishes loading.
let collection, title;
if ("query" in aArgs) {
collection = aArgs.query.getCollection();
title = this.strings.GetStringFromName("glodaFacetView.tab.query.label");
} else if ("searcher" in aArgs) {
collection = aArgs.searcher.getCollection();
title =
aArgs.searcher.searchString ||
this.strings.GetStringFromName("glodaFacetView.tab.search.label");
} else {
return;
}
this.lastTabId++;
collection.listener = {
onItemsAdded() {},
onItemsModified() {},
onItemsRemoved() {},
onQueryCompleted() {
tabmail.openTab("mail3PaneTab", {
folderPaneVisible: false,
syntheticView: new GlodaSyntheticView({
collection: Gloda.explicitCollection(
GlodaConstants.NOUN_MESSAGE,
collection.items
),
}),
title,
});
tabmail.closeTab(aTab);
},
};
},
closeTab() {},
saveTabState() {},
showTab() {},
getBrowser() {
return null;
},
};