<?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 SYSTEM "chrome://messenger/locale/mailOverlay.dtd">
<overlay id="mailOverlay.xul"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

  <script type="application/javascript">
  <![CDATA[
    Components.utils.import("resource:///modules/mailServices.js");
    function openNewCardDialog()
      {
        window.openDialog("chrome://messenger/content/addressbook/abNewCardDialog.xul",
                          "", "chrome,modal,resizable=no,centerscreen");
      }

    function goOpenNewMessage()
      {
        // if there is a MsgNewMessage function in scope
        // and we should use it, so that we choose the proper
        // identity, based on the selected message or folder
        // if not, bring up the compose window to the default identity
        if ("MsgNewMessage" in window) {
          MsgNewMessage(null);
          return;
        }

        MailServices.compose.OpenComposeWindow(null, null, null,
          Components.interfaces.nsIMsgCompType.New,
          Components.interfaces.nsIMsgCompFormat.Default,
          null, null);
      }

  ]]>
  </script>

  <!-- generic commands -->
  <commandset id="tasksCommands">
    <command id="cmd_newMessage" oncommand="goOpenNewMessage();"/>
    <command id="cmd_newCard" oncommand="openNewCardDialog()"/>
  </commandset>
  <menuitem id="menu_newCard" label="&newContactCmd.label;"
            accesskey="&newContactCmd.accesskey;" command="cmd_newCard"/>
  <menuitem id="menu_newMessage" label="&newMessageCmd.label;"
            accesskey="&newMessageCmd.accesskey;" key="key_newMessage"
            command="cmd_newMessage"/>
  <keyset id="tasksKeys">
#ifdef XP_MACOSX
  <key id="key_newMessage" key="&newMessageCmd.key;" command="cmd_newMessage"
       modifiers="accel,shift"/>
  <key id="key_newMessage2" key="&newMessageCmd2.key;" command="cmd_newMessage"
       modifiers="accel"/>
#else
  <key id="key_newMessage"  key="&newMessageCmd.key;" command="cmd_newMessage"
       modifiers="accel"/>
  <key id="key_newMessage2" key="&newMessageCmd2.key;" command="cmd_newMessage"
       modifiers="accel"/>
#endif
  </keyset>
</overlay>
