Bug 1599301 - Switch mail window to use type="folder" instead of rdf templates. r=frg
authorIan Neal <iann_cvs@blueyonder.co.uk>
Sat, 11 Jan 2020 00:39:26 +0100
changeset 37931 20be22b77f869cd88648410880855dd2fe3f98b5
parent 37930 2b181852252306b7d6519c6e5c8f6ca5d63c4826
child 37932 4acbeec199dce57b440be070cf441deff35ab258
push id398
push userclokep@gmail.com
push dateMon, 09 Mar 2020 19:10:28 +0000
reviewersfrg
bugs1599301
Bug 1599301 - Switch mail window to use type="folder" instead of rdf templates. r=frg
suite/locales/en-US/chrome/mailnews/messenger.dtd
suite/mailnews/content/folderPane.xul
suite/mailnews/content/mailWidgets.xml
suite/mailnews/content/mailWindow.js
suite/mailnews/content/mailWindowOverlay.js
suite/mailnews/content/mailWindowOverlay.xul
suite/mailnews/content/messageWindow.js
suite/mailnews/content/messenger.css
suite/mailnews/content/msgMail3PaneWindow.js
--- a/suite/locales/en-US/chrome/mailnews/messenger.dtd
+++ b/suite/locales/en-US/chrome/mailnews/messenger.dtd
@@ -267,16 +267,18 @@
 <!ENTITY goBackCmd.label "Back">
 <!ENTITY goBackCmd.accesskey "B">
 <!ENTITY goBackCmd.commandKey "[">
 <!ENTITY goForwardCmd.label "Forward">
 <!ENTITY goForwardCmd.accesskey "F">
 <!ENTITY goForwardCmd.commandKey "]">
 <!ENTITY prevFlaggedMsgCmd.label "Flagged Message">
 <!ENTITY prevFlaggedMsgCmd.accesskey "F">
+<!ENTITY folderMenu.label "Folder">
+<!ENTITY folderMenu.accesskey "o">
 <!ENTITY startPageCmd.label "Mail Start Page">
 <!ENTITY startPageCmd.accesskey "S">
 
 <!-- Message Menu -->
 <!ENTITY msgMenu.label "Message">
 <!ENTITY msgMenu.accesskey "M">
 <!ENTITY newMsgCmd.label "New Message">
 <!ENTITY newMsgCmd.accesskey "N">
--- a/suite/mailnews/content/folderPane.xul
+++ b/suite/mailnews/content/folderPane.xul
@@ -146,18 +146,22 @@
                  context="folderPaneContext"
                  class="toolbaritem-noline chromeclass-toolbar-additional">
       <image id="locationIcon" class="folderMenuItem"/>
       <menulist id="locationFolders"
                 class="folderMenuItem"
                 label=" "
                 crop="center">
         <menupopup id="folderLocationPopup"
-                   height="400"
-                   oncommand="OnLocationTreeSelect(this);"/>
+                   class="menulist-menupopup"
+                   type="folder"
+                   flex="1"
+                   mode="notDeferred"
+                   showFileHereLabel="true"
+                   oncommand="SelectFolder(event.target.id);"/>
       </menulist>
     </toolbaritem>
     <toolbaritem id="mailviews-container"
                  title="&mailViewsToolbarItem.title;"
                  observes="mailDisableViewsSearch"
                  align="center"
                  class="toolbaritem-noline chromeclass-toolbar-additional">
       <label id="viewPickerLabel"
--- a/suite/mailnews/content/mailWidgets.xml
+++ b/suite/mailnews/content/mailWidgets.xml
@@ -1578,230 +1578,16 @@
       </constructor>
     </implementation>
     <handlers>
       <handler event="keypress" keycode="VK_RETURN" modifiers="accel any"
                action="onEnterInSearchTerm(event);" preventdefault="true"/>
     </handlers>
   </binding>
 
-  <!-- Folder picker helper widget -->
-  <binding id="locationpopup" extends="chrome://global/content/bindings/popup.xml#popup">
-    <xbl:content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-      <tree class="foldersTree"
-            treelines="true"
-            flex="1"
-            datasources="rdf:null"
-            flags="dont-build-content"
-            seltype="text"
-            hidecolumnpicker="true">
-        <treecols>
-          <treecol flex="1" primary="true" sort="rdf:http://home.netscape.com/NC-rdf#FolderTreeName?sort=true" sortActive="true" sortDirection="ascending" crop="center" hideheader="true"/>
-        </treecols>
-        <treechildren class="foldersTreeChildren"/>
-        <template>
-          <rule nc:IsDeferred="false">
-            <treechildren>
-              <treeitem uri="rdf:*">
-                <treerow sort="rdf:http://home.netscape.com/NC-rdf#FolderTreeName?sort=true">
-                  <treecell label="rdf:http://home.netscape.com/NC-rdf#FolderTreeName"
-                    properties="folderNameCol specialFolder-rdf:http://home.netscape.com/NC-rdf#SpecialFolder biffState-rdf:http://home.netscape.com/NC-rdf#BiffState isServer-rdf:http://home.netscape.com/NC-rdf#IsServer newMessages-rdf:http://home.netscape.com/NC-rdf#NewMessages hasUnreadMessages-rdf:http://home.netscape.com/NC-rdf#HasUnreadMessages isSecure-rdf:http://home.netscape.com/NC-rdf#IsSecure serverType-rdf:http://home.netscape.com/NC-rdf#ServerType noSelect-rdf:http://home.netscape.com/NC-rdf#NoSelect"/>
-                </treerow>
-              </treeitem>
-            </treechildren>
-          </rule>
-        </template>
-      </tree>
-    </xbl:content>
-    <implementation>
-      <field name="tree" readonly="true">
-        document.getAnonymousNodes(this)[0];
-      </field>
-      <method name="updateHover">
-        <parameter name="event"/>
-        <body>
-          <![CDATA[
-            var box = this.tree.treeBoxObject;
-            if (event.originalTarget == box.treeBody) {
-              var index = box.getRowAt(event.clientX, event.clientY);
-              this.tree.view.selection.select(index);
-              return index;
-            }
-            return -1;
-          ]]>
-        </body>
-      </method>
-      <method name="fire">
-        <body>
-          <![CDATA[
-            this.hidePopup();
-            if (this.tree.currentIndex >= 0) {
-              this.setAttribute("uri", this.tree.builderView.getResourceAtIndex(this.tree.currentIndex).Value);
-              this.doCommand();
-            }
-          ]]>
-        </body>
-      </method>
-      <method name="onBlurMenuList">
-        <parameter name="event"/>
-        <body>
-          <![CDATA[
-            this.openMenu(false);
-          ]]>
-        </body>
-      </method>
-      <field name="onKeyPressMenuList" readonly="true">
-        <![CDATA[
-          ({
-            self: this,
-            tree: this.tree,
-            parentNode: this.parentNode,
-            getLastVisibleRow: function getLastVisibleRow(box) {
-              var f = box.getFirstVisibleRow();
-              var p = box.getPageLength();
-              var l = box.view.rowCount;
-              return (l < f + p ? l : f + p) - 1;
-            },
-            handleEvent: function handleEvent(event) {
-              if (event.altKey)
-                return;
-              var index;
-              var box = this.tree.treeBoxObject;
-              if (this.parentNode.hasAttribute("open")) {
-                event.stopPropagation();
-                event.preventDefault();
-                switch (event.keyCode) {
-                  case event.DOM_VK_ESCAPE:
-                    this.self.hidePopup();
-                    return;
-                  case event.DOM_VK_RETURN:
-                    this.self.fire();
-                    return;
-                }
-                index = this.tree.currentIndex;
-              } else {
-                switch (event.keyCode) {
-                  case event.DOM_VK_PAGE_UP:
-                  case event.DOM_VK_PAGE_DOWN:
-                    return;
-                }
-                index = this.self.setInitialSelection();
-              }
-              switch (event.keyCode) {
-                case event.DOM_VK_UP:
-                  if (index <= 0)
-                    return;
-                  index--;
-                  break;
-                case event.DOM_VK_DOWN:
-                  index++;
-                  if (index == box.view.rowCount)
-                    return;
-                  break;
-                case event.DOM_VK_PAGE_UP:
-                  if (index == box.getFirstVisibleRow())
-                    box.scrollByPages(-1);
-                  index = box.getFirstVisibleRow();
-                  break;
-                case event.DOM_VK_PAGE_DOWN:
-                  if (index == this.getLastVisibleRow(box))
-                    box.scrollByPages(1);
-                  index = this.getLastVisibleRow(box);
-                  break;
-                case event.DOM_VK_HOME:
-                  index = 0;
-                  break;
-                case event.DOM_VK_END:
-                  index = box.view.rowCount - 1;
-                  break;
-                default:
-                  if (event.charCode > 0 && !event.ctrlKey && !event.metaKey) {
-                    event.preventDefault();
-                    index = tree.keyNavigate(event);
-                    if (index >= 0)
-                      break;
-                  }
-                  return;
-              }
-              box.view.selection.select(index);
-              if (this.parentNode.hasAttribute("open"))
-                box.ensureRowIsVisible(index);
-              else
-                this.self.fire();
-            }
-          })
-        ]]>
-      </field>
-      <method name="setInitialSelection">
-        <body>
-          <![CDATA[
-            var view = this.tree.view;
-
-            view.selection.currentColumn = this.tree.columns.getFirstColumn();
-
-            view.selection.selectEventsSuppressed = true;
-            for (var i = 0; i < view.rowCount; i++) {
-              if (view.isContainer(i)) {
-                if (view.isContainerEmpty(i) == view.isContainerOpen(i))
-                  view.toggleOpenState(i);
-                if (view.isContainerOpen(i)) {
-                  if (i + 1 == view.rowCount ||
-                      view.getLevel(i + 1) <= view.getLevel(i)) {
-                    view.toggleOpenState(i);
-                  }
-                }
-              }
-            }
-            var index = -1;
-            var uri = this.parentNode.getAttribute("uri");
-            if (uri) {
-              var RDF = Cc["@mozilla.org/rdf/rdf-service;1"].getService(Ci.nsIRDFService);
-              index = view.getIndexOfResource(RDF.GetResource(uri));
-            }
-            view.selection.select(index);
-            return index;
-          ]]>
-        </body>
-      </method>
-      <constructor>
-        <![CDATA[
-          this.setAttribute("ignorekeys", "true");
-          this.parentNode.addEventListener("keypress", this.onKeyPressMenuList, true);
-        ]]>
-      </constructor>
-      <destructor>
-        <![CDATA[
-          this.parentNode.removeEventListener("keypress", this.onKeyPressMenuList, true);
-        ]]>
-      </destructor>
-    </implementation>
-    <handlers>
-      <handler event="mousemove" action="this.updateHover(event);"/>
-      <handler event="click" button="0" action="if (this.updateHover(event) >= 0) this.fire();"/>
-      <handler event="popupshowing">
-        <![CDATA[
-          this.parentNode.addEventListener("blur", this.onBlurMenuList);
-          var box = this.tree.treeBoxObject;
-          box.focused = true;
-          var index = this.setInitialSelection();
-          var height = box.view.rowCount * box.rowHeight;
-          height += this.boxObject.height - box.treeBody.boxObject.height;
-          this.height = height;
-          if (index >= 0)
-            setTimeout(function() { box.ensureRowIsVisible(index); }, 0);
-        ]]>
-      </handler>
-      <handler event="popuphiding">
-        <![CDATA[
-          this.parentNode.removeEventListener("blur", this.onBlurMenuList);
-        ]]>
-      </handler>
-    </handlers>
-  </binding>
-
   <binding id="folderSummary-popup" extends="chrome://global/content/bindings/popup.xml#tooltip">
     <content>
       <children>
         <xul:folderSummary/>
       </children>
     </content>
     <handlers>
       <handler event="popupshowing">
--- a/suite/mailnews/content/mailWindow.js
+++ b/suite/mailnews/content/mailWindow.js
@@ -331,36 +331,16 @@ function messagePaneOnClick(event)
   event.preventDefault();
   if (isPhishingURL(ceParams.linkNode, false, href))
     return false;
 
   openAsExternal(href);
   return true;
 }
 
-function AddDataSources()
-{
-  SetupMoveCopyMenus('moveMenu', accountManagerDataSource, folderDataSource);
-  SetupMoveCopyMenus('copyMenu', accountManagerDataSource, folderDataSource);
-  SetupMoveCopyMenus('button-file', accountManagerDataSource, folderDataSource);
-  SetupMoveCopyMenus('mailContext-copyMenu', accountManagerDataSource, folderDataSource);
-  SetupMoveCopyMenus('mailContext-moveMenu', accountManagerDataSource, folderDataSource);
-}
-
-function SetupMoveCopyMenus(menuid, accountManagerDataSource, folderDataSource)
-{
-  var menu = document.getElementById(menuid);
-  if (menu)
-  {
-    menu.database.AddDataSource(accountManagerDataSource);
-    menu.database.AddDataSource(folderDataSource);
-    menu.setAttribute('ref', 'msgaccounts:/');
-  }
-}
-
 // We're going to implement our status feedback for the mail window in JS now.
 // the following contains the implementation of our status feedback object
 
 function nsMsgStatusFeedback()
 {
 }
 
 nsMsgStatusFeedback.prototype =
--- a/suite/mailnews/content/mailWindowOverlay.js
+++ b/suite/mailnews/content/mailWindowOverlay.js
@@ -93,17 +93,17 @@ function InitEditMessagesMenu()
   goSetMenuValue('cmd_delete', 'valueDefault');
   goSetAccessKey('cmd_delete', 'valueDefaultAccessKey');
   document.commandDispatcher.updateCommands('create-menu-edit');
 }
 
 function InitGoMessagesMenu()
 {
   // deactivate the folders in the go menu if we don't have a folderpane
-  document.getElementById("mailFolderPane")
+  document.getElementById("goFolderMenu")
           .setAttribute("disabled", IsFolderPaneCollapsed());
   document.commandDispatcher.updateCommands('create-menu-go');
 }
 
 function view_init()
 {
   if (!gMessengerBundle)
     gMessengerBundle = document.getElementById("bundle_messenger");
@@ -952,51 +952,39 @@ function MsgDeleteMessage(aReallyDelete)
 
   // execute deleteNoTrash only if IMAP delete model is not used
   if (aReallyDelete && !imapDeleteModelUsed)
     gDBView.doCommand(nsMsgViewCommandType.deleteNoTrash);
   else
     gDBView.doCommand(nsMsgViewCommandType.deleteMsg);
 }
 
-function MsgCopyMessage(destFolder)
-{
-  try {
-    // get the msg folder we're copying messages into
-    var destUri = destFolder.getAttribute('id');
-    let destMsgFolder = GetMsgFolderFromUri(destUri);
-    if (gMessageDisplay.isDummy)
-    {
-      let file = window.arguments[0].QueryInterface(Ci.nsIFileURL).file;
-      MailServices.copy.CopyFileMessage(file, destMsgFolder, null, false,
-                                        Ci.nsMsgMessageFlags.Read,
-                                        "", null, msgWindow);
-    }
-    else
-    {
-      gDBView.doCommandWithFolder(nsMsgViewCommandType.copyMessages, destMsgFolder);
-    }
+/**
+ * Copies the selected messages to the destination folder
+ * @param aDestFolder  the destination folder
+ */
+function MsgCopyMessage(aDestFolder) {
+  if (gMessageDisplay.isDummy) {
+    let file = window.arguments[0].QueryInterface(Ci.nsIFileURL).file;
+    MailServices.copy.CopyFileMessage(file, aDestFolder, null, false,
+                                      Ci.nsMsgMessageFlags.Read,
+                                      "", null, msgWindow);
   }
-  catch (ex) {
-    dump("MsgCopyMessage failed: " + ex + "\n");
+  else {
+    gDBView.doCommandWithFolder(nsMsgViewCommandType.copyMessages, aDestFolder);
   }
 }
 
-function MsgMoveMessage(destFolder)
-{
-  try {
-    // get the msg folder we're moving messages into
-    var destUri = destFolder.getAttribute('id');
-    let destMsgFolder = GetMsgFolderFromUri(destUri);
-    SetNextMessageAfterDelete();
-    gDBView.doCommandWithFolder(nsMsgViewCommandType.moveMessages, destMsgFolder);
-  }
-  catch (ex) {
-    dump("MsgMoveMessage failed: " + ex + "\n");
-  }
+/**
+ * Moves the selected messages to the destination folder
+ * @param aDestFolder  the destination folder
+ */
+function MsgMoveMessage(aDestFolder) {
+  SetNextMessageAfterDelete();
+  gDBView.doCommandWithFolder(nsMsgViewCommandType.moveMessages, aDestFolder);
 }
 
 /**
  * Calls the ComposeMessage function with the desired type and proper default
  * based on the event that fired it.
  *
  * @param aCompType  The nsIMsgCompType to pass to the function.
  * @param aEvent (optional) The event that triggered the call.
@@ -2972,19 +2960,14 @@ function getMailToolbox()
 function MailToolboxCustomizeInit()
 {
   toolboxCustomizeInit("mail-menubar");
 }
 
 function MailToolboxCustomizeDone(aToolboxChanged)
 {
   toolboxCustomizeDone("mail-menubar", getMailToolbox(), aToolboxChanged);
-  SetupMoveCopyMenus('button-file', accountManagerDataSource, folderDataSource);
-
-  // make sure the folder location picker is initialized, if it exists
-  if ("OnLoadLocationTree" in window)
-    OnLoadLocationTree();
 }
 
 function MailToolboxCustomizeChange(event)
 {
   toolboxCustomizeChange(getMailToolbox(), event);
 }
--- a/suite/mailnews/content/mailWindowOverlay.xul
+++ b/suite/mailnews/content/mailWindowOverlay.xul
@@ -52,21 +52,16 @@
 <stringbundleset id="stringbundleset">
   <stringbundle id="bundle_messenger" src="chrome://messenger/locale/messenger.properties"/>
   <stringbundle id="bundle_offlinePrompts" src="chrome://messenger/locale/offline.properties"/>
   <stringbundle id="bundle_viewZoom"/>
   <stringbundle id="bundle_viewApplyTheme"/>
   <stringbundle id="findBundle" src="chrome://global/locale/finddialog.properties"/>
 </stringbundleset>
 
-<broadcasterset id="mailBroadcasters">
-  <!-- Go Menu -->
-  <broadcaster id="mailFolderPane"/>
-</broadcasterset>
-
 <!-- Performance optimization...we include utilityOverlay.xul which defines some command sets
      which are updated based on events like focus and select. We have our own custom events
      which we use to optmize when we do command updating. To avoid unnecessary command updating,
      we are going to override the events the global edit menu items and select edit menu items
      are updated on with events of our own controlling.
  -->
 
 <commandset id="globalEditMenuItems"
@@ -619,197 +614,36 @@
               oncommand="CopyMessageUrl()"/>
     <menuitem id="mailContext-archive"
               label="&contextArchive.label;"
               accesskey="&contextArchive.accesskey;"
               oncommand="MsgArchiveSelectedMessages(event);"/>
     <menu id="mailContext-moveMenu"
           label="&contextMoveMsgMenu.label;"
           accesskey="&contextMoveMsgMenu.accesskey;"
-          sortResource="http://home.netscape.com/NC-rdf#FolderTreeName"
-          sortDirection="ascending"
-          datasources="rdf:null">
-      <menupopup id="mailContext-fileHereMenu">
-        <menu label="&contextMoveCopyMsgRecentMenu.label;"
-              accesskey="&contextMoveCopyMsgRecentMenu.accesskey;"
-              sortResource="http://home.netscape.com/NC-rdf#FolderTreeName"
-              sortDirection="ascending"
-              datasources="rdf:mailnewsrecentfolders"
-              ref="mailnewsrecentfolders:/">
-          <menupopup/>
-          <template>
-            <rule nc:CanFileMessages="true">
-              <menupopup>
-                <menuitem uri="..." class="folderMenuItem menuitem-iconic"
-                          label="rdf:http://home.netscape.com/NC-rdf#FolderTreeSimpleName"
-                          oncommand="MsgMoveMessage(event.target);"
-                          SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-                          BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-                          IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-                          IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-                          ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"/>
-              </menupopup>
-            </rule>
-          </template>
-        </menu>
-        <menuseparator/>
-      </menupopup>
-      <template>
-      <rule nc:NoSelect="true" iscontainer="true" isempty="false">
-          <menupopup>
-            <menu uri="..."  class="folderMenuItem menu-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name">
-              <menupopup>
-                <menuitem label="&fileHereMenu.label;" accesskey="&fileHereMenu.accesskey;" disabled="true"/>
-                <menuseparator/>
-              </menupopup>
-            </menu>
-          </menupopup>
-        </rule>
-        <rule nc:NoSelect="true">
-          <menupopup>
-            <menuitem uri="..."  class="folderMenuItem menu-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name" disabled="true"/>
-          </menupopup>
-        </rule>
-        <rule nc:CanFileMessages="true" iscontainer="true" isempty="false">
-          <menupopup>
-            <menu uri="..."  class="folderMenuItem menu-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name"
-              SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-              BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-              IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-              IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-              ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
-              <menupopup>
-                <menuitem label="&fileHereMenu.label;" accesskey="&fileHereMenu.accesskey;"
-                  oncommand="MsgMoveMessage(event.target.parentNode.parentNode)"/>
-                <menuseparator/>
-              </menupopup>
-            </menu>
-          </menupopup>
-        </rule>
-        <rule nc:CanFileMessagesOnServer="false">
-          <!-- don't show servers (nntp & any others) which does not allow message filing -->
-          <!-- File, Move & Copy menus -->
-        </rule>
-        <rule nc:CanFileMessages="false" iscontainer="true" isempty="false">
-          <!-- note, there is no "file here" -->
-          <menupopup>
-            <menu uri="..."  class="folderMenuItem menu-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name"
-                  SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-                  BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-                  IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-                  IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-                  ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
-              <menupopup/>
-            </menu>
-          </menupopup>
-        </rule>
-        <rule nc:CanFileMessages="true">
-          <menupopup>
-            <menuitem uri="..." class="folderMenuItem menuitem-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name" oncommand="MsgMoveMessage(event.target)"
-              SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-              BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-              IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-              IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-              ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"/>
-          </menupopup>
-        </rule>
-      </template>
+          oncommand="MsgMoveMessage(event.target._folder);">
+      <menupopup id="mailContext-fileHereMenu"
+                 type="folder"
+                 mode="filing"
+                 showFileHereLabel="true"
+                 showRecent="true"
+                 recentLabel="&contextMoveCopyMsgRecentMenu.label;"
+                 recentAccessKey="&contextMoveCopyMsgRecentMenu.accesskey;"/>
     </menu>
     <menu id="mailContext-copyMenu"
           label="&contextCopyMsgMenu.label;"
           accesskey="&contextCopyMsgMenu.accesskey;"
-          sortResource="http://home.netscape.com/NC-rdf#FolderTreeName"
-          sortDirection="ascending"
-          datasources="rdf:null">
-      <menupopup id="mailContext-copyHereMenu">
-        <menu label="&contextMoveCopyMsgRecentMenu.label;"
-              accesskey="&contextMoveCopyMsgRecentMenu.accesskey;"
-              sortResource="http://home.netscape.com/NC-rdf#FolderTreeName"
-              sortDirection="ascending"
-              datasources="rdf:mailnewsrecentfolders"
-              ref="mailnewsrecentfolders:/">
-          <menupopup/>
-          <template>
-            <rule nc:CanFileMessages="true">
-              <menupopup>
-                <menuitem uri="..." class="folderMenuItem menuitem-iconic"
-                          label="rdf:http://home.netscape.com/NC-rdf#FolderTreeSimpleName"
-                          oncommand="MsgCopyMessage(event.target);"
-                          SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-                          BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-                          IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-                          IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-                          ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"/>
-              </menupopup>
-            </rule>
-          </template>
-        </menu>
-        <menuseparator/>
-      </menupopup>
-      <template>
-      <rule nc:NoSelect="true" iscontainer="true" isempty="false">
-          <menupopup>
-            <menu uri="..."  class="folderMenuItem menu-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name">
-              <menupopup>
-                <menuitem label="&copyHereMenu.label;" accesskey="&copyHereMenu.accesskey;" disabled="true"/>
-                <menuseparator/>
-              </menupopup>
-            </menu>
-          </menupopup>
-        </rule>
-        <rule nc:NoSelect="true">
-          <menupopup>
-            <menuitem uri="..."  class="folderMenuItem menu-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name" disabled="true"/>
-          </menupopup>
-        </rule>
-        <rule nc:CanFileMessages="true" iscontainer="true" isempty="false">
-          <menupopup>
-            <menu uri="..."  class="folderMenuItem menu-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name"
-              SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-              BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-              IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-              IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-              ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
-              <menupopup>
-                <menuitem label="&copyHereMenu.label;" accesskey="&copyHereMenu.accesskey;"
-                  oncommand="MsgCopyMessage(event.target.parentNode.parentNode)"/>
-                <menuseparator/>
-              </menupopup>
-            </menu>
-          </menupopup>
-        </rule>
-        <rule nc:CanFileMessagesOnServer="false">
-          <!-- don't show servers (nntp & any others) which does not allow message filing -->
-          <!-- File, Move & Copy menus -->
-        </rule>
-        <rule nc:CanFileMessages="false" iscontainer="true" isempty="false">
-          <!-- note, there is no "file here" -->
-          <menupopup>
-            <menu uri="..."  class="folderMenuItem menu-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name"
-                  SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-                  BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-                  IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-                  IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-                  ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
-              <menupopup/>
-            </menu>
-          </menupopup>
-        </rule>
-        <rule nc:CanFileMessages="true">
-          <menupopup>
-            <menuitem uri="..." class="folderMenuItem menuitem-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name"
-              oncommand="MsgCopyMessage(event.target)"
-              SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-              BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-              IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-              IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-              ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"/>
-          </menupopup>
-        </rule>
-      </template>
+          oncommand="MsgCopyMessage(event.target._folder);">
+      <menupopup id="mailContext-copyHereMenu"
+                 type="folder"
+                 mode="filing"
+                 showFileHereLabel="true"
+                 showRecent="true"
+                 recentLabel="&contextMoveCopyMsgRecentMenu.label;"
+                 recentAccessKey="&contextMoveCopyMsgRecentMenu.accesskey;"/>
     </menu>
     <menuitem id="mailContext-saveAs"
               label="&contextSaveAs.label;"
               accesskey="&contextSaveAs.accesskey;"
               oncommand="MsgSaveAsFile();"/>
     <menuitem id="mailContext-delete"
               command="cmd_delete"/>
     <menuseparator id="mailContext-sep-print"/>
@@ -1327,19 +1161,17 @@
       <menuseparator id="viewAfterCharsetSeparator"/>
       <menuitem id="pageSourceMenuItem" label="&pageSourceCmd.label;" key="key_viewPageSource" accesskey="&pageSourceCmd.accesskey;" command="cmd_viewPageSource"/>
       <menuseparator observes="mailHideMenus"/>
       <!-- overlayed from viewApplyThemeOverlay.xul -->
       <menu id="menu_viewApplyTheme" observes="mailHideMenus"/>
     </menupopup>
   </menu>
 
-  <menu id="goMenu" label="&goMenu.label;" accesskey="&goMenu.accesskey;" datasources="rdf:null"
-        oncommand="SelectFolder(event.target.getAttribute('value'));"
-        sortResource="http://home.netscape.com/NC-rdf#FolderTreeName" sortDirection="ascending">
+  <menu id="goMenu" label="&goMenu.label;" accesskey="&goMenu.accesskey;">
     <menupopup id="menu_GoPopup" onpopupshowing="InitGoMessagesMenu();">
       <menu id="goNextMenu" label="&nextMenu.label;" accesskey="&nextMenu.accesskey;">
         <menupopup id="menu_GoNextPopup">
           <menuitem id="nextMsgMenuItem"
                     label="&nextMsgCmd.label;"
                     accesskey="&nextMsgCmd.accesskey;"
                     key="key_nextMsg"
                     command="cmd_nextMsg"/>
@@ -1384,68 +1216,34 @@
                 key="key_goBack"
                 command="cmd_goBack"/>
       <menuitem id="menu_goForward"
                 label="&goForwardCmd.label;"
                 accesskey="&goForwardCmd.accesskey;"
                 key="key_goForward"
                 command="cmd_goForward"/>
       <menuseparator id="goNextAfterForwardSeparator" observes="mailHideMenus"/>
+      <menu id="goFolderMenu"
+            label="&folderMenu.label;"
+            accesskey="&folderMenu.accesskey;"
+            oncommand="SelectMsgFolder(event.target._folder);"
+            observes="mailHideMenus">
+        <menupopup id="menu_GoFolderPopup"
+                   type="folder"
+                   showFileHereLabel="true"
+                   showRecent="true"
+                   recentLabel="&contextMoveCopyMsgRecentMenu.label;"
+                   recentAccessKey="&contextMoveCopyMsgRecentMenu.accesskey;"/>
+      </menu>
+      <menuseparator id="goFolderSeparator"/>
       <menuitem id="goStartPage" label="&startPageCmd.label;"
                 accesskey="&startPageCmd.accesskey;" command="cmd_goStartPage"
                 observes="mailHideMenus"/>
       <menuseparator id="goNextAfterStartPageSeparator" observes="mailHideMenus"/>
     </menupopup>
-    <template>
-      <rule iscontainer="true" isempty="false">
-        <menupopup>
-          <menu uri="rdf:*" class="folderMenuItem menu-iconic"
-                observes="mailFolderPane"
-              SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-              BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-              IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-              IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-              ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"
-              HasUnreadMessages="rdf:http://home.netscape.com/NC-rdf#HasUnreadMessages"
-              NewMessages="rdf:http://home.netscape.com/NC-rdf#NewMessages"
-              SubfoldersHaveUnreadMessages="rdf:http://home.netscape.com/NC-rdf#SubfoldersHaveUnreadMessages"
-              label="rdf:http://home.netscape.com/NC-rdf#Name">
-            <menupopup>
-              <menuitem value="rdf:*"
-                  class="folderMenuItem menuitem-iconic"
-                  SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-                  BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-                  IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-                  IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-                  ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"
-                  HasUnreadMessages="rdf:http://home.netscape.com/NC-rdf#HasUnreadMessages"
-                  NewMessages="rdf:http://home.netscape.com/NC-rdf#NewMessages"
-                  SubfoldersHaveUnreadMessages="rdf:http://home.netscape.com/NC-rdf#SubfoldersHaveUnreadMessages"
-                  label="rdf:http://home.netscape.com/NC-rdf#Name"/>
-              <menuseparator/>
-            </menupopup>
-          </menu>
-        </menupopup>
-      </rule>
-      <rule>
-        <menupopup>
-          <menuitem uri="rdf:*" value="rdf:*" class="folderMenuItem menuitem-iconic"
-                    observes="mailFolderPane"
-              SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-              BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-              IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-              IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-              ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"
-              HasUnreadMessages="rdf:http://home.netscape.com/NC-rdf#HasUnreadMessages"
-              NewMessages="rdf:http://home.netscape.com/NC-rdf#NewMessages"
-              SubfoldersHaveUnreadMessages="rdf:http://home.netscape.com/NC-rdf#SubfoldersHaveUnreadMessages"
-              label="rdf:http://home.netscape.com/NC-rdf#Name"/>
-        </menupopup>
-      </rule>
-    </template>
   </menu>
 
   <menu id="messageMenu" label="&msgMenu.label;" accesskey="&msgMenu.accesskey;">
     <menupopup id="messageMenuPopup" onpopupshowing="InitMessageMenu();">
       <menuitem id="newMsgCmd"
                 label="&newMsgCmd.label;"
                 accesskey="&newMsgCmd.accesskey;"
                 key="key_newMessage"
@@ -1541,203 +1339,36 @@
      <menuitem id="archiveMainMenu"
                label="&archiveMsgCmd.label;"
                accesskey="&archiveMsgCmd.accesskey;"
                key="key_archive"
                command="cmd_archive"/>
      <menu id="moveMenu"
            label="&moveMsgToMenu.label;"
            accesskey="&moveMsgToMenu.accesskey;"
-           datasources="rdf:null"
-           sortResource="http://home.netscape.com/NC-rdf#FolderTreeName"
-           sortDirection="ascending">
-        <menupopup id="menu_MovePopup">
-          <menu label="&moveCopyMsgRecentMenu.label;"
-                accesskey="&moveCopyMsgRecentMenu.accesskey;"
-                sortResource="http://home.netscape.com/NC-rdf#FolderTreeName"
-                sortDirection="ascending"
-                datasources="rdf:mailnewsrecentfolders"
-                ref="mailnewsrecentfolders:/">
-            <menupopup/>
-            <template>
-              <rule nc:CanFileMessages="true">
-                <menupopup id="menu_MoveRecentPopup">
-                  <menuitem uri="..." class="folderMenuItem menuitem-iconic"
-                            label="rdf:http://home.netscape.com/NC-rdf#FolderTreeSimpleName"
-                            oncommand="MsgMoveMessage(event.target);"
-                            SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-                            BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-                            IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-                            IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-                            ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"/>
-                </menupopup>
-              </rule>
-            </template>
-          </menu>
-          <menuseparator id="moveMsgRecentSeparator"/>
-        </menupopup>
-        <template>
-        <rule nc:NoSelect="true" iscontainer="true" isempty="false">
-          <menupopup>
-            <menu uri="..."  class="folderMenuItem menu-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name">
-              <menupopup>
-                <menuitem label="&fileHereMenu.label;"
-                          accesskey="&fileHereMenu.accesskey;"
-                          disabled="true"/>
-                <menuseparator/>
-              </menupopup>
-            </menu>
-          </menupopup>
-        </rule>
-        <rule nc:NoSelect="true">
-          <menupopup>
-            <menuitem uri="..."  class="folderMenuItem menu-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name" disabled="true"/>
-          </menupopup>
-        </rule>
-        <rule nc:CanFileMessages="true" iscontainer="true" isempty="false">
-          <menupopup>
-            <menu uri="..."  class="folderMenuItem menu-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name"
-             SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-             BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-             IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-             IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-             ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
-              <menupopup>
-                <menuitem label="&fileHereMenu.label;"
-                          accesskey="&fileHereMenu.accesskey;"
-                          oncommand="MsgMoveMessage(event.target.parentNode.parentNode)"/>
-                <menuseparator/>
-              </menupopup>
-            </menu>
-          </menupopup>
-        </rule>
-        <rule nc:CanFileMessagesOnServer="false">
-          <!-- don't show servers (nntp & any others) which does not allow message filing -->
-          <!-- File, Move & Copy menus -->
-        </rule>
-        <rule nc:CanFileMessages="false" iscontainer="true" isempty="false">
-          <!-- note, there is no "file here" -->
-          <menupopup>
-            <menu uri="..."  class="folderMenuItem menu-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name"
-             SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-             BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-             IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-             IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-             ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
-              <menupopup/>
-            </menu>
-          </menupopup>
-        </rule>
-        <rule nc:CanFileMessages="true">
-          <menupopup>
-            <menuitem uri="..." class="folderMenuItem menuitem-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name" oncommand="MsgMoveMessage(event.target)"
-             SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-             BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-             IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-             IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-             ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"/>
-          </menupopup>
-        </rule>
-      </template>
+           oncommand="MsgMoveMessage(event.target._folder);">
+        <menupopup id="menu_MovePopup"
+                   type="folder"
+                   mode="filing"
+                   showFileHereLabel="true"
+                   showRecent="true"
+                   recentLabel="&moveCopyMsgRecentMenu.label;"
+                   recentAccessKey="&moveCopyMsgRecentMenu.accesskey;"/>
     </menu>
     <menu id="copyMenu"
           label="&copyMsgToMenu.label;"
           accesskey="&copyMsgToMenu.accesskey;"
-          datasources="rdf:null"
-          sortResource="http://home.netscape.com/NC-rdf#FolderTreeName"
-          sortDirection="ascending">
-        <menupopup id="menu_copyPopup">
-          <menu label="&moveCopyMsgRecentMenu.label;"
-                accesskey="&moveCopyMsgRecentMenu.accesskey;"
-                sortResource="http://home.netscape.com/NC-rdf#FolderTreeName"
-                sortDirection="ascending"
-                datasources="rdf:mailnewsrecentfolders"
-                ref="mailnewsrecentfolders:/">
-            <menupopup/>
-            <template>
-              <rule nc:CanFileMessages="true">
-                <menupopup id="menu_copyRecentPopup">
-                  <menuitem uri="..." class="folderMenuItem menuitem-iconic"
-                            label="rdf:http://home.netscape.com/NC-rdf#FolderTreeSimpleName"
-                            oncommand="MsgCopyMessage(event.target);"
-                            SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-                            BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-                            IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-                            IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-                            ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"/>
-                </menupopup>
-              </rule>
-            </template>
-          </menu>
-          <menuseparator id="copyMsgRecentSeparator"/>
-        </menupopup>
-      <template>
-        <rule nc:NoSelect="true" iscontainer="true" isempty="false">
-          <menupopup>
-            <menu uri="..."  class="folderMenuItem menu-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name">
-              <menupopup>
-                <menuitem label="&copyHereMenu.label;"
-                          accesskey="&copyHereMenu.accesskey;"
-                          disabled="true"/>
-                <menuseparator/>
-              </menupopup>
-            </menu>
-          </menupopup>
-        </rule>
-        <rule nc:NoSelect="true">
-          <menupopup>
-            <menuitem uri="..."  class="folderMenuItem menu-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name" disabled="true"/>
-          </menupopup>
-        </rule>
-        <rule nc:CanFileMessages="true" iscontainer="true" isempty="false">
-          <menupopup id="menu_copyFolderMenuPopup3">
-            <menu uri="..."  class="folderMenuItem menu-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name"
-             SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-             BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-             IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-             IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-             ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
-              <menupopup>
-                <menuitem label="&copyHereMenu.label;"
-                          accesskey="&copyHereMenu.accesskey;"
-                          oncommand="MsgCopyMessage(event.target.parentNode.parentNode)"/>
-                <menuseparator/>
-              </menupopup>
-            </menu>
-          </menupopup>
-        </rule>
-        <rule nc:CanFileMessagesOnServer="false">
-          <!-- don't show servers (nntp & any others) which does not allow message filing -->
-          <!-- File, Move & Copy menus -->
-        </rule>
-        <rule nc:CanFileMessages="false" iscontainer="true" isempty="false">
-          <!-- note, there is no "file here" -->
-          <menupopup>
-            <menu uri="..."  class="folderMenuItem menu-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name"
-             SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-             BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-             IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-             IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-             ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
-              <menupopup/>
-            </menu>
-          </menupopup>
-        </rule>
-        <rule nc:CanFileMessages="true">
-          <menupopup>
-            <menuitem uri="..." class="folderMenuItem menuitem-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name"
-             oncommand="MsgCopyMessage(event.target)"
-             SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-             BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-             IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-             IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-             ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"/>
-          </menupopup>
-        </rule>
-      </template>
+          oncommand="MsgCopyMessage(event.target._folder);">
+        <menupopup id="menu_copyPopup"
+                   type="folder"
+                   mode="filing"
+                   showFileHereLabel="true"
+                   showRecent="true"
+                   recentLabel="&moveCopyMsgRecentMenu.label;"
+                   recentAccessKey="&moveCopyMsgRecentMenu.accesskey;"/>
     </menu>
     <menu id="tagMenu" label="&tagMenu.label;" accesskey="&tagMenu.accesskey;">
       <menupopup id="tagMenu-tagpopup" onpopupshowing="InitMessageTags(this)">
         <menuitem id="tagMenu-tagRemoveAll" oncommand="RemoveAllMessageTags();"/>
         <menuseparator id="tagMenuAfterRemoveSeparator"/>
         <menuseparator id="tagMenuBeforeCustomizeSeparator"/>
         <menuitem id="tagMenu-tagCustomize"
                   label="&tagCustomize.label;"
@@ -1998,121 +1629,25 @@
                   command="cmd_forwardAttachment"/>
       </menupopup>
     </toolbarbutton>
     <toolbarbutton id="button-file"
                    type="menu"
                    class="toolbarbutton-1"
                    label="&fileButton.label;"
                    observes="button_file"
-                   datasources="rdf:null"
                    tooltiptext="&fileButton.tooltip;"
-                   sortResource="http://home.netscape.com/NC-rdf#FolderTreeName"
-                   sortDirection="ascending">
-      <menupopup id="button-filePopup">
-        <menu label="&moveCopyMsgRecentMenu.label;"
-              accesskey="&moveCopyMsgRecentMenu.accesskey;"
-              sortResource="http://home.netscape.com/NC-rdf#FolderTreeName"
-              sortDirection="ascending"
-              datasources="rdf:mailnewsrecentfolders"
-              ref="mailnewsrecentfolders:/">
-          <menupopup/>
-          <template>
-            <rule nc:CanFileMessages="true">
-              <menupopup>
-                <menuitem uri="..."
-                          class="folderMenuItem menuitem-iconic"
-                          label="rdf:http://home.netscape.com/NC-rdf#FolderTreeSimpleName"
-                          oncommand="MsgMoveMessage(event.target);"
-                          SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-                          BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-                          IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-                          IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-                          ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"/>
-              </menupopup>
-            </rule>
-          </template>
-        </menu>
-        <menuseparator/>
-      </menupopup>
-      <template>
-      <rule nc:NoSelect="true" iscontainer="true" isempty="false">
-        <menupopup>
-          <menu uri="..."
-                class="folderMenuItem menu-iconic"
-                label="rdf:http://home.netscape.com/NC-rdf#Name">
-            <menupopup>
-              <menuitem label="&fileHereMenu.label;"
-                        accesskey="&fileHereMenu.accesskey;"
-                        disabled="true"/>
-              <menuseparator/>
-            </menupopup>
-          </menu>
-        </menupopup>
-      </rule>
-      <rule nc:NoSelect="true">
-        <menupopup>
-          <menuitem uri="..."
-                    class="folderMenuItem menu-iconic"
-                    label="rdf:http://home.netscape.com/NC-rdf#Name"
-                    disabled="true"/>
-        </menupopup>
-      </rule>
-        <rule nc:CanFileMessages="true" iscontainer="true" isempty="false">
-          <menupopup>
-            <menu uri="..."
-                  class="folderMenuItem menu-iconic"
-                  label="rdf:http://home.netscape.com/NC-rdf#Name"
-                  SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-                  BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-                  IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-                  IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-                  ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
-              <menupopup>
-                <menuitem label="&fileHereMenu.label;"
-                          accesskey="&fileHereMenu.accesskey;"
-                          oncommand="MsgMoveMessage(event.target.parentNode.parentNode)"/>
-                <menuseparator/>
-              </menupopup>
-            </menu>
-          </menupopup>
-        </rule>
-        <rule nc:CanFileMessagesOnServer="false">
-          <!-- don't show servers (nntp & any others) which does not allow message filing -->
-          <!-- File, Move & Copy menus -->
-        </rule>
-        <rule nc:CanFileMessages="false" iscontainer="true" isempty="false">
-        <!-- note, there is no "file here" -->
-          <menupopup>
-            <menu uri="..."
-                  class="folderMenuItem menu-iconic"
-                  label="rdf:http://home.netscape.com/NC-rdf#Name"
-                  SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-                  BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-                  IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-                  IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-                  ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
-              <menupopup/>
-            </menu>
-          </menupopup>
-        </rule>
-        <rule nc:CanFileMessages="true">
-          <menupopup>
-            <menuitem uri="..."
-                      class="folderMenuItem menuitem-iconic"
-                      label="rdf:http://home.netscape.com/NC-rdf#Name"
-                      oncommand="MsgMoveMessage(event.target)"
-                      SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
-                      BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
-                      IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
-                      IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
-                      ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"/>
-          </menupopup>
-        </rule>
-      </template>
+                   oncommand="MsgMoveMessage(event.target._folder);">
+      <menupopup id="button-filePopup"
+                 type="folder"
+                 mode="filing"
+                 showRecent="true"
+                 showFileHereLabel="true"
+                 recentLabel="&moveCopyMsgRecentMenu.label;"
+                 recentAccessKey="&moveCopyMsgRecentMenu.accesskey;"/>
     </toolbarbutton>
 
     <toolbarbutton id="button-goback"
                    class="toolbarbutton-1"
                    type="menu-button"
                    label="&goBackButton.label;"
                    tooltiptext="&goBackButton.tooltip;"
                    observes="button_goBack"
--- a/suite/mailnews/content/messageWindow.js
+++ b/suite/mailnews/content/messageWindow.js
@@ -210,17 +210,16 @@ function OnLoadMessageWindow()
 {
   AddMailOfflineObserver();
   CreateMailWindowGlobals();
   verifyAccounts(null);
 
   InitMsgWindow();
 
   messenger.setWindow(window, msgWindow);
-  AddDataSources();
   // FIX ME - later we will be able to use onload from the overlay
   OnLoadMsgHeaderPane();
 
   var nsIFolderListener = Ci.nsIFolderListener;
   var notifyFlags = nsIFolderListener.removed | nsIFolderListener.event |
                     nsIFolderListener.intPropertyChanged;
   MailServices.mailSession.AddFolderListener(folderListener, notifyFlags);
 
--- a/suite/mailnews/content/messenger.css
+++ b/suite/mailnews/content/messenger.css
@@ -123,22 +123,16 @@ searchterm {
 .ruleactiontarget[type="forwardmessage"] {
   -moz-binding: url("chrome://messenger/content/searchWidgets.xml#ruleactiontarget-forwardto");
 }
 
 .ruleactiontarget[type="replytomessage"] {
   -moz-binding: url("chrome://messenger/content/searchWidgets.xml#ruleactiontarget-replyto");
 }
 
-#folderLocationPopup {
-  display: -moz-popup;
-  -moz-binding: url("chrome://messenger/content/mailWidgets.xml#locationpopup");
-  visibility: visible;
-}
-
 .folderSummaryPopup
 {
   -moz-binding: url("chrome://messenger/content/mailWidgets.xml#folderSummary-popup");
 }
 
 folderSummary
 {
   -moz-binding: url("chrome://messenger/content/mailWidgets.xml#folderSummary");
--- a/suite/mailnews/content/msgMail3PaneWindow.js
+++ b/suite/mailnews/content/msgMail3PaneWindow.js
@@ -710,17 +710,16 @@ function OnLoadMessenger()
   tabmail.registerTabType(gMailNewsTabsType);
   tabmail.openFirstTab();
   Services.obs.addObserver(MailWindowIsClosing,
                            "quit-application-requested");
 
   InitMsgWindow();
   messenger.setWindow(window, msgWindow);
 
-  InitializeDataSources();
   InitPanes();
 
   MigrateJunkMailSettings();
 
   accountManager.setSpecialFolders();
   accountManager.loadVirtualFolders();
   accountManager.addIncomingServerListener(gThreePaneIncomingServerListener);
 
@@ -970,35 +969,26 @@ function AddToSession()
   var notifyFlags = nsIFolderListener.intPropertyChanged |
                     nsIFolderListener.event;
   MailServices.mailSession.AddFolderListener(folderListener, notifyFlags);
 }
 
 function InitPanes()
 {
   OnLoadFolderPane();
-  OnLoadLocationTree();
   OnLoadThreadPane();
   SetupCommandUpdateHandlers();
 }
 
 function UnloadPanes()
 {
   // Call to <mail3PaneWindowCommands.js>.
   UnloadCommandUpdateHandlers();
 }
 
-function InitializeDataSources()
-{
-  //Setup common mailwindow stuff.
-  AddDataSources();
-
-  SetupMoveCopyMenus('goMenu', accountManagerDataSource, folderDataSource);
-}
-
 function AddMutationObserver(callback)
 {
   new MutationObserver(callback).observe(callback(), {attributes: true, attributeFilter: ["hidden"]});
 }
 
 function UpdateFolderUnreadCol()
 {
   var folderUnreadCol = document.getElementById("folderUnreadCol");
@@ -1043,32 +1033,16 @@ function UpdateAttachmentCol()
 {
   var attachmentCol = document.getElementById("attachmentCol");
   var threadTree = GetThreadTree();
   threadTree.setAttribute("noattachcol", attachmentCol.getAttribute("hidden"));
   threadTree.treeBoxObject.clearStyleAndImageCaches();
   return attachmentCol;
 }
 
-function OnLoadLocationTree()
-{
-  var locationTree = document.getElementById("folderLocationPopup").tree;
-  if (locationTree)
-  {
-    locationTree.database.AddDataSource(accountManagerDataSource);
-    locationTree.database.AddDataSource(folderDataSource);
-    locationTree.setAttribute("ref", "msgaccounts:/");
-  }
-}
-
-function OnLocationTreeSelect(menulist)
-{
-  SelectFolder(menulist.getAttribute('uri'));
-}
-
 function UpdateLocationBar(resource)
 {
     var tree = GetFolderTree();
     var folders = document.getElementById('locationFolders');
     var icon = document.getElementById('locationIcon');
     var names = ['BiffState', 'NewMessages', 'HasUnreadMessages',
         'SpecialFolder', 'IsServer', 'IsSecure', 'ServerType', 'NoSelect'];
     let folder = resource.QueryInterface(Ci.nsIMsgFolder);
@@ -1399,18 +1373,22 @@ function EnsureFolderIndex(builder, msgF
     builder.toggleOpenState(EnsureFolderIndex(builder, msgFolder.parent));
     index = builder.getIndexOfResource(msgFolder);
   }
   return index;
 }
 
 function SelectFolder(folderUri)
 {
+  let msgFolder = GetMsgFolderFromUri(folderUri);
+  SelectMsgFolder(msgFolder);
+}
+
+function SelectMsgFolder(msgFolder) {
   var folderTree = GetFolderTree();
-  let msgFolder = GetMsgFolderFromUri(folderUri);
 
   // Before we can select a folder, we need to make sure it is "visible"
   // in the tree. To do that, we need to ensure that all its
   // ancestors are expanded.
   var folderIndex = EnsureFolderIndex(folderTree.builderView, msgFolder);
   ChangeSelection(folderTree, folderIndex);
 }