<?xml version="1.0"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
   - License, v. 2.0. If a copy of the MPL was not distributed with this
   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!DOCTYPE overlay [
<!ENTITY % msgHdrViewOverlayDTD SYSTEM "chrome://messenger/locale/msgHdrViewOverlay.dtd">
%msgHdrViewOverlayDTD;
<!ENTITY % messengerDTD SYSTEM "chrome://messenger/locale/messenger.dtd">
%messengerDTD;
]>

<?xml-stylesheet href="chrome://messenger/skin/messageHeader.css" type="text/css"?>
<?xml-stylesheet href="chrome://messenger/skin/attachmentList.css" type="text/css"?>
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

<script type="application/javascript"
        src="chrome://messenger/content/msgHdrViewOverlay.js"/>
<script type="application/javascript"
        src="chrome://global/content/nsDragAndDrop.js"/>

<stringbundleset id="stringbundleset">
  <stringbundle id="bundle_messenger" src="chrome://messenger/locale/messenger.properties"/>
</stringbundleset>

<commandset id="mailCommands">
  <commandset id="attachmentCommands">
    <command id="cmd_openAllAttachments"
             oncommand="goDoCommand('cmd_openAllAttachments');"
             disabled="true"/>
    <command id="cmd_saveAllAttachments"
             oncommand="goDoCommand('cmd_saveAllAttachments');"
             disabled="true"/>
    <command id="cmd_detachAllAttachments"
             oncommand="goDoCommand('cmd_detachAllAttachments');"
             disabled="true"/>
    <command id="cmd_deleteAllAttachments"
             oncommand="goDoCommand('cmd_deleteAllAttachments');"
             disabled="true"/>
  </commandset>
</commandset>

<menupopup id="messageIdContext" popupanchor="bottomleft"
           onpopupshowing="FillMessageIdContextMenu(document.popupNode);">
  <menuitem id="messageIdContext-messageIdTarget"
            disabled="true"/>
  <menuseparator id="messageIdContext-separator"/>
  <menuitem id="messageIdContext-openMessageForMsgId"
            label="&OpenMessageForMsgId.label;"
            accesskey="&OpenMessageForMsgId.accesskey;"
            oncommand="var messageId = GetMessageIdFromNode(document.popupNode, true);
                       OpenMessageForMessageId(messageId)"/>
  <menuitem id="messageIdContext-openBrowserWithMsgId"
            label="&OpenBrowserWithMsgId.label;"
            accesskey="&OpenBrowserWithMsgId.accesskey;"
            oncommand="var messageId = GetMessageIdFromNode(document.popupNode, true);
                       OpenBrowserWithMessageId(messageId)"/>
  <menuitem id="messageIdContext-copyMessageId"
            label="&CopyMessageId.label;"
            accesskey="&CopyMessageId.accesskey;"
            oncommand="var messageId = GetMessageIdFromNode(document.popupNode, false);
                       CopyMessageId(messageId);"/>
</menupopup>

<menupopup id="attachmentItemContext"
           onpopupshowing="return onShowAttachmentItemContextMenu();"
           onpopuphiding="return onHideAttachmentItemContextMenu();">
  <menuitem id="context-openAttachment"
            label="&openAttachmentCmd.label;"
            accesskey="&openAttachmentCmd.accesskey;"
            oncommand="HandleMultipleAttachments(this.parentNode.attachments, 'open');"/>
  <menuitem id="context-saveAttachment"
            label="&saveAsAttachmentCmd.label;"
            accesskey="&saveAsAttachmentCmd.accesskey;"
            oncommand="HandleMultipleAttachments(this.parentNode.attachments, 'saveAs');"/>
  <menuseparator id="context-menu-separator"/>
  <menuitem id="context-detachAttachment"
            label="&detachAttachmentCmd.label;"
            accesskey="&detachAttachmentCmd.accesskey;"
            oncommand="HandleMultipleAttachments(this.parentNode.attachments, 'detach');"/>
  <menuitem id="context-deleteAttachment"
            label="&deleteAttachmentCmd.label;"
            accesskey="&deleteAttachmentCmd.accesskey;"
            oncommand="HandleMultipleAttachments(this.parentNode.attachments, 'delete');"/>
</menupopup>

<menupopup id="attachmentListContext" onpopupshowing="goUpdateAttachmentCommands();">
  <menuitem id="context-openAllAttachments"
            label="&openAllAttachmentsCmd.label;"
            accesskey="&openAllAttachmentsCmd.accesskey;"
            command="cmd_openAllAttachments"/>
  <menuitem id="context-saveAllAttachments"
            label="&saveAllAttachmentsCmd.label;"
            accesskey="&saveAllAttachmentsCmd.accesskey;"
            command="cmd_saveAllAttachments"/>
  <menuseparator id="context-menu-separator-all"/>
  <menuitem id="context-detachAllAttachments"
            label="&detachAllAttachmentsCmd.label;"
            accesskey="&detachAllAttachmentsCmd.accesskey;"
            command="cmd_detachAllAttachments"/>
  <menuitem id="context-deleteAllAttachments"
            label="&deleteAllAttachmentsCmd.label;"
            accesskey="&deleteAllAttachmentsCmd.accesskey;"
            command="cmd_deleteAllAttachments"/>
</menupopup>

<menupopup id="attachmentMenuList" onpopupshowing="FillAttachmentListPopup(event, this);">
   <menuseparator/>
   <menuitem label="&openAllAttachmentsCmd.label;"
             accesskey="&openAllAttachmentsCmd.accesskey;"
             command="cmd_openAllAttachments" />
   <menuitem label="&saveAllAttachmentsCmd.label;"
             accesskey="&saveAllAttachmentsCmd.accesskey;"
             command="cmd_saveAllAttachments"/>
   <menuitem label="&detachAllAttachmentsCmd.label;"
             accesskey="&detachAllAttachmentsCmd.accesskey;"
             command="cmd_detachAllAttachments" />
   <menuitem label="&deleteAllAttachmentsCmd.label;"
             accesskey="&deleteAllAttachmentsCmd.accesskey;"
             command="cmd_deleteAllAttachments" />
</menupopup>

<menupopup id="appmenu_attachmentMenuList" onpopupshowing="FillAttachmentListPopup(event, this);">
   <menuseparator/>
   <menuitem label="&openAllAttachmentsCmd.label;"
             accesskey="&openAllAttachmentsCmd.accesskey;"
             command="cmd_openAllAttachments" />
   <menuitem label="&saveAllAttachmentsCmd.label;"
             accesskey="&saveAllAttachmentsCmd.accesskey;"
             command="cmd_saveAllAttachments"/>
   <menuitem label="&detachAllAttachmentsCmd.label;"
             accesskey="&detachAllAttachmentsCmd.accesskey;"
             command="cmd_detachAllAttachments" />
   <menuitem label="&deleteAllAttachmentsCmd.label;"
             accesskey="&deleteAllAttachmentsCmd.accesskey;"
             command="cmd_deleteAllAttachments" />
</menupopup>

<menupopup id="header-toolbar-context-menu">
  <menuitem id="CustomizeHeaderToolbar"
            oncommand="CustomizeMailToolbar('header-view-toolbox', 'CustomizeHeaderToolbar')"
            label="&customizeToolbar.label;"
            accesskey="&customizeToolbar.accesskey;"/>
</menupopup>

<menupopup id="attachment-toolbar-context-menu"
           onpopupshowing="return onShowAttachmentToolbarContextMenu(event);">
  <menuitem id="context-expandAttachmentBar" type="checkbox"
            label="&startExpandedCmd.label;"
            accesskey="&startExpandedCmd.accesskey;"
            oncommand="Services.prefs.setBoolPref('mailnews.attachments.display.start_expanded', this.getAttribute('checked'));"/>
  <menuseparator/>
  <menuitem id="CustomizeAttachmentToolbar"
            oncommand="CustomizeMailToolbar('attachment-view-toolbox', 'CustomizeAttachmentToolbar')"
            label="&customizeToolbar.label;"
            accesskey="&customizeToolbar.accesskey;"/>
</menupopup>

<menupopup id="copyUrlPopup" popupanchor="bottomleft">
  <menuitem label="&copyLinkCmd.label;" accesskey="&copyLinkCmd.accesskey;" oncommand="CopyWebsiteAddress(document.popupNode)"/>
</menupopup>

<hbox id="msgHeaderView" collapsed="true" class="main-header-area">
  <deck id="msgHeaderViewDeck" selectedIndex="0"
        persist="selectedIndex" flex="1"
        context="header-toolbar-context-menu">

    <!-- the message pane consists of 3 'boxes'. Box #2 is the expanded headers view (the default view) -->
    <vbox id="expandedHeaderView" flex="1">

      <!-- a convenience box for ease of extension overlaying -->
      <vbox id="expandedHeadersBox" flex="1">

        <!-- This hbox has display:block set to imbue it with the HTML layout
             model. This lets us float the message header toolbar to the right
             so we don't waste space when the From field and the toolbar could
             fit alongside each other. -->
        <hbox id="expandedHeadersTopBox" flex="1">

          <toolbox id="header-view-toolbox"
                   class="inline-toolbox"
                   defaulticonsize="small"
                   minwidth="50px"
                   defaultlabelalign="end"
                   defaultmode="full"
                   inlinetoolbox="true">
            <toolbarpalette id="header-view-toolbar-palette">
              <!-- XXXdmose need to move these commands to a controller, either
                   on the header view, the message pane, or the default
                   controller -->

              <!-- XXXdmose need to audit our shortcut/a11y setup and make sure
                   these buttons are doing the right thing -->

              <toolbarbutton id="hdrForwardButton"
                             label="&hdrForwardButton1.label;"
                             tooltiptext="&hdrForwardButton1.tooltip;"
                             oncommand="MsgForwardMessage(event);RestoreFocusAfterHdrButton();"
                             observes="button_forward"
                             class="toolbarbutton-1 msgHeaderView-button hdrForwardButton"/>
              <toolbaritem id="hdrMenuForwardButton" label="&hdrMenuForwardButton.label;">
              <!-- This toolbaritem is a dummy and should only be shown when
                   customizing the toolbar to distinguish the forward button
                   from the forward dual-button. -->
                <toolbarbutton id="hdrDualForwardButton"
                               label="&hdrForwardButton1.label;"
                               tooltiptext="&hdrForwardButton1.tooltip;"
                               oncommand="MsgForwardMessage(event);RestoreFocusAfterHdrButton();"
                               observes="button_forward"
                               class="toolbarbutton-1 msgHeaderView-button hdrForwardButton"
                               type="menu-button">
                  <menupopup id="hdrForwardDropdown">
                    <menuitem id="hdrForwardAsInlineMenu"
                              label="&buttonMenuForwardAsInline.label;"
                              tooltiptext="&forwardAsInline.tooltip;"
                              command="cmd_forwardInline"/>
                    <menuitem id="hdrForwardAsAttachmentMenu"
                              label="&buttonMenuForwardAsAttachment.label;"
                              tooltiptext="&forwardAsAttachment.tooltip;"
                              command="cmd_forwardAttachment"/>
                  </menupopup>
                </toolbarbutton>
              </toolbaritem>
              <toolbarbutton id="hdrArchiveButton"
                             label="&hdrArchiveButton1.label;"
                             tooltiptext="&hdrArchiveButton1.tooltip;"
                             oncommand="MsgArchiveSelectedMessages(event);RestoreFocusAfterHdrButton();"
                             observes="button_archive"
                             class="toolbarbutton-1 msgHeaderView-button hdrArchiveButton"/>
              <toolbarbutton id="hdrJunkButton" label="&hdrJunkButton1.label;"
                             tooltiptext="&hdrJunkButton1.tooltip;"
                             observes="button_junk"
                             class="toolbarbutton-1 msgHeaderView-button hdrJunkButton"
                             oncommand="goDoCommand('button_junk');RestoreFocusAfterHdrButton();"/>
              <toolbarbutton id="hdrTrashButton"
                             label="&hdrTrashButton1.label;"
                             tooltiptext="&hdrTrashButton1.tooltip;"
                             observes="button_delete"
                             class="toolbarbutton-1 msgHeaderView-button hdrTrashButton"
                             oncommand="goDoCommand(event.shiftKey ? 'button_shiftDelete' :
                                                    'button_delete');RestoreFocusAfterHdrButton();"/>
              <toolbarbutton id="hdrReplyToSenderButton" label="&hdrReplyButton1.label;"
                             tooltiptext="&hdrReplyButton2.tooltip;"
                             oncommand="MsgReplySender(event);RestoreFocusAfterHdrButton();"
                             observes="button_reply"
                             class="toolbarbutton-1 msgHeaderView-button hdrReplyToSenderButton"/>
              <toolbaritem id="hdrSmartReplyButton" label="&hdrSmartReplyButton1.label;">
                <!-- This button is a dummy and should only be shown when
                     customizing the toolbar to distinguish the smart reply
                     button from the reply to sender button. -->
                <toolbarbutton id="hdrDummyReplyButton" label="&hdrSmartReplyButton1.label;"
                               hidden="true"
                               class="toolbarbutton-1 msgHeaderView-button hdrDummyReplyButton"/>
                <toolbarbutton id="hdrReplyButton" label="&hdrReplyButton1.label;"
                               tooltiptext="&hdrReplyButton2.tooltip;"
                               oncommand="MsgReplySender(event);RestoreFocusAfterHdrButton();"
                               observes="button_reply"
                               class="toolbarbutton-1 msgHeaderView-button hdrReplyButton"/>
                <toolbarbutton id="hdrReplyAllButton"
                               label="&hdrReplyAllButton1.label;"
                               tooltiptext="&hdrReplyAllButton1.tooltip;"
                               oncommand="MsgReplyToAllMessage(event);RestoreFocusAfterHdrButton();"
                               observes="button_replyall"
                               class="toolbarbutton-1 msgHeaderView-button hdrReplyButton hdrReplyAllButton"
                               type="menu-button"
                               hidden="true">
                  <menupopup id="hdrReplyAllDropdown">
                    <menuitem id="hdrReplyAll_ReplyAllSubButton"
                              label="&hdrReplyAllButton1.label;"
                              tooltiptext="&hdrReplyAllButton1.tooltip;"
                              observes="button_replyall"/>
                    <menuseparator id="hdrReplyAllSubSeparator"/>
                    <menuitem id="hdrReplySubButton"
                              label="&hdrReplyButton1.label;"
                              tooltiptext="&hdrReplyButton2.tooltip;"
                              observes="button_reply"
                              oncommand="MsgReplySender(event); event.stopPropagation();
                                         RestoreFocusAfterHdrButton();"/>
                  </menupopup>
                </toolbarbutton>
                <toolbarbutton id="hdrReplyListButton"
                               label="&hdrReplyListButton1.label;"
                               tooltiptext="&hdrReplyListButton1.tooltip;"
                               oncommand="MsgReplyToListMessage(event);RestoreFocusAfterHdrButton();"
                               observes="button_replylist"
                               class="toolbarbutton-1 msgHeaderView-button hdrReplyButton hdrReplyListButton"
                               type="menu-button"
                               hidden="true">
                  <menupopup id="hdrReplyListDropdown">
                    <menuitem id="hdrReplyList_ReplyListSubButton"
                              label="&hdrReplyListButton1.label;"
                              tooltiptext="&hdrReplyListButton1.tooltip;"
                              observes="button_replylist"/>
                    <menuseparator id="hdrReplyListSubSeparator"/>
                    <menuitem id="hdrRelplyList_ReplyAllSubButton"
                              label="&hdrReplyAllButton1.label;"
                              tooltiptext="&hdrReplyAllButton1.tooltip;"
                              observes="button_replyall"
                              oncommand="MsgReplyToAllMessage(event); event.stopPropagation();
                                         RestoreFocusAfterHdrButton();"/>
                    <menuitem id="hdrReplyList_ReplySubButton"
                              label="&hdrReplyButton1.label;"
                              tooltiptext="&hdrReplyButton2.tooltip;"
                              observes="button_reply"
                              oncommand="MsgReplySender(event); event.stopPropagation();
                                         RestoreFocusAfterHdrButton();"/>
                  </menupopup>
                </toolbarbutton>
                <toolbarbutton id="hdrFollowupButton" label="&hdrFollowupButton1.label;"
                               tooltiptext="&hdrFollowupButton1.tooltip;"
                               oncommand="MsgReplyGroup(event);RestoreFocusAfterHdrButton();"
                               observes="button_followup"
                               class="toolbarbutton-1 msgHeaderView-button hdrFollowupButton"
                               type="menu-button">
                  <menupopup id="hdrFollowupDropdown">
                    <menuitem id="hdrFollowup_FollowupSubButton"
                              label="&hdrFollowupButton1.label;"
                              tooltiptext="&hdrFollowupButton1.tooltip;"
                              observes="button_followup"/>
                    <menuseparator id="hdrFollowupSubSeparator"/>
                    <menuitem id="hdrFollowup_ReplyAllSubButton"
                              label="&hdrReplyAllButton1.label;"
                              tooltiptext="&hdrReplyAllButton1.tooltip;"
                              observes="button_replyall"
                              oncommand="MsgReplyToAllMessage(event); event.stopPropagation();
                                         RestoreFocusAfterHdrButton();"/>
                    <menuitem id="hdrFollowup_ReplySubButton"
                              label="&hdrReplyButton1.label;"
                              tooltiptext="&hdrReplyButton2.tooltip;"
                              observes="button_reply"
                              oncommand="MsgReplySender(event); event.stopPropagation();
                                         RestoreFocusAfterHdrButton();"/>
                  </menupopup>
                </toolbarbutton>
              </toolbaritem>
              <toolbarbutton id="hdrTagButton"
                             type="menu"
                             class="toolbarbutton-1 msgHeaderView-button hdrTagButton"
                             label="&tagButton.label;"
                             tooltiptext="&tagButton.tooltip;"
                             command="cmd_tag">
                <menupopup id="hdrTagDropdown"
                           onpopupshowing="InitMessageTags(this);">
                  <menuitem id="hdrTagDropdown-addNewTag"
                            label="&addNewTag.label;"
                            accesskey="&addNewTag.accesskey;"
                            command="cmd_addTag"/>
                  <menuitem id="manageTags"
                            label="&manageTags.label;"
                            accesskey="&manageTags.accesskey;"
                            command="cmd_manageTags"/>
                  <menuseparator id="hdrTagDropdown-sep-afterAddNewTag"/>
                  <menuitem id="hdrTagDropdown-tagRemoveAll"
                            command="cmd_removeTags"/>
                  <menuseparator id="hdrTagDropdown-sep-afterTagRemoveAll"/>
                </menupopup>
              </toolbarbutton>
            </toolbarpalette>

            <toolbar id="header-view-toolbar" class="inline-toolbar" align="start"
                     customizable="true" mode="full"
                     context="header-toolbar-context-menu"
                     defaulticonsize="small" defaultmode="full"
                     defaultset="hdrReplyToSenderButton,hdrSmartReplyButton,hdrForwardButton,hdrArchiveButton,hdrJunkButton,hdrTrashButton"/>
          </toolbox>

          <!-- This box ensures that the expandedHeaders grid below is aligned
               with the bottom of the message header toolbar. Like the
               expandedHeadersTopBox, this uses display:block to give us HTML
               layouting. -->
          <box id="expandedBoxSpacer"/>

          <!-- Theoretically, we should be able to replace this grid with just
               an hbox.  Unfortunately, doing that makes it very hard to sync
               the column sizes between the name columns, because for currently
               unclear reasons, the .clientWidth of a column is wider than the
               .clientWidth of its largest contained child by an unspecified
               amount. -->
          <grid id="expandedHeaders">

            <columns id="expandedHeadersColumns">
              <column id="expandedHeadersNameColumn"/>
              <column id="expandedHeadersValueColumn" flex="1"/>
            </columns>

            <rows id="expandedHeaderRows">
              <row id="expandedfromRow">
                <label id="expandedfromLabel" class="headerName"
                       value="&fromField4.label;" control="expandedfromBox"/>
                <mail-multi-emailHeaderField id="expandedfromBox" flex="1"/>
              </row>
            </rows>
          </grid>
        </hbox>

        <hbox id="expandedHeadersBottomBox">

          <!-- The grid that contains all headers except the first one,
                including any headers created dynamically from JavaScript -->
          <grid id="expandedHeaders2" flex="1">

            <columns id="expandedHeaders2Columns">
              <column id="expandedHeaders2NameColumn"/>
              <column id="expandedHeaders2ValueColumn" flex="1"/>
            </columns>

            <rows id="expandedHeader2Rows">

              <!-- Commonly used rows are pre-specified in the XUL to avoid the
                   performance hit of creating them dynamically. -->
              <row id="expandedsubjectRow">
                <label id="expandedsubjectLabel" class="headerName"
                       value="&subjectField4.label;"
                       control="expandedsubjectBox"/>
                <mail-headerfield id="expandedsubjectBox" flex="1"/>
              </row>
              <row id="expandedorganizationRow" collapsed="true">
                <label id="expandedorganizationLabel" class="headerName"
                       value="&organizationField4.label;"
                       control="expandedorganizationBox"/>
                <mail-headerfield id="expandedorganizationBox"/>
              </row>
              <row id="expandedsenderRow" collapsed="true">
                <label id="expandedsenderLabel" class="headerName"
                       value="&senderField4.label;" control="expandedsenderBox"/>
                <mail-emailheaderfield id="expandedsenderBox"/>
              </row>
              <row id="expandedreply-toRow" collapsed="true">
                <label id="expandedreply-toLabel" class="headerName"
                       value="&replyToField4.label;"
                       control="expandedreply-toBox"/>
                <mail-multi-emailHeaderField id="expandedreply-toBox"/>
              </row>
              <row id="expandedtoRow" collapsed="true">
                <label id="expandedtoLabel" class="headerName"
                       value="&toField4.label;" control="expandedtoBox"/>
                <mail-multi-emailHeaderField id="expandedtoBox" flex="1"/>
              </row>
              <row id="expandedccRow" collapsed="true">
                <label id="expandedccLabel" class="headerName"
                       value="&ccField4.label;" control="expandedccBox"/>
                <mail-multi-emailHeaderField id="expandedccBox" flex="1"/>
              </row>
              <row id="expandedbccRow" collapsed="true">
                <label id="expandedbccLabel" class="headerName"
                       value="&bccField4.label;" control="expandedbccBox"/>
                <mail-multi-emailHeaderField id="expandedbccBox"/>
              </row>
              <row id="expandednewsgroupsRow" collapsed="true">
                <label id="expandednewsgroupsLabel" class="headerName"
                       value="&newsgroupsField4.label;"
                       control="expandednewsgroupsBox"/>
                <mail-newsgroups-headerfield id="expandednewsgroupsBox"/>
              </row>
              <row id="expandedfollowup-toRow" collapsed="true">
                <label id="expandedfollowup-toLabel" class="headerName"
                       value="&followupToField4.label;"
                       control="expandedfollowup-toBox"/>
                <mail-newsgroups-headerfield id="expandedfollowup-toBox"/>
              </row>
              <row id="expandeddateRow" collapsed="true">
                <label id="expandeddateLabel" class="headerName"
                       value="&dateField4.label;" control="expandeddateBox"/>
                <mail-headerfield id="expandeddateBox" flex="1"/>
              </row>
              <row id="expandedmessage-idRow" collapsed="true">
                <label id="expandedmessage-idLabel" class="headerName"
                       value="&messageIdField4.label;"
                       control="expandedmessage-idBox"/>
                <mail-messageids-headerfield id="expandedmessage-idBox"/>
              </row>
              <row id="expandedin-reply-toRow" collapsed="true">
                <label id="expandedin-reply-toLabel" class="headerName"
                       value="&inReplyToField4.label;"
                       control="expandedin-reply-toBox"/>
                <mail-messageids-headerfield id="expandedin-reply-toBox"/>
              </row>
              <row id="expandedreferencesRow" collapsed="true">
                <label id="expandedreferencesLabel" class="headerName"
                       value="&referencesField4.label;"
                       control="expandedReferencesBox"/>
                <mail-messageids-headerfield id="expandedreferencesBox"
                                             flex="1"/>
              </row>
              <row id="expandedtagsRow" collapsed="true">
                <label id="expandedtagsLabel" class="headerName"
                       value="&tagsHdr4.label;" control="expandedtagsBox"/>
                <mail-tagfield id="expandedtagsBox"/>
              </row>
              <row id="expandedcontent-baseRow" collapsed="true">
                <label id="expandedcontent-baseLabel" class="headerName"
                       value="&originalWebsite4.label;"
                       control="expandedcontent-baseBox"/>
                <mail-urlfield id="expandedcontent-baseBox"/>
              </row>
              <row id="expandeduser-agentRow" collapsed="true">
                <label id="expandeduser-agentLabel" class="headerName"
                       value="&userAgentField4.label;"
                       control="expandeduser-agentBox"/>
                <mail-headerfield id="expandeduser-agentBox" flex="1"/>
              </row>
            </rows>
          </grid>

          <!-- perhaps this should be a customizable toolbar too -->
          <vbox id="otherActionsBox" align="end">
            <hbox id="dateValueBox" align="top" flex="1">  <!--For extensions-->
              <label id="dateLabel" class="dateLabel" flex="1" role="textbox"
                     aria-readonly="true"/>
            </hbox>
            <button type="menu" id="otherActionsButton"
                    label="&otherActionsButton1.label;"
                    class="msgHeaderView-button msgHeaderView-flat-button">
              <menupopup id="otherActionsPopup"
                         onpopupshowing="onShowOtherActionsPopup();">
                <menuitem id="otherActionsOpenConversation"
                          label="&otherActionsOpenConversation1.label;"
                          accesskey="&otherActionsOpenConversation1.accesskey;"
                          oncommand="gConversationOpener.openConversationForMessages(gFolderDisplay.selectedMessages);"/>
                <menuitem id="otherActionsOpenInNewWindow"
                          label="&otherActionsOpenInNewWindow1.label;"
                          accesskey="&otherActionsOpenInNewWindow1.accesskey;"
                          oncommand="MsgOpenNewWindowForMessage();"/>
                <menuitem id="otherActionsOpenInNewTab"
                          label="&otherActionsOpenInNewTab1.label;"
                          accesskey="&otherActionsOpenInNewTab1.accesskey;"
                          oncommand="OpenMessageInNewTab(event);"/>
                <menuitem id="viewSourceMenuItem"
                          label="&viewSourceMenuItem1.label;"
                          accesskey="&viewSourceMenuItem1.accesskey;"
                          oncommand="ViewPageSource(gFolderDisplay.selectedMessageUris);" />
                <menuseparator id="otherActionsSeparator"/>
                <menuitem id="markAsReadMenuItem"
                          label="&markAsReadMenuItem1.label;"
                          accesskey="&markAsReadMenuItem1.accesskey;"
                          oncommand="MsgMarkMsgAsRead();"/>
                <menuitem id="markAsUnreadMenuItem"
                          label="&markAsUnreadMenuItem1.label;"
                          accesskey="&markAsUnreadMenuItem1.accesskey;"
                          oncommand="MsgMarkMsgAsRead();"/>
                <menuitem id="saveAsMenuItem" label="&saveAsMenuItem1.label;"
                          accesskey="&saveAsMenuItem1.accesskey;"
                          oncommand="MsgSaveAsFile();"/>
                <menuitem id="otherActionsPrint"
                          label="&otherActionsPrint1.label;"
                          accesskey="&otherActionsPrint1.accesskey;"
                          oncommand="PrintEnginePrint();"/>
              </menupopup>
            </button>
          </vbox>
        </hbox>
      </vbox>
    </vbox>
  </deck>
</hbox>

<!-- the message pane consists of 4 'boxes'. Box #4 is the attachment box which
     can be toggled into a slim or an expanded view -->
<vbox id="attachmentView" collapsed="true">
  <hbox align="center" id="attachmentBar"
        context="attachment-toolbar-context-menu"
        onclick="if (event.button == 0) toggleAttachmentList(undefined, true);">
    <button type="checkbox" id="attachmentToggle"
            onmousedown="event.preventDefault();"
            onclick="event.stopPropagation();"
            oncommand="toggleAttachmentList(this.checked, true);"/>
    <hbox align="center" id="attachmentInfo" flex="1">
      <image id="attachmentIcon"/>
      <label id="attachmentCount"/>
      <label id="attachmentName" crop="center" flex="1"
             tooltiptext="&openAttachment.tooltip;"
             onclick="OpenAttachmentFromBar(event);"
             ondraggesture="nsDragAndDrop.startDrag(event,attachmentNameDNDObserver);"/>
      <label id="attachmentSize"/>
    </hbox>
    <!-- Use a very large flex value here so that attachmentCount doesn't take
         up more space than necessary, but still crops itself if there's not
         enough space. -->
    <spacer flex="9999"/>

    <toolbox id="attachment-view-toolbox"
             class="inline-toolbox"
             defaulticonsize="small"
             minwidth="50px"
             defaultlabelalign="end"
             defaultmode="full"
             inlinetoolbox="true">
      <toolbarpalette id="attachment-view-toolbar-palette">
        <toolbaritem id="attachmentSaveAll"
                     title="&saveAllAttachmentsButton1.label;">
          <toolbarbutton type="menu-button" id="attachmentSaveAllSingle"
                         class="toolbarbutton-1 msgHeaderView-button"
                         label="&saveAttachmentButton1.label;"
                         tooltiptext="&saveAttachmentButton1.tooltip;"
                         onclick="event.stopPropagation();"
                         oncommand="TryHandleAllAttachments('saveAs'); RestoreFocusAfterHdrButton();"
                         hidden="true">
            <menupopup id="attachmentSaveAllSingleMenu"
                       onpopupshowing="onShowSaveAttachmentMenuSingle();">
              <menuitem id="button-openAttachment"
                        oncommand="TryHandleAllAttachments('open'); event.stopPropagation(); RestoreFocusAfterHdrButton();"
                        label="&openAttachmentCmd.label;"
                        accesskey="&openAttachmentCmd.accesskey;"/>
              <menuitem id="button-saveAttachment"
                        oncommand="TryHandleAllAttachments('saveAs'); event.stopPropagation(); RestoreFocusAfterHdrButton();"
                        label="&saveAsAttachmentCmd.label;"
                        accesskey="&saveAsAttachmentCmd.accesskey;"/>
              <menuseparator id="button-menu-separator"/>
              <menuitem id="button-detachAttachment"
                        oncommand="TryHandleAllAttachments('detach'); event.stopPropagation(); RestoreFocusAfterHdrButton();"
                        label="&detachAttachmentCmd.label;"
                        accesskey="&detachAttachmentCmd.accesskey;"/>
              <menuitem id="button-deleteAttachment"
                        oncommand="TryHandleAllAttachments('delete'); event.stopPropagation(); RestoreFocusAfterHdrButton();"
                        label="&deleteAttachmentCmd.label;"
                        accesskey="&deleteAttachmentCmd.accesskey;"/>
            </menupopup>
          </toolbarbutton>
          <toolbarbutton type="menu-button" id="attachmentSaveAllMultiple"
                         class="toolbarbutton-1 msgHeaderView-button"
                         label="&saveAllAttachmentsButton1.label;"
                         tooltiptext="&saveAllAttachmentsButton1.tooltip;"
                         onclick="event.stopPropagation();"
                         oncommand="TryHandleAllAttachments('save'); RestoreFocusAfterHdrButton();">
            <menupopup id="attachmentSaveAllMultipleMenu"
                       onpopupshowing="onShowSaveAttachmentMenuMultiple();">
              <menuitem id="button-openAllAttachments"
                        oncommand="TryHandleAllAttachments('open'); event.stopPropagation(); RestoreFocusAfterHdrButton();"
                        label="&openAllAttachmentsCmd.label;"
                        accesskey="&openAllAttachmentsCmd.accesskey;"/>
              <menuitem id="button-saveAllAttachments"
                        oncommand="TryHandleAllAttachments('save'); event.stopPropagation(); RestoreFocusAfterHdrButton();"
                        label="&saveAllAttachmentsCmd.label;"
                        accesskey="&saveAllAttachmentsCmd.accesskey;"/>
              <menuseparator id="button-menu-separator-all"/>
              <menuitem id="button-detachAllAttachments"
                        oncommand="TryHandleAllAttachments('detach'); event.stopPropagation(); RestoreFocusAfterHdrButton();"
                        label="&detachAllAttachmentsCmd.label;"
                        accesskey="&detachAllAttachmentsCmd.accesskey;"/>
              <menuitem id="button-deleteAllAttachments"
                        oncommand="TryHandleAllAttachments('delete'); event.stopPropagation(); RestoreFocusAfterHdrButton();"
                        label="&deleteAllAttachmentsCmd.label;"
                        accesskey="&deleteAllAttachmentsCmd.accesskey;"/>
            </menupopup>
          </toolbarbutton>
        </toolbaritem>
      </toolbarpalette>
      <toolbar id="attachment-view-toolbar" class="inline-toolbar"
               customizable="true" mode="full"
               context="attachment-toolbar-context-menu"
               defaulticonsize="small" defaultmode="full"
               defaultset="attachmentSaveAll"/>
    </toolbox>
  </hbox>
  <attachmentlist orient="horizontal" id="attachmentList" flex="1"
                  seltype="multiple" context="attachmentListContext"
                  itemcontext="attachmentItemContext"
                  ondraggesture="nsDragAndDrop.startDrag(event,attachmentListDNDObserver);"
                  ondragover="nsDragAndDrop.dragOver(event, attachmentListDNDObserver);"/>
</vbox>

</overlay>
