From bd9553c285b5d9b3b1db06b4bb71f1a2e20904f7 Mon Sep 17 00:00:00 2001 From: "scott%scott-macgregor.org" Date: Thu, 15 Apr 2004 23:36:17 +0000 Subject: [PATCH] Follow up to Bug #240138 --> Add pref UI for turning on / off showing just the display name for contacts you know. --- mail/app/profile/thunderbird.js | 2 ++ mail/base/content/msgHdrViewOverlay.js | 26 ++++++++++++++++++- .../prefwindow/content/pref-advanced.xul | 5 +++- .../prefwindow/locale/pref-advanced.dtd | 1 + 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/mail/app/profile/thunderbird.js b/mail/app/profile/thunderbird.js index 9df17a11f5e..44cba1925f6 100644 --- a/mail/app/profile/thunderbird.js +++ b/mail/app/profile/thunderbird.js @@ -44,6 +44,8 @@ pref("general.useragent.vendorSub", // Overrides of the seamonkey suite mailnews.js prefs ///////////////////////////////////////////////////////////////// pref("mail.showFolderPaneColumns", false); // setting to true will allow total/unread/size columns +pref("mail.showCondensedAddresses", true); // show the friendly display name for people I know + pref("mailnews.message_display.allow.plugins", false); // disable plugins by default // hidden pref for changing how we present attachments in the message pane diff --git a/mail/base/content/msgHdrViewOverlay.js b/mail/base/content/msgHdrViewOverlay.js index cdd37b34c9d..0d0edf4643b 100644 --- a/mail/base/content/msgHdrViewOverlay.js +++ b/mail/base/content/msgHdrViewOverlay.js @@ -65,6 +65,7 @@ var gMessengerBundle; var gProfileDirURL; var gIOService; var gFileHandler; +var gShowCondensedEmailAddresses = true; // show the friendly display names for people I know instead of the name + email address var gPersonalAddressBookDirectory; // used for determining if we want to show just the display name in email address nodes var msgHeaderParser = Components.classes[msgHeaderParserContractID].getService(Components.interfaces.nsIMsgHeaderParser); @@ -219,6 +220,11 @@ function OnLoadMsgHeaderPane() gMinNumberOfHeaders = pref.getIntPref("mailnews.headers.minNumHeaders"); gShowOrganization = pref.getBoolPref("mailnews.headers.showOrganization"); gShowLargeAttachmentView = pref.getBoolPref("mailnews.attachments.display.largeView"); + gShowCondensedEmailAddresses = pref.getBoolPref("mail.showCondensedAddresses"); + + // listen to the + pref.addObserver("mail.showCondensedAddresses", MsgHdrViewObserver, false); + initializeHeaderViewTables(); var toggleHeaderView = document.getElementById("msgHeaderView"); @@ -235,6 +241,8 @@ function OnLoadMsgHeaderPane() function OnUnloadMsgHeaderPane() { + pref.removeObserver("mail.showCondensedAddresses", MsgHdrViewObserver); + // dispatch an event letting any listeners know that we have unloaded the message pane var event = document.createEvent('Events'); event.initEvent('messagepane-unloaded', false, true); @@ -242,6 +250,22 @@ function OnUnloadMsgHeaderPane() headerViewElement.dispatchEvent(event); } +const MsgHdrViewObserver = +{ + observe: function(subject, topic, prefName) + { + // verify that we're changing the mail pane config pref + if (topic == "nsPref:changed") + { + if (prefName == "mail.showCondensedAddresses") + { + gShowCondensedEmailAddresses = pref.getBoolPref("mail.showCondensedAddresses"); + MsgReload(); + } + } + } +}; + // The messageHeaderSink is the class that gets notified of a message's headers as we display the message // through our mime converter. @@ -845,7 +869,7 @@ function AddExtraAddressProcessing(emailAddress, addressNode) var displayName = addressNode.getTextAttribute("displayName"); var emailAddress = addressNode.getTextAttribute("emailAddress"); - if (displayName && useDisplayNameForAddress(emailAddress)) + if (gShowCondensedEmailAddresses && displayName && useDisplayNameForAddress(emailAddress)) addressNode.setAttribute('label', displayName); } diff --git a/mail/components/prefwindow/content/pref-advanced.xul b/mail/components/prefwindow/content/pref-advanced.xul index c977b73dc56..7a1b04e81e4 100644 --- a/mail/components/prefwindow/content/pref-advanced.xul +++ b/mail/components/prefwindow/content/pref-advanced.xul @@ -62,7 +62,7 @@ "emailCollectionOutgoing", "localDirectoriesList", // general settings - "markAsRead", "markAsReadDelay", "showFolderPaneColumns", + "showCondensedAddresses", "markAsRead", "markAsReadDelay", "showFolderPaneColumns", // connection "networkProxyType", @@ -125,6 +125,9 @@ + + + diff --git a/mail/components/prefwindow/locale/pref-advanced.dtd b/mail/components/prefwindow/locale/pref-advanced.dtd index fb1c0e0dbd1..365a6a6b22c 100644 --- a/mail/components/prefwindow/locale/pref-advanced.dtd +++ b/mail/components/prefwindow/locale/pref-advanced.dtd @@ -15,6 +15,7 @@ +