gecko-dev/mailnews/base/resources/content/mailNavigatorOverlay.xul

78 lines
2.9 KiB
XML

<?xml version="1.0"?>
<!-- retrieve generic commands -->
<?xul-overlay href="chrome://messenger/content/mailOverlay.xul"?>
<!DOCTYPE window SYSTEM "chrome://messenger/locale/mailNavigatorOverlay.dtd" >
<overlay id="mailNavigatorOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript">
<![CDATA[
function getCurrentIdentityKey()
{
try
{
var cwindowManager = Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'].getService();
var iwindowManager = Components.interfaces.nsIWindowMediator;
var windowManager = cwindowManager.QueryInterface(iwindowManager);
var mailWindow = windowManager.getMostRecentWindow('mail:3pane');
var folder = mailWindow.GetFirstSelectedMsgFolder();
var server = folder.server;
var identity = mailWindow.getIdentityForServer(server);
return identity.key;
}
catch(ex) {
return null;
}
}
function sendLink(pageUrl, pageTitle)
{
var currentIdentity = getCurrentIdentityKey();
var args = "body='" + pageUrl + "',subject='" + pageTitle +"',bodyislink=true";
if (currentIdentity)
args += ",preselectid='" + currentIdentity+ "'";
window.openDialog( "chrome://messenger/content/messengercompose/messengercompose.xul", "_blank",
"chrome,all,dialog=no", args);
}
function sendPage()
{
var currentIdentity = getCurrentIdentityKey();
var pageUrl = window._content.location.href;
var pageTitle = window._content.document.title;
var args = "attachment='" + pageUrl.replace(/\,/g, "%2C") + "',body='" + pageUrl +"',subject='" + pageTitle + "',bodyislink=true";
if (currentIdentity)
args += ",preselectid='" + currentIdentity+ "'";
window.openDialog( "chrome://messenger/content/messengercompose/messengercompose.xul", "_blank",
"chrome,all,dialog=no", args);
}
]]>
</script>
<!-- navigator specific commands -->
<commandset id="tasksCommands">
<command id="cmd_sendPage" oncommand="sendPage();"/>
<command id="Browser:SendLink" oncommand="sendLink(window._content.location.href, window._content.document.title);"/>
</commandset>
<!-- navigator specific UI items -->
<menupopup id="menu_NewPopup">
<menuitem id="menu_newCard" position="3"/>
<menuitem id="menu_newMessage" position="2"/>
</menupopup>
<menupopup id="menu_FilePopup">
<menuitem id="menu_sendPage" label="&sendPage.label;" accesskey="&sendPage.accesskey;" command="cmd_sendPage" position="11"/>
<menuitem id="menu_sendLink" label="&sendLinkCmd.label;" accesskey="&sendLinkCmd.accesskey;" command="Browser:SendLink" position="12"/>
</menupopup>
</overlay>