DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Untracked file

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237
<?xml version="1.0"?>

<?xul-overlay href="chrome://navigator/content/platformMailOverlay.xul"?>

<!DOCTYPE overlay SYSTEM "chrome://navigator/locale/mailNavigatorOverlay.dtd" >

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

  <script type="application/x-javascript">
  <![CDATA[
    var gHasIntegratedMailClient = ("@mozilla.org/messengercompose/composeparams;1" in Components.classes);

    // attachment: 0 - link
    //             1 - page
    //             2 - image
    function openComposeWindow(url, title, attachment, charset)
    {
      if (gHasIntegratedMailClient) {                                                                      
        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)
          {
            if (attachment == 0 || attachment == 1)
            {
              params.composeFields.body = url;
              params.composeFields.subject = title;
              params.bodyIsLink = true;
            }
            if (attachment == 1 || attachment == 2)
            {
              var attachmentData = Components.classes["@mozilla.org/messengercompose/attachment;1"]
                                             .createInstance(Components.interfaces.nsIMsgAttachment);
              if (attachmentData)
              {
                attachmentData.url = url;
                attachmentData.urlCharset = charset;
                params.composeFields.addAttachment(attachmentData);
              }
            }
            var composeService = Components.classes["@mozilla.org/messengercompose;1"]
                                           .getService(Components.interfaces.nsIMsgComposeService);
            if (composeService) {
              // it is possible you won't have a default identity
              // like if you've never launched mail before on a new profile.
              // see bug #196073
              try {
                params.identity = composeService.defaultIdentity;
              }
              catch (ex) {
                params.identity = null;
              }
              composeService.OpenComposeWindowWithParams(null, params);
            }
          }                                                                         
        }                                                                         
      }
      else {
        openExternalMailer(url, title);
      }
    }

    function openExternalMailer(url, title) {
      var extProtocolSvc = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
                                     .getService(Components.interfaces.nsIExternalProtocolService);
      var ioService = Components.classes["@mozilla.org/network/io-service;1"]
                                .getService(Components.interfaces.nsIIOService);
      var mailto = url ? "mailto:?body="+encodeURIComponent(url)+"&subject="+encodeURIComponent(title) : "mailto:";
      var uri = ioService.newURI(mailto, null, null);

      extProtocolSvc.loadUrl(uri);
    }

    function openNewCardDialog()
    {
      window.openDialog("chrome://messenger/content/addressbook/abNewCardDialog.xul",
                         "",
                         "chrome,resizable=no,titlebar,modal");
    }

    function goOpenNewMessage()
    {
      if (gHasIntegratedMailClient) {
        if ("MsgNewMessage" in window)
        {
          MsgNewMessage(null);
          return;
        }
        
        var msgComposeService = Components.classes["@mozilla.org/messengercompose;1"].getService();
        msgComposeService = msgComposeService.QueryInterface(Components.interfaces.nsIMsgComposeService);
        msgComposeService.OpenComposeWindow(null, null,
                                           Components.interfaces.nsIMsgCompType.New,
                                           Components.interfaces.nsIMsgCompFormat.Default,
                                           null, null);
      }
      else {
        openExternalMailer();
      }
    }

    function sendLink(aURL)
    {
      var title = "";
      if (!aURL) {
        aURL = window.content.document.URL;
        title = window.content.document.title;
      }
      try {
        openComposeWindow(aURL, title, 0, null);
      } catch(ex) { dump("Cannot Send Link: " + ex + "\n"); }
    }

    function sendImage(imageURL)
    {
      try {
        var charset =  getCharsetforSave(null);
        openComposeWindow(imageURL, null, 2, charset);
      } catch(ex) { dump("Cannot Send Image: " + ex + "\n"); }
    }

    function sendPage(aDocument)
    {
      if (!aDocument)
        aDocument = window.content.document;
        
      try {
        var charset = getCharsetforSave(aDocument);
        openComposeWindow(aDocument.URL, aDocument.title, 1, charset);
      } catch(ex) { dump("Cannot Send Page: " + ex + "\n"); }
    }

    function initMailContextMenuItems(aEvent)
    {
      var shouldShowSendPage = !(gContextMenu.onTextInput || 
                               gContextMenu.isContentSelected) && 
                               !(gContextMenu.onLink && gContextMenu.onImage) &&
                               gHasIntegratedMailClient;
      gContextMenu.showItem("context-sendpage", shouldShowSendPage);
   
      gContextMenu.showItem("context-sep-apps", gContextMenu.shouldShowSeparator("context-sep-apps"));
    }
      
    function initMailContextMenuPopupListener(aEvent)
    {
      var popup = document.getElementById("contentAreaContextMenu");
      if (popup)
        popup.addEventListener("popupshowing", initMailContextMenuItems, false);
    }

    function hideMenuitems() {
      document.getElementById("menu_newCard").hidden = !gHasIntegratedMailClient;
      var menu_sendPage = document.getElementById("menu_sendPage");
      if (menu_sendPage)
        menu_sendPage.hidden = !gHasIntegratedMailClient;
    }

    function initOverlay(aEvent) {
      initMailContextMenuPopupListener(aEvent);
      hideMenuitems();
    }

    addEventListener("load", initOverlay, false);
  ]]>
  </script>         

  <!-- navigator specific commands -->
  <commandset id="tasksCommands">
    <command id="cmd_newMessage" oncommand="goOpenNewMessage();"/>
    <command id="cmd_newCard" oncommand="openNewCardDialog()"/>
    <command id="cmd_sendPage" oncommand="sendPage();"/>
    <command id="Browser:SendLink" oncommand="sendLink();"/>
  </commandset>
  <keyset id="tasksKeys">
    <key id="key_newMessage" key="&newMessageCmd.key;" command="cmd_newMessage" modifiers="accel"/>
  </keyset>
         
  <!-- navigator specific UI items -->
  <menupopup id="menu_NewPopup">
    <menuitem id="menu_newCard"
              label="&newCardCmd.label;"
              accesskey="&newCardCmd.accesskey;"
              command="cmd_newCard"
              insertafter="navBeginGlobalNewItems"/>
    <menuitem id="menu_newMessage"
              label="&newMessageCmd.label;"
              accesskey="&newMessageCmd.accesskey;"
              command="cmd_newMessage"
              key="key_newMessage"           
              insertafter="navBeginGlobalNewItems"/>
  </menupopup>

  <menupopup id="menu_FilePopup">
    <menuitem id="menu_sendPage"
              label="&sendPage.label;"
              accesskey="&sendPage.accesskey;"
              command="cmd_sendPage"
              position="9"/>
    <menuitem id="menu_sendLink"
              label="&sendLinkCmd.label;"
              accesskey="&sendLinkCmd.accesskey;"
              command="Browser:SendLink"
              position="10"/>
  </menupopup>

  <popup id="contentAreaContextMenu">
    <menuitem id="context-sendpage"
              label="&contextSendThisPage.label;"
              accesskey="&contextSendThisPage.accesskey;"
              oncommand="sendPage();"
              insertafter="context-savepage"/>
    <menuitem id="context-sendimage"
              label="&contextSendImage.label;"
              accesskey="&contextSendImage.accesskey;"
              oncommand="sendImage(gContextMenu.imageURL);"
              insertafter="context-saveimage"/>
    <menuitem id="context-sendlink"
              label="&contextSendThisLink.label;"
              accesskey="&contextSendThisLink.accesskey;"
              oncommand="sendLink(gContextMenu.linkURL());"
              insertafter="context-savelink"/>
    <menu id="frame">
    <menupopup id="frame_popup">
      <menuitem insertafter="saveframeas"
                label="&contextSendFrame.label;"
                accesskey="&contextSendFrame.accesskey;"
                oncommand="sendPage(gContextMenu.target.ownerDocument);"/>
    </menupopup>
    </menu>
  </popup>
  
</overlay>