Bug 467012 Opening mails in message window gives only a blank window - sync customiseToolbar.js and provide a separate overlay for buttons specific to main mail window. r=mkmelin
authorMark Banner <bugzilla@standard8.plus.com>
Tue, 09 Dec 2008 20:57:03 +0000
changeset 1388 74c522b5c9bb6f1184e1a39964637e62525f9c72
parent 1387 1e7f2435544c0ccd9fcfe5d3124a4bae54ebbbad
child 1389 43cd29a7832d69443a9245273a3f029a59173a56
push id1095
push userbugzilla@standard8.plus.com
push dateTue, 09 Dec 2008 20:57:51 +0000
treeherdercomm-central@74c522b5c9bb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin
bugs467012
Bug 467012 Opening mails in message window gives only a blank window - sync customiseToolbar.js and provide a separate overlay for buttons specific to main mail window. r=mkmelin
mail/base/content/customizeToolbar.js
mail/base/content/extraCustomizeItems.xul
mail/base/content/mailWindowOverlay.xul
mail/base/content/messageWindow.js
mail/base/content/messenger.xul
mail/base/jar.mn
--- a/mail/base/content/customizeToolbar.js
+++ b/mail/base/content/customizeToolbar.js
@@ -229,23 +229,18 @@ function wrapToolbarItems(aStorePrevious
     var toolbar = getToolbarAt(i);
     if (isCustomizableToolbar(toolbar)) {
       if (aStorePreviousSet)
         toolbar.setAttribute('previousset', toolbar.currentSet);
 
       for (var k = 0; k < toolbar.childNodes.length; ++k) {
         var item = toolbar.childNodes[k];
         if (isToolbarItem(item)) {
-          var nextSibling = item.nextSibling;
-          
           var wrapper = wrapToolbarItem(item);     
-          if (nextSibling)
-            toolbar.insertBefore(wrapper, nextSibling);
-          else
-            toolbar.appendChild(wrapper);
+          cleanupItemForToolbar(item, wrapper);
         }
       }
     }
   }
 }
 
 /**
  * Unwraps all items in all customizable toolbars in a toolbox.
@@ -283,40 +278,39 @@ function wrapToolbarItems(aStorePrevious
   }
 }
 
 
 /**
  * Creates a wrapper that can be used to contain a toolbaritem and prevent
  * it from receiving UI events.
  */
-function createWrapper(aId)
+function createWrapper(aId, aDocument)
 {
-  var wrapper = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
-                                         "toolbarpaletteitem");
+  var wrapper = aDocument.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
+                                          "toolbarpaletteitem");
 
   wrapper.id = "wrapper-"+aId;  
   return wrapper;
 }
 
 /**
  * Wraps an item that has been cloned from a template and adds
  * it to the end of a row in the palette.
  */
 function wrapPaletteItem(aPaletteItem, aCurrentRow, aSpacer)
 {
-  var wrapper = createWrapper(aPaletteItem.id);
+  var wrapper = createWrapper(aPaletteItem.id, document);
 
   wrapper.setAttribute("flex", 1);
   wrapper.setAttribute("align", "center");
   wrapper.setAttribute("pack", "center");
   wrapper.setAttribute("minheight", "0");
   wrapper.setAttribute("minwidth", "0");
 
-  document.adoptNode(aPaletteItem);
   wrapper.appendChild(aPaletteItem);
   
   // XXX We need to call this AFTER the palette item has been appended
   // to the wrapper or else we crash dropping certain buttons on the 
   // palette due to removal of the command and disabled attributes - JRH
   cleanUpItemForPalette(aPaletteItem, wrapper);
 
   if (aSpacer)
@@ -328,24 +322,22 @@ function wrapPaletteItem(aPaletteItem, a
 
 /**
  * Wraps an item that is currently on a toolbar and replaces the item
  * with the wrapper. This is not used when dropping items from the palette,
  * only when first starting the dialog and wrapping everything on the toolbars.
  */
 function wrapToolbarItem(aToolbarItem)
 {
-  var wrapper = createWrapper(aToolbarItem.id);
-  gToolboxDocument.adoptNode(wrapper);
+  var wrapper = createWrapper(aToolbarItem.id, gToolboxDocument);
 
   cleanupItemForToolbar(aToolbarItem, wrapper);
   wrapper.flex = aToolbarItem.flex;
 
-  if (aToolbarItem.parentNode)
-    aToolbarItem.parentNode.removeChild(aToolbarItem);
+  aToolbarItem.parentNode.replaceChild(wrapper, aToolbarItem);
   
   wrapper.appendChild(aToolbarItem);
   
   return wrapper;
 }
 
 /**
  * Get the list of ids for the current set of items on each toolbar.
@@ -403,17 +395,17 @@ function buildPalette()
 
   var rowSlot = 3;
 
   var currentItems = getCurrentItemIds();
   templateNode = gToolbox.palette.firstChild;
   while (templateNode) {
     // Check if the item is already in a toolbar before adding it to the palette.
     if (!(templateNode.id in currentItems)) {
-      var paletteItem = templateNode.cloneNode(true);
+      var paletteItem = document.importNode(templateNode, true);
 
       if (rowSlot == kRowMax) {
         // Append the old row.
         paletteBox.appendChild(currentRow);
 
         // Make a new row.
         currentRow = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
                                               "hbox");
@@ -488,17 +480,18 @@ function cleanUpItemForPalette(aItem, aW
 {
   aWrapper.setAttribute("place", "palette");
   setWrapperType(aItem, aWrapper);
 
   if (aItem.hasAttribute("title"))
     aWrapper.setAttribute("title", aItem.getAttribute("title"));
   else if (isSpecialItem(aItem)) {
     var stringBundle = document.getElementById("stringBundle");
-    var title = stringBundle.getString(aItem.id + "Title");
+    // Remove the common "toolbar" prefix to generate the string name.
+    var title = stringBundle.getString(aItem.localName.slice(7) + "Title");
     aWrapper.setAttribute("title", title);
   }
   
   // Remove attributes that screw up our appearance.
   aItem.removeAttribute("command");
   aItem.removeAttribute("observes");
   aItem.removeAttribute("disabled");
   aItem.removeAttribute("type");
@@ -604,16 +597,17 @@ function restoreDefaultSet()
   document.getElementById("modelist").value = "full";
 
   // Remove all of the customized toolbars.
   var child = gToolbox.lastChild;
   while (child) {
     if (child.hasAttribute("customindex")) {
       var thisChild = child;
       child = child.previousSibling;
+      thisChild.currentSet = "__empty";
       gToolbox.removeChild(thisChild);
     } else {
       child = child.previousSibling;
     }
   }
   
   // Now rebuild the palette.
   buildPalette();
@@ -809,37 +803,33 @@ var toolbarDNDObserver =
         return;
 
       // Don't allow static kids (e.g., the menubar) to move.
       if (wrapper.parentNode.firstPermanentChild && wrapper.parentNode.firstPermanentChild.id == wrapper.firstChild.id)
         return;
       if (wrapper.parentNode.lastPermanentChild && wrapper.parentNode.lastPermanentChild.id == wrapper.firstChild.id)
         return;
 
-      // Remove the item from it's place in the toolbar.
-      wrapper.parentNode.removeChild(wrapper);
-
       // Determine which toolbar we are dropping on.
       var dropToolbar = null;
       if (gCurrentDragOverItem.localName == "toolbar")
         dropToolbar = gCurrentDragOverItem;
       else
         dropToolbar = gCurrentDragOverItem.parentNode;
       
       // Insert the item into the toolbar.
       if (gCurrentDragOverItem != dropToolbar)
         dropToolbar.insertBefore(wrapper, gCurrentDragOverItem);
       else
         dropToolbar.appendChild(wrapper);
     } else {
       // The item has been dragged from the palette
       
       // Create a new wrapper for the item. We don't know the id yet.
-      var wrapper = createWrapper("");
-      gToolboxDocument.adoptNode(wrapper);
+      var wrapper = createWrapper("", gToolboxDocument);
 
       // Ask the toolbar to clone the item's template, place it inside the wrapper, and insert it in the toolbar.
       var newItem = toolbar.insertItem(draggedItemId, gCurrentDragOverItem == toolbar ? null : gCurrentDragOverItem, wrapper);
       
       // Prepare the item and wrapper to look good on the toolbar.
       cleanupItemForToolbar(newItem, wrapper);
       wrapper.id = "wrapper-"+newItem.id;
       wrapper.flex = newItem.flex;
@@ -922,37 +912,28 @@ var paletteDNDObserver =
     var wrapper = gToolboxDocument.getElementById("wrapper-"+itemId);
     if (wrapper) {
       // Don't allow static kids (e.g., the menubar) to move.
       if (wrapper.parentNode.firstPermanentChild && wrapper.parentNode.firstPermanentChild.id == wrapper.firstChild.id)
         return;
       if (wrapper.parentNode.lastPermanentChild && wrapper.parentNode.lastPermanentChild.id == wrapper.firstChild.id)
         return;
 
+      var wrapperType = wrapper.getAttribute("type");
+      if (wrapperType != "separator" &&
+        wrapperType != "spacer" &&
+        wrapperType != "spring") {
+        appendPaletteItem(document.importNode(wrapper.firstChild, true));
+      }
+
       // The item was dragged out of the toolbar.
+      gToolbox.palette.appendChild(wrapper.firstChild);
       wrapper.parentNode.removeChild(wrapper);
-      
-      var wrapperType = wrapper.getAttribute("type");
-      if (wrapperType != "separator" && wrapperType != "spacer" && wrapperType != "spring") {
-        // Find the template node in the toolbox palette
-        var templateNode = gToolbox.palette.firstChild;
-        while (templateNode) {
-          if (templateNode.id == itemId)
-            break;
-          templateNode = templateNode.nextSibling;
-        }
-        if (!templateNode)
-          return;
-        
-        // Clone the template and add it to our palette.
-        var paletteItem = templateNode.cloneNode(true);
-        appendPaletteItem(paletteItem);
-      }
     }
-    
+
     repositionDialog();
     gToolboxChanged = true;
   },
   
   _flavourSet: null,
   
   getSupportedFlavours: function ()
   {
new file mode 100644
--- /dev/null
+++ b/mail/base/content/extraCustomizeItems.xul
@@ -0,0 +1,187 @@
+<?xml version="1.0"?>
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is Mozilla Communicator client code, released
+# March 31, 1998.
+#
+# The Initial Developer of the Original Code is
+# Netscape Communications Corporation.
+# Portions created by the Initial Developer are Copyright (C) 1998-1999
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#   Karsten Düsterloh <mnyromyr@tprac.de>
+#   Simon Paquet <bugzilla@babylonsounds.com>
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+<!DOCTYPE overlay [
+  <!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
+  %globalDTD;
+  <!ENTITY % messengerDTD SYSTEM "chrome://messenger/locale/messenger.dtd">
+  %messengerDTD;
+  <!ENTITY % msgViewPickerDTD SYSTEM "chrome://messenger/locale/msgViewPickerOverlay.dtd" >
+  %msgViewPickerDTD;
+  <!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
+  %brandDTD;
+]>
+
+<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+  <toolbarpalette id="MailToolbarPalette">
+    <toolbaritem id="search-container" insertafter="button-stop"
+                 title="&searchItem.title;"
+                 align="center"
+                 class="chromeclass-toolbar-additional">
+      <textbox id="searchInput" timeout="800" flex="1"
+               onfocus="onSearchInputFocus(event);"
+               onclick="onSearchInputClick(event);"
+               onmousedown="onSearchInputMousedown(event);"
+               onblur="onSearchInputBlur(event);"
+               oncommand="onEnterInSearchBar();"
+               onkeypress="onSearchKeyPress();"
+               chromedir="&locale.dir;">
+        <button id="quick-search-button" type="menu" chromedir="&locale.dir;">
+          <menupopup id="quick-search-menupopup"
+                     value="2"
+                     persist="value"
+                     onpopupshowing="InitQuickSearchPopup();"
+                     popupalign="topleft"
+                     popupanchor="bottomleft">
+            <!-- The sequence of menu items must have a contiguous strictly
+                 increasing sequence of ordinals starting at 0 (see the
+                 VK_UP/VK_DOWN key handlers in search.xml) -->
+            <menuitem id="searchSubjectMenu"
+                      value="0"
+                      ordinal="0"
+                      label="&searchSubjectMenu.label;"
+                      type="radio"
+                      oncommand="changeQuickSearchMode(this)"/>
+            <menuitem id="searchFromMenu"
+                      value="1"
+                      ordinal="1"
+                      label="&searchFromMenu.label;"
+                      type="radio"
+                      oncommand="changeQuickSearchMode(this)" />
+            <menuitem id="searchSubjectOrFromMenu"
+                      value="2"
+                      ordinal="2"
+                      label="&searchSubjectOrFromMenu.label;"
+                      type="radio"
+                      oncommand="changeQuickSearchMode(this)"/>
+            <menuitem id="searchRecipient"
+                      value="5"
+                      ordinal="3"
+                      label="&searchRecipient.label;"
+                      type="radio"
+                      oncommand="changeQuickSearchMode(this)"/>
+            <menuitem id="searchSubjectOrRecipient"
+                      value="6"
+                      ordinal="4"
+                      label="&searchSubjectOrRecipientMenu.label;"
+                      type="radio"
+                      oncommand="changeQuickSearchMode(this)"/>
+            <menuitem id="searchMessageBody"
+                      value="3"
+                      ordinal="5"
+                      label="&searchMessageBody.label;"
+                      type="radio"
+                      oncommand="changeQuickSearchMode(this)"/>
+            <!-- The ordinal of that separator must be the biggest ordinal of a
+                 valid quicksearch option, plus one (see the VK_UP / VK_DOWN key
+                 handlers in search.xml). -->
+            <menuseparator id="quickSearchAfterLastOptionSeparator"
+                           ordinal="6"/>
+            <menuitem id="quickSearchSaveAsVirtualFolder"
+                      ordinal="99"
+                      label="&saveAsVirtualFolderMenu.label;"
+                      oncommand="saveViewAsVirtualFolder()"/>
+          </menupopup>
+        </button>
+      </textbox>
+    </toolbaritem>
+    <toolbarbutton id="button-compact" class="toolbarbutton-1"
+                   insertafter="button-mark"
+                   label="&compactButton.label;"
+                   tooltiptext="&compactButton.tooltip;"
+                   oncommand="goDoCommand('button_compact');"
+                   observes="button_compact"/>
+    <toolbaritem id="folder-location-container" insert-after="button-stop"
+                 title="&folderLocationToolbarItem.title;"
+                 align="center"
+                 class="chromeclass-toolbar-additional">
+      <!--XXX The src attribute is there to give the menulist icon horizontal
+          margin (bug 381364). Remove it once bug 381548 is fixed. -->
+      <menulist id="locationFolders"
+                class="folderMenuItem"
+                label=" "
+                src=""
+                context="folderPaneContext"
+                width="170"
+                crop="center">
+        <menupopup id="folderLocationPopup"
+                   class="folderLocationPopup"
+                   height="400"
+                   flex="1"
+                   oncommand="OnLocationTreeSelect(this);"/>
+      </menulist>
+    </toolbaritem>
+    <toolbaritem id="mailviews-container"
+                 title="&mailViewsToolbarItem.title;"
+                 align="center"
+                 class="chromeclass-toolbar-additional">
+      <label id="viewPickerLabel"
+             value="&viewPicker.label;"
+             control="viewPicker"
+             accesskey="&viewPicker.accesskey;"/>
+      <menulist id="viewPicker" oncommand="ViewChangeByMenuitem(event.target);">
+        <menupopup id="viewPickerPopup" onpopupshowing="RefreshViewPopup(this, false);">
+          <menuitem id="viewPickerAll" value="0" label="&viewAll.label;"/>
+          <menuitem id="viewPickerUnread" value="1" label="&viewUnread.label;"/>
+          <menuitem id="viewPickerNotDeleted" value="3" label="&viewNotDeleted.label;"/>
+          <menuseparator id="afterViewPickerUnreadSeparator"/>
+          <menu id="viewPickerTags" label="&viewTags.label;">
+            <menupopup id="viewPickerTagsPopup"
+                       class="menulist-menupopup"
+                       onpopupshowing="RefreshTagsPopup(this, true);"/>
+          </menu>
+          <menu id="viewPickerCustomViews" label="&viewCustomViews.label;">
+            <menupopup id="viewPickerCustomViewsPopup"
+                       class="menulist-menupopup"
+                       onpopupshowing="RefreshCustomViewsPopup(this, true);"/>
+          </menu>
+          <menuseparator id="afterViewPickerCustomViewsSeparator"/>
+          <menuitem id="viewPickerVirtualFolder"
+                    value="7"
+                    label="&viewVirtualFolder.label;"/>
+          <menuitem id="viewPickerCustomize"
+                    value="8"
+                    label="&viewCustomizeView.label;"/>
+        </menupopup>
+      </menulist>
+    </toolbaritem>
+
+  </toolbarpalette>
+</overlay>
--- a/mail/base/content/mailWindowOverlay.xul
+++ b/mail/base/content/mailWindowOverlay.xul
@@ -1660,21 +1660,16 @@
         <menuitem id="markFlaggedToolbarItem"
                   type="checkbox"
                   label="&markStarredCmd.label;"
                   accesskey="&markStarredCmd.accesskey;"
                   key="key_toggleFlagged"
                   command="cmd_markAsFlagged"/>
       </menupopup>
     </toolbarbutton>
-    <toolbarbutton id="button-compact" class="toolbarbutton-1"
-                   label="&compactButton.label;"
-                   tooltiptext="&compactButton.tooltip;"
-                   oncommand="goDoCommand('button_compact');"
-                   observes="button_compact"/>
     <toolbarbutton id="button-tag"
                    type="menu"
                    class="toolbarbutton-1"
                    label="&tagButton.label;"
                    tooltiptext="&tagButton.tooltip;"
                    command="cmd_tag">
       <menupopup id="button-tagpopup" onpopupshowing="InitMessageTags(this)">
         <menuitem id="button-tagRemoveAll" oncommand="RemoveAllMessageTags();"/>
@@ -1697,141 +1692,16 @@
                  pack="center">
       <button id="navigator-throbber" disabled="true"/>
     </toolbaritem>
     <toolbarbutton id="button-stop"
                    class="toolbarbutton-1"
                    label="&stopButton.label;"
                    tooltiptext="&stopButton.tooltip;"
                    command="cmd_stop"/>
-    <toolbaritem id="search-container"
-                 title="&searchItem.title;"
-                 align="center"
-                 class="chromeclass-toolbar-additional">
-      <textbox id="searchInput" timeout="800" flex="1"
-               onfocus="onSearchInputFocus(event);"
-               onclick="onSearchInputClick(event);"
-               onmousedown="onSearchInputMousedown(event);"
-               onblur="onSearchInputBlur(event);"
-               oncommand="onEnterInSearchBar();"
-               onkeypress="onSearchKeyPress();"
-               chromedir="&locale.dir;">
-        <button id="quick-search-button" type="menu" chromedir="&locale.dir;">
-          <menupopup id="quick-search-menupopup"
-                     value="2"
-                     persist="value"
-                     onpopupshowing="InitQuickSearchPopup();"
-                     popupalign="topleft"
-                     popupanchor="bottomleft">
-            <!-- The sequence of menu items must have a contiguous strictly
-                 increasing sequence of ordinals starting at 0 (see the
-                 VK_UP/VK_DOWN key handlers in search.xml) -->
-            <menuitem id="searchSubjectMenu"
-                      value="0"
-                      ordinal="0"
-                      label="&searchSubjectMenu.label;"
-                      type="radio"
-                      oncommand="changeQuickSearchMode(this)"/>
-            <menuitem id="searchFromMenu"
-                      value="1"
-                      ordinal="1"
-                      label="&searchFromMenu.label;"
-                      type="radio"
-                      oncommand="changeQuickSearchMode(this)" />
-            <menuitem id="searchSubjectOrFromMenu"
-                      value="2"
-                      ordinal="2"
-                      label="&searchSubjectOrFromMenu.label;"
-                      type="radio"
-                      oncommand="changeQuickSearchMode(this)"/>
-            <menuitem id="searchRecipient"
-                      value="5"
-                      ordinal="3"
-                      label="&searchRecipient.label;"
-                      type="radio"
-                      oncommand="changeQuickSearchMode(this)"/>
-            <menuitem id="searchSubjectOrRecipient"
-                      value="6"
-                      ordinal="4"
-                      label="&searchSubjectOrRecipientMenu.label;"
-                      type="radio"
-                      oncommand="changeQuickSearchMode(this)"/>
-            <menuitem id="searchMessageBody"
-                      value="3"
-                      ordinal="5"
-                      label="&searchMessageBody.label;"
-                      type="radio"
-                      oncommand="changeQuickSearchMode(this)"/>
-            <!-- The ordinal of that separator must be the biggest ordinal of a
-                 valid quicksearch option, plus one (see the VK_UP / VK_DOWN key
-                 handlers in search.xml). -->
-            <menuseparator id="quickSearchAfterLastOptionSeparator"
-                           ordinal="6"/>
-            <menuitem id="quickSearchSaveAsVirtualFolder"
-                      ordinal="99"
-                      label="&saveAsVirtualFolderMenu.label;"
-                      oncommand="saveViewAsVirtualFolder()"/>
-          </menupopup>
-        </button>
-      </textbox>
-    </toolbaritem>
-    <toolbaritem id="folder-location-container"
-                 title="&folderLocationToolbarItem.title;"
-                 align="center"
-                 class="chromeclass-toolbar-additional">
-      <!--XXX The src attribute is there to give the menulist icon horizontal
-          margin (bug 381364). Remove it once bug 381548 is fixed. -->
-      <menulist id="locationFolders"
-                class="folderMenuItem"
-                label=" "
-                src=""
-                context="folderPaneContext"
-                width="170"
-                crop="center">
-        <menupopup id="folderLocationPopup"
-                   class="folderLocationPopup"
-                   height="400"
-                   flex="1"
-                   oncommand="OnLocationTreeSelect(this);"/>
-      </menulist>
-    </toolbaritem>
-    <toolbaritem id="mailviews-container"
-                 title="&mailViewsToolbarItem.title;"
-                 align="center"
-                 class="chromeclass-toolbar-additional">
-      <label id="viewPickerLabel"
-             value="&viewPicker.label;"
-             control="viewPicker"
-             accesskey="&viewPicker.accesskey;"/>
-      <menulist id="viewPicker" oncommand="ViewChangeByMenuitem(event.target);">
-        <menupopup id="viewPickerPopup" onpopupshowing="RefreshViewPopup(this, false);">
-          <menuitem id="viewPickerAll" value="0" label="&viewAll.label;"/>
-          <menuitem id="viewPickerUnread" value="1" label="&viewUnread.label;"/>
-          <menuitem id="viewPickerNotDeleted" value="3" label="&viewNotDeleted.label;"/>
-          <menuseparator id="afterViewPickerUnreadSeparator"/>
-          <menu id="viewPickerTags" label="&viewTags.label;">
-            <menupopup id="viewPickerTagsPopup"
-                       class="menulist-menupopup"
-                       onpopupshowing="RefreshTagsPopup(this, true);"/>
-          </menu>
-          <menu id="viewPickerCustomViews" label="&viewCustomViews.label;">
-            <menupopup id="viewPickerCustomViewsPopup"
-                       class="menulist-menupopup"
-                       onpopupshowing="RefreshCustomViewsPopup(this, true);"/>
-          </menu>
-          <menuseparator id="afterViewPickerCustomViewsSeparator"/>
-          <menuitem id="viewPickerVirtualFolder"
-                    value="7"
-                    label="&viewVirtualFolder.label;"/>
-          <menuitem id="viewPickerCustomize"
-                    value="8"
-                    label="&viewCustomizeView.label;"/>
-        </menupopup>
-      </menulist>
-    </toolbaritem>
   </toolbarpalette>
 
   <!-- If changes are made to the default set of toolbar buttons, you may need to rev the id
        of mail-bar in order to force the new default items to show up for users who customized their toolbar
        in earlier versions. Bumping the id means users will have to re-customize their toolbar!
   -->
   <toolbar id="mail-bar2" class="toolbar-primary chromeclass-toolbar"
            toolbarname="&showMessengerToolbarCmd.label;"
--- a/mail/base/content/messageWindow.js
+++ b/mail/base/content/messageWindow.js
@@ -246,17 +246,16 @@ function IsCurrentLoadedFolder(folder)
 function OnLoadMessageWindow()
 {
   setTimeout(delayedOnLoadMessageWindow, 0); // when debugging, set this to 5000, so you can see what happens after the window comes up.
 }
 
 function delayedOnLoadMessageWindow()
 {
   HideMenus();
-  HideToolbarButtons();
   ShowMenus();
   MailOfflineMgr.init();
   CreateMailWindowGlobals();
   verifyAccounts(null);
 
   InitMsgWindow();
 
   messenger.setWindow(window, msgWindow);
@@ -424,44 +423,16 @@ function extractMsgKeyFromURI()
 
 function ShowMenus()
 {
   var openMail3Pane_menuitem = document.getElementById('tasksMenuMail');
   if (openMail3Pane_menuitem)
     openMail3Pane_menuitem.removeAttribute("hidden");
 }
 
-// Toolbar buttons like quick search and mail views should be hidden for the message window
-function HideToolbarButtons()
-{
-  var mailToolbar = document.getElementById('mail-bar2');
-  if (mailToolbar)
-  {
-    // the quick search box is part of the default toolbar set for the 3-pane and since it is shared code,
-    // the stand alone message window. We need to remove the search-container from the defaultset,
-    // remove the toolbar button itself from the DOM because we've already created it.
-    var defaultSet = mailToolbar.getAttribute("defaultset");
-    defaultSet = defaultSet.replace(/search-container/i, "");
-    mailToolbar.setAttribute('defaultset', defaultSet);
-
-    var searchContainer = document.getElementById('search-container');
-    if (searchContainer)
-      searchContainer.parentNode.removeChild(searchContainer);
-
-    // now hack the toolbar palette to remove all of the toolbar items which don't
-    // make sense for the stand alone message window. This prevents them from showing up in the
-    // customize dialog.
-    var toolbarPalette = document.getElementById('mail-toolbox').palette;
-    toolbarPalette.removeChild(toolbarPalette.getElementsByAttribute('id', 'search-container')[0]);
-    toolbarPalette.removeChild(toolbarPalette.getElementsByAttribute('id', 'mailviews-container')[0]);
-    toolbarPalette.removeChild(toolbarPalette.getElementsByAttribute('id', 'folder-location-container')[0]);
-    toolbarPalette.removeChild(toolbarPalette.getElementsByAttribute('id', 'button-compact')[0]);
-  }
-}
-
 function HideMenus()
 {
   var message_menuitem=document.getElementById('menu_showMessage');
   if (message_menuitem)
     message_menuitem.setAttribute("hidden", "true");
 
   var showSearch_showMessage_Separator = document.getElementById('menu_showSearch_showMessage_Separator');
   if (showSearch_showMessage_Separator)
--- a/mail/base/content/messenger.xul
+++ b/mail/base/content/messenger.xul
@@ -38,16 +38,17 @@
 #
 # ***** END LICENSE BLOCK *****
 
 <?xml-stylesheet href="chrome://messenger/skin/mailWindow1.css" type="text/css"?>
 
 <?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>
 <?xul-overlay href="chrome://messenger/content/msgHdrViewOverlay.xul"?>
 <?xul-overlay href="chrome://messenger/content/mailWindowOverlay.xul"?>
+<?xul-overlay href="chrome://messenger/content/extraCustomizeItems.xul"?>
 <?xul-overlay href="chrome://messenger/content/mailOverlay.xul"?>
 <?xul-overlay href="chrome://messenger/content/editContactOverlay.xul"?>
 
 <!DOCTYPE window [
 <!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
 %brandDTD;
 <!ENTITY % messengerDTD SYSTEM "chrome://messenger/locale/messenger.dtd" >
 %messengerDTD;
--- a/mail/base/jar.mn
+++ b/mail/base/jar.mn
@@ -2,16 +2,17 @@ messenger.jar:
 % content messagebody %content/messagebody/ contentaccessible=yes
 % content messenger %content/messenger/ xpcnativewrappers=yes
 % override chrome://messagebody/skin/messageBody.css chrome://messenger/skin/messageBody.css
 % overlay chrome://global/content/viewSource.xul chrome://messenger/content/viewSourceOverlay.xul
 % overlay chrome://global/content/config.xul chrome://messenger/content/configEditorOverlay.xul
 *   content/messenger/mailWindow.js                 (content/mailWindow.js)
 *   content/messenger/mailWindowOverlay.js          (content/mailWindowOverlay.js)
 *   content/messenger/mailWindowOverlay.xul         (content/mailWindowOverlay.xul)
+*   content/messenger/extraCustomizeItems.xul       (content/extraCustomizeItems.xul)
 *   content/messenger/mailOverlay.xul               (content/mailOverlay.xul)
 *   content/messenger/messageWindow.xul             (content/messageWindow.xul)
 *   content/messenger/messageWindow.js              (content/messageWindow.js)
 *   content/messenger/mailContextMenus.js           (content/mailContextMenus.js)
 *   content/messenger/messenger.xul                 (content/messenger.xul)
 *   content/messenger/hiddenWindow.xul              (content/hiddenWindow.xul)
 *   content/messenger/hiddenWindow.js               (content/hiddenWindow.js)
 *   content/messenger/msgHdrViewOverlay.js          (content/msgHdrViewOverlay.js)