Bug 1828499 - Add a sort menu to the threadPaneDisplayButton menu. r=Paenglab
Differential Revision: https://phabricator.services.mozilla.com/D180040 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
efc5ee6a99
Коммит
344c4c7927
|
@ -3887,8 +3887,13 @@ var threadPaneHeader = {
|
|||
|
||||
/**
|
||||
* Update the context menu to reflect the currently selected display options.
|
||||
*
|
||||
* @param {Event} event - The popupshowing DOMEvent.
|
||||
*/
|
||||
updateDisplayContextMenu() {
|
||||
updateDisplayContextMenu(event) {
|
||||
if (event.target.id != "threadPaneDisplayContext") {
|
||||
return;
|
||||
}
|
||||
const isTableLayout = document.body.classList.contains("layout-table");
|
||||
document
|
||||
.getElementById(
|
||||
|
@ -3897,6 +3902,54 @@ var threadPaneHeader = {
|
|||
.setAttribute("checked", "true");
|
||||
},
|
||||
|
||||
/**
|
||||
* Update the menuitems inside the thread pane sort menupopup.
|
||||
*
|
||||
* @param {Event} event - The popupshowing DOMEvent.
|
||||
*/
|
||||
updateThreadPaneSortMenu(event) {
|
||||
if (event.target.id != "menu_threadPaneSortPopup") {
|
||||
return;
|
||||
}
|
||||
|
||||
const hiddenColumns = threadPane.columns
|
||||
.filter(c => c.hidden)
|
||||
.map(c => c.sortKey);
|
||||
|
||||
// Update menuitem to reflect sort key.
|
||||
for (const menuitem of event.target.querySelectorAll(`[name="sortby"]`)) {
|
||||
const sortKey = menuitem.getAttribute("value");
|
||||
menuitem.setAttribute(
|
||||
"checked",
|
||||
gViewWrapper.primarySortType == Ci.nsMsgViewSortType[sortKey]
|
||||
);
|
||||
if (hiddenColumns.includes(sortKey)) {
|
||||
menuitem.setAttribute("disabled", "true");
|
||||
} else {
|
||||
menuitem.removeAttribute("disabled");
|
||||
}
|
||||
}
|
||||
|
||||
// Update sort direction menu items.
|
||||
event.target
|
||||
.querySelector(`[value="ascending"]`)
|
||||
.setAttribute("checked", gViewWrapper.isSortedAscending);
|
||||
event.target
|
||||
.querySelector(`[value="descending"]`)
|
||||
.setAttribute("checked", !gViewWrapper.isSortedAscending);
|
||||
|
||||
// Update the threaded and groupedBy menu items.
|
||||
event.target
|
||||
.querySelector(`[value="threaded"]`)
|
||||
.setAttribute("checked", gViewWrapper.showThreaded);
|
||||
event.target
|
||||
.querySelector(`[value="unthreaded"]`)
|
||||
.setAttribute("checked", gViewWrapper.showUnthreaded);
|
||||
event.target
|
||||
.querySelector(`[value="group"]`)
|
||||
.setAttribute("checked", gViewWrapper.showGroupedBySort);
|
||||
},
|
||||
|
||||
/**
|
||||
* Change the display view of the message list pane.
|
||||
*
|
||||
|
|
|
@ -590,7 +590,7 @@
|
|||
<menupopup id="threadPaneDisplayContext"
|
||||
class="no-accel-menupopup"
|
||||
position="bottomleft topleft"
|
||||
onpopupshowing="threadPaneHeader.updateDisplayContextMenu();">
|
||||
onpopupshowing="threadPaneHeader.updateDisplayContextMenu(event);">
|
||||
<menuitem id="threadPaneTableView"
|
||||
class="thread-view-option"
|
||||
type="radio"
|
||||
|
@ -608,6 +608,137 @@
|
|||
data-l10n-id="thread-pane-header-context-cards-view"
|
||||
oncommand="threadPaneHeader.changePaneView(event);"/>
|
||||
<menuseparator id="separatorBeforeHideThreadHeaderOption"/>
|
||||
<menu id="threadPaneSortMenu"
|
||||
accesskey="&sortMenu.accesskey;"
|
||||
label="&sortMenu.label;">
|
||||
<menupopup id="menu_threadPaneSortPopup"
|
||||
oncommand="goDoCommand('cmd_sort', event);"
|
||||
onpopupshowing="threadPaneHeader.updateThreadPaneSortMenu(event);">
|
||||
<menuitem id="threadPaneSortByDateMenuitem"
|
||||
type="radio"
|
||||
name="sortby"
|
||||
value="byDate"
|
||||
label="&sortByDateCmd.label;"
|
||||
accesskey="&sortByDateCmd.accesskey;"/>
|
||||
<menuitem id="threadPaneSortByReceivedMenuitem"
|
||||
type="radio"
|
||||
name="sortby"
|
||||
value="byReceived"
|
||||
label="&sortByReceivedCmd.label;"
|
||||
accesskey="&sortByReceivedCmd.accesskey;"/>
|
||||
<menuitem id="threadPaneSortByFlagMenuitem"
|
||||
type="radio"
|
||||
name="sortby"
|
||||
value="byFlagged"
|
||||
label="&sortByStarCmd.label;"
|
||||
accesskey="&sortByStarCmd.accesskey;"/>
|
||||
<menuitem id="threadPaneSortByOrderReceivedMenuitem"
|
||||
type="radio"
|
||||
name="sortby"
|
||||
value="byId"
|
||||
label="&sortByOrderReceivedCmd.label;"
|
||||
accesskey="&sortByOrderReceivedCmd.accesskey;"/>
|
||||
<menuitem id="threadPaneSortByPriorityMenuitem"
|
||||
type="radio"
|
||||
name="sortby"
|
||||
value="byPriority"
|
||||
label="&sortByPriorityCmd.label;"
|
||||
accesskey="&sortByPriorityCmd.accesskey;"/>
|
||||
<menuitem id="threadPaneSortByFromMenuitem"
|
||||
type="radio"
|
||||
name="sortby"
|
||||
value="byAuthor"
|
||||
label="&sortByFromCmd.label;"
|
||||
accesskey="&sortByFromCmd.accesskey;"/>
|
||||
<menuitem id="threadPaneSortByRecipientMenuitem"
|
||||
type="radio"
|
||||
name="sortby"
|
||||
value="byRecipient"
|
||||
label="&sortByRecipientCmd.label;"
|
||||
accesskey="&sortByRecipientCmd.accesskey;"/>
|
||||
<menuitem id="threadPaneSortByCorrespondentMenuitem"
|
||||
type="radio"
|
||||
name="sortby"
|
||||
value="byCorrespondent"
|
||||
label="&sortByCorrespondentCmd.label;"
|
||||
accesskey="&sortByCorrespondentCmd.accesskey;"/>
|
||||
<menuitem id="threadPaneSortBySizeMenuitem"
|
||||
type="radio"
|
||||
name="sortby"
|
||||
value="bySize"
|
||||
label="&sortBySizeCmd.label;"
|
||||
accesskey="&sortBySizeCmd.accesskey;"/>
|
||||
<menuitem id="threadPaneSortByStatusMenuitem"
|
||||
type="radio"
|
||||
name="sortby"
|
||||
value="byStatus"
|
||||
label="&sortByStatusCmd.label;"
|
||||
accesskey="&sortByStatusCmd.accesskey;"/>
|
||||
<menuitem id="threadPaneSortBySubjectMenuitem"
|
||||
type="radio"
|
||||
name="sortby"
|
||||
value="bySubject"
|
||||
label="&sortBySubjectCmd.label;"
|
||||
accesskey="&sortBySubjectCmd.accesskey;"/>
|
||||
<menuitem id="threadPaneSortByUnreadMenuitem"
|
||||
type="radio"
|
||||
name="sortby"
|
||||
value="byUnread"
|
||||
label="&sortByUnreadCmd.label;"
|
||||
accesskey="&sortByUnreadCmd.accesskey;"/>
|
||||
<menuitem id="threadPaneSortByTagsMenuitem"
|
||||
type="radio"
|
||||
name="sortby"
|
||||
value="byTags"
|
||||
label="&sortByTagsCmd.label;"
|
||||
accesskey="&sortByTagsCmd.accesskey;"/>
|
||||
<menuitem id="threadPaneSortByJunkStatusMenuitem"
|
||||
type="radio"
|
||||
name="sortby"
|
||||
value="byJunkStatus"
|
||||
label="&sortByJunkStatusCmd.label;"
|
||||
accesskey="&sortByJunkStatusCmd.accesskey;"/>
|
||||
<menuitem id="threadPaneSortByAttachmentsMenuitem"
|
||||
type="radio"
|
||||
name="sortby"
|
||||
value="byAttachments"
|
||||
label="&sortByAttachmentsCmd.label;"
|
||||
accesskey="&sortByAttachmentsCmd.accesskey;"/>
|
||||
<menuseparator id="threadPaneSortAfterAttachmentSeparator"/>
|
||||
<menuitem id="threadPaneSortAscending"
|
||||
type="radio"
|
||||
name="sortdirection"
|
||||
value="ascending"
|
||||
label="&sortAscending.label;"
|
||||
accesskey="&sortAscending.accesskey;"/>
|
||||
<menuitem id="threadPaneSortDescending"
|
||||
type="radio"
|
||||
name="sortdirection"
|
||||
value="descending"
|
||||
label="&sortDescending.label;"
|
||||
accesskey="&sortDescending.accesskey;"/>
|
||||
<menuseparator id="threadPaneSortAfterDescendingSeparator"/>
|
||||
<menuitem id="threadPaneSortThreaded"
|
||||
type="radio"
|
||||
name="threaded"
|
||||
value="threaded"
|
||||
label="&sortThreaded.label;"
|
||||
accesskey="&sortThreaded.accesskey;"/>
|
||||
<menuitem id="threadPaneSortUnthreaded"
|
||||
type="radio"
|
||||
name="threaded"
|
||||
value="unthreaded"
|
||||
label="&sortUnthreaded.label;"
|
||||
accesskey="&sortUnthreaded.accesskey;"/>
|
||||
<menuitem id="threadPaneGroupBySort"
|
||||
type="checkbox"
|
||||
name="group"
|
||||
value="group"
|
||||
label="&groupBySort.label;"
|
||||
accesskey="&groupBySort.accesskey;"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menuseparator id="separatorAfterSortOptions"/>
|
||||
<menuitem data-l10n-id="thread-pane-header-context-hide"
|
||||
oncommand="threadPaneHeader.toggleThreadPaneHeader();"/>
|
||||
</menupopup>
|
||||
|
|
Загрузка…
Ссылка в новой задаче