<?xml version="1.0"?>

<!-- retrieve generic commands -->
<?xul-overlay href="chrome://messenger/content/mailOverlay.xul"?>

<!DOCTYPE overlay SYSTEM "chrome://messenger/locale/mailEditorOverlay.dtd" >

<overlay id="mailEditorOverlay"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

  <script type="application/javascript">
  <![CDATA[

    function openComposeWindow(pageUrl, pageTitle)
    {
      var params = Components.classes["@mozilla.org/messengercompose/composeparams;1"].createInstance(Components.interfaces.nsIMsgComposeParams);
      if (params)
      {
        params.composeFields = Components.classes['@mozilla.org/messengercompose/composefields;1'].createInstance(Components.interfaces.nsIMsgCompFields);
        if (params.composeFields)
        {
          params.composeFields.body = pageUrl;
          params.composeFields.subject = pageTitle;
          var attachmentData = Components.classes["@mozilla.org/messengercompose/attachment;1"].createInstance(Components.interfaces.nsIMsgAttachment);
          if (attachmentData)
          {
            attachmentData.url = pageUrl;
            params.composeFields.addAttachment(attachmentData);
          }
          params.bodyIsLink = true;

          var composeService = Components.classes["@mozilla.org/messengercompose;1"].getService(Components.interfaces.nsIMsgComposeService);
          if (composeService)
            composeService.OpenComposeWindowWithParams(null, params);
        }
      }
    }

  ]]>
  </script>         

  <!-- editor specific UI items -->
  <menupopup id="menu_NewPopup">
    <!-- Command nodes and implemention are in mailOverlay.xul -->
    <menuitem id="menu_newMessage" insertafter="menu_newNavigator"/>
    <menuitem id="menu_newCard" insertafter="menu_newNavigator"/>
  </menupopup>

  <menupopup id="menu_FilePopup">
    <!-- The command node cmd_editSendPage is in editor.xul. 
         Implementation is in ComposerCommands.js
    -->
    <menuitem id="menu_sendPage" label="&sendPage.label;" accesskey="&sendPage.accesskey;" observes="cmd_editSendPage" insertafter="previewInBrowser"/>
  </menupopup>

</overlay>

