Bug 1632126 - Part 1: Add ability to mark all folders of an account as read. r=IanN DONTBUILD
authorFrank-Rainer Grahl <frgrahl@gmx.net>
Tue, 21 Apr 2020 13:50:59 +0200
changeset 38090 50c0bd84609522f8a563f744a9c9650e17f811d6
parent 38089 60f37dc61ea140c249866c86fa714eaffca01659
child 38091 61ae2dafd0a56785753f57cdebe4cd7bf77feeda
push id2595
push userclokep@gmail.com
push dateMon, 04 May 2020 19:02:04 +0000
treeherdercomm-beta@f53913797371 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersIanN
bugs1632126, 317301
Bug 1632126 - Part 1: Add ability to mark all folders of an account as read. r=IanN DONTBUILD Port Bug 317301 "Implement 'Mark all folders of account read'"
suite/locales/en-US/chrome/mailnews/messenger.dtd
suite/mailnews/content/mailContextMenus.js
suite/mailnews/content/mailWindowOverlay.js
suite/mailnews/content/mailWindowOverlay.xul
--- a/suite/locales/en-US/chrome/mailnews/messenger.dtd
+++ b/suite/locales/en-US/chrome/mailnews/messenger.dtd
@@ -497,16 +497,18 @@
 <!ENTITY contextPrint.label "Print…">
 <!ENTITY contextPrint.accesskey "P">
 <!ENTITY contextPrintPreview.label "Print Preview">
 <!ENTITY contextPrintPreview.accesskey "v">
 
 <!-- Folder Pane Context Menu -->
 <!ENTITY folderContextGetMessages.label "Get Messages for Account">
 <!ENTITY folderContextGetMessages.accesskey "G">
+<!ENTITY folderContextMarkAllFoldersRead.label "Mark All Folders Read">
+<!ENTITY folderContextMarkAllFoldersRead.accesskey "M">
 <!ENTITY folderContextOpenNewWindow.label "Open in New Mail Window">
 <!ENTITY folderContextOpenNewWindow.accesskey "W">
 <!ENTITY folderContextOpenNewTab.label "Open in New Tab">
 <!ENTITY folderContextOpenNewTab.accesskey "T">
 <!ENTITY folderContextRename.label "Rename">
 <!ENTITY folderContextRename.accesskey "R">
 <!ENTITY folderContextRemove.label "Delete">
 <!ENTITY folderContextRemove.accesskey "D">
--- a/suite/mailnews/content/mailContextMenus.js
+++ b/suite/mailnews/content/mailContextMenus.js
@@ -250,16 +250,19 @@ function FillFolderPaneContextMenu()
                        gMessengerBundle.getString("getMessagesFor"));
     else
       SetMenuItemLabel("folderPaneContext-getMessages",
                        gMessengerBundle.getString("getMessages"));
 
   ShowMenuItem("folderPaneContext-getMessages", (numSelected <= 1) && canGetMessages);
   EnableMenuItem("folderPaneContext-getMessages", true);
 
+  ShowMenuItem("folderPaneContext-sep4", (numSelected <= 1) && isServer);
+  ShowMenuItem("folderPaneContext-markAllFoldersRead", (numSelected <= 1) && isServer);
+
   ShowMenuItem("folderPaneContext-openNewWindow", (numSelected <= 1));
   EnableMenuItem("folderPaneContext-openNewWindow", true);
 
   ShowMenuItem("folderPaneContext-openNewTab", (numSelected <= 1));
   EnableMenuItem("folderPaneContext-openNewTab", true);
 
   SetupRenameMenuItem(folder, numSelected, isServer, serverType, specialFolder);
   SetupRemoveMenuItem(folder, numSelected, isServer, serverType, specialFolder);
--- a/suite/mailnews/content/mailWindowOverlay.js
+++ b/suite/mailnews/content/mailWindowOverlay.js
@@ -1743,16 +1743,33 @@ function MsgFindAgain(reverse)
   findAgainInPage(getFindInstData(), reverse);
 }
 
 function MsgCanFindAgain()
 {
   return canFindAgainInPage();
 }
 
+/**
+ * Go through each selected server and mark all its folders read.
+ */
+function MsgMarkAllFoldersRead() {
+  const selectedFolders = GetSelectedMsgFolders();
+  if (selectedFolders) {
+    const selectedServers = selectedFolders.filter(folder => folder.isServer);
+
+    selectedServers.forEach(function(server) {
+      const folders = server.rootFolder.descendants;
+      for (let folder of fixIterator(folders, Ci.nsIMsgFolder)) {
+        folder.markAllMessagesRead(msgWindow);
+      }
+    });
+  }
+}
+
 function MsgFilters(emailAddress, folder)
 {
     if (!folder)
       folder = GetFirstSelectedMsgFolder();
     var args;
     if (emailAddress)
     {
       // Prefill the filterEditor with the emailAddress.
--- a/suite/mailnews/content/mailWindowOverlay.xul
+++ b/suite/mailnews/content/mailWindowOverlay.xul
@@ -473,19 +473,24 @@
 
     <menuitem id="folderPaneContext-favoriteFolder"
               type="checkbox"
               label="&folderContextFavoriteFolder.label;"
               accesskey="&folderContextFavoriteFolder.accesskey;"
               checked="false"
               oncommand="ToggleFavoriteFolderFlag();"/>
     <menuitem id="folderPaneContext-properties"
-        label="&folderContextProperties.label;"
-        accesskey="&folderContextProperties.accesskey;"
-        oncommand="gFolderTreeController.editFolder();"/>
+              label="&folderContextProperties.label;"
+              accesskey="&folderContextProperties.accesskey;"
+              oncommand="gFolderTreeController.editFolder();"/>
+    <menuitem id="folderPaneContext-markAllFoldersRead"
+              label="&folderContextMarkAllFoldersRead.label;"
+              accesskey="&folderContextMarkAllFoldersRead.accesskey;"
+              oncommand="MsgMarkAllFoldersRead();"/>
+    <menuseparator id="folderPaneContext-sep4"/>
     <menuitem id="folderPaneContext-settings"
               label="&folderContextSettings.label;"
               accesskey="&folderContextSettings.accesskey;"
               oncommand="gFolderTreeController.editFolder();"/>
   </menupopup>
 
   <menupopup id="mailContext"
          onpopupshowing="return event.target != this ||