Bug 1268325 - Hide correspondents behind a preference. r=squib a=jorgk
authorJorg K
Thu, 28 Apr 2016 22:25:53 +0200
changeset 27164 168a3e6360dff5a1ae742fe8b9dcb2b9b97d52a9
parent 27163 8a1fa074b1240324126f4a209878a616e7cc0a16
child 27165 ad615bd6ede5c84285a991c866d29b84e4446c2a
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssquib, jorgk
bugs1268325
Bug 1268325 - Hide correspondents behind a preference. r=squib a=jorgk
mail/app/profile/all-thunderbird.js
mail/base/content/folderDisplay.js
mailnews/mailnews.js
--- a/mail/app/profile/all-thunderbird.js
+++ b/mail/app/profile/all-thunderbird.js
@@ -327,16 +327,19 @@ pref("mail.warn_on_collapsed_thread_oper
 pref("mail.warn_on_shift_delete", true);
 
 // When using commands like "next message" or "previous message", leave
 // at least this percentage of the thread pane visible above / below the
 // selected message.
 pref("mail.threadpane.padding.top_percent", 10);
 pref("mail.threadpane.padding.bottom_percent", 10);
 
+// Use correspondents column instead of from/recipient columns.
+pref("mail.threadpane.use_correspondents", true);
+
 // only affects cookies from RSS articles
 // 0-Accept, 1-dontAcceptForeign, 2-dontUse
 pref("network.cookie.cookieBehavior", 0);
 
 // clear the SeaMonkey pref, so we don't hear about how we don't have a chrome
 // package registered for editor-region while opening about:config
 pref("editor.throbber.url", "");
 
--- a/mail/base/content/folderDisplay.js
+++ b/mail/base/content/folderDisplay.js
@@ -416,17 +416,18 @@ FolderDisplayWidget.prototype = {
    *  it is actually an appropriate default for the folder type.
    */
   DEFAULT_COLUMNS: [
     "threadCol",
     "attachmentCol",
     "flaggedCol",
     "subjectCol",
     "unreadButtonColHeader",
-    "senderCol", // news folders
+    "senderCol", // news folders or incoming folders when correspondents not in use
+    "recipientCol", // outgoing folders when correspondents not in use
     "correspondentCol", // mail folders
     "junkStatusCol",
     "dateCol",
     "locationCol", // multiple-folder backed folders
   ],
 
   /**
    * Maps column ids to functions that test whether the column is a good default
@@ -435,23 +436,38 @@ FolderDisplayWidget.prototype = {
    *  properties like isMailFolder/isIncomingFolder/isOutgoingFolder allow the
    *  constraint to be expressed concisely.  If a helper does not exist, add
    *  one! (If doing so is out of reach, than access viewWrapper.displayedFolder
    *  to get at the nsIMsgFolder.)
    * If a column does not have a function, it is assumed that it should be
    *  displayed by default.
    */
   COLUMN_DEFAULT_TESTERS: {
-    // Don't show the correspondent for news or RSS where it doesn't make sense.
     correspondentCol: function (viewWrapper) {
-      return viewWrapper.isMailFolder && !viewWrapper.isFeedFolder;
+      if (Services.prefs.getBoolPref("mail.threadpane.use_correspondents")) {
+        // Don't show the correspondent for news or RSS where it doesn't make sense.
+        return viewWrapper.isMailFolder && !viewWrapper.isFeedFolder;
+      }
+      return false;
     },
-    // Instead show the sender.
     senderCol: function (viewWrapper) {
-      return viewWrapper.isNewsFolder || viewWrapper.isFeedFolder;
+      if (Services.prefs.getBoolPref("mail.threadpane.use_correspondents")) {
+        // Show the sender even if correspondent is enabled for news and feeds.
+        return viewWrapper.isNewsFolder || viewWrapper.isFeedFolder;
+      }
+      // senderCol = From. You only care in incoming folders.
+      return viewWrapper.isIncomingFolder;
+    },
+    recipientCol: function (viewWrapper) {
+      if (Services.prefs.getBoolPref("mail.threadpane.use_correspondents")) {
+        // No recipient column if we use correspondent.
+        return false;
+      }
+      // recipientCol = To. You only care in outgoing folders.
+      return viewWrapper.isOutgoingFolder;
     },
     // Only show the location column for non-single-folder results
     locationCol: function(viewWrapper) {
       return !viewWrapper.isSingleFolder;
     },
     // core UI does not provide an ability to mark newsgroup messages as spam
     junkStatusCol: function(viewWrapper) {
       return !viewWrapper.isNewsFolder;
@@ -732,43 +748,16 @@ FolderDisplayWidget.prototype = {
     this._savedColumnStates = this.getColumnStates();
   },
 
   /**
    * Restores the visible columns saved by |_saveColumnStates|.
    */
   _restoreColumnStates: function FolderDisplayWidget__restoreColumnStates() {
     if (this._savedColumnStates) {
-      // upgrade column states that don't have a correspondent column
-      if (Services.prefs.getBoolPref("mailnews.ui.upgrade.correspondents") &&
-          (this._savedColumnStates.senderCol ||
-           this._savedColumnStates.recipientCol) &&
-          !this._savedColumnStates.correspondentCol) {
-        this._savedColumnStates.correspondentCol =
-          this._getDefaultColumnsForCurrentFolder(true).correspondentCol;
-        if (this._savedColumnStates.correspondentCol.visible) {
-          if (this._savedColumnStates.senderCol &&
-            this._savedColumnStates.senderCol.visible &&
-            this._savedColumnStates.senderCol.ordinal) {
-            this._savedColumnStates.senderCol.visible = false;
-            this._savedColumnStates.correspondentCol.ordinal =
-              this._savedColumnStates.senderCol.ordinal;
-          }
-          if (this._savedColumnStates.recipientCol &&
-            this._savedColumnStates.recipientCol.visible &&
-            this._savedColumnStates.recipientCol.ordinal) {
-            this._savedColumnStates.recipientCol.visible = false;
-            this._savedColumnStates.correspondentCol.ordinal =
-              this._savedColumnStates.recipientCol.ordinal;
-          }
-          if (!this._savedColumnStates.correspondentCol.ordinal)
-            this._savedColumnStates.correspondentCol.visible = false;
-        }
-      }
-
       this.setColumnStates(this._savedColumnStates);
       this._savedColumnStates = null;
     }
   },
   //@}
 
   /**
    * @name What To Display
--- a/mailnews/mailnews.js
+++ b/mailnews/mailnews.js
@@ -727,19 +727,16 @@ pref("mailnews.ui.addressbook_panel_resu
 // see abCommon.js and abSelectAddressesDialog.js
 pref("mailnews.ui.select_addresses_results.version", 1);
 // for manual upgrades of certain UI features.
 // 1 -> 2 is for the ab results pane
 // to hide the non default columns in the advanced directory search dialog
 // see abCommon.js and ABSearchDialog.js
 pref("mailnews.ui.advanced_directory_search_results.version", 1);
 
-// from/recipient columns will be replaced with correspondents column
-pref("mailnews.ui.upgrade.correspondents", true);
-
 // default description and color prefs for tags
 // (we keep the .labels. names for backwards compatibility)
 pref("mailnews.labels.description.1", "chrome://messenger/locale/messenger.properties");
 pref("mailnews.labels.description.2", "chrome://messenger/locale/messenger.properties");
 pref("mailnews.labels.description.3", "chrome://messenger/locale/messenger.properties");
 pref("mailnews.labels.description.4", "chrome://messenger/locale/messenger.properties");
 pref("mailnews.labels.description.5", "chrome://messenger/locale/messenger.properties");
 pref("mailnews.labels.color.1", "#FF0000"); // default: red