RetroZilla/mailnews/base/resources/content/mailTasksOverlay.xul
2015-10-20 23:03:22 -04:00

107 lines
4.2 KiB
XML

<?xml version="1.0"?>
<!DOCTYPE overlay [
<!ENTITY % mailTasksOverlayDTD SYSTEM "chrome://messenger/locale/mailTasksOverlay.dtd" >
%mailTasksOverlayDTD;
]>
<overlay id="mailPrefsOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript">
<![CDATA[
// uses "toOpenWindowByType" function provided by utilityOverlay.js
// which is included by most clients.
function toMessengerWindow()
{
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var windowDoc = "chrome://messenger/content/messenger.xul";
try
{
var layoutType = pref.getIntPref("mail.pane_config");
windowDoc = !layoutType ? "chrome://messenger/content/messenger.xul" :
"chrome://messenger/content/mail3PaneWindowVertLayout.xul";
}
catch(ex)
{
}
toOpenWindowByType("mail:3pane", windowDoc);
}
function toAddressBook()
{
toOpenWindowByType("mail:addressbook", "chrome://messenger/content/addressbook/addressbook.xul");
}
function toNewsgroups()
{
dump ("Sorry, command not implemented.\n");
}
function toImport()
{
window.openDialog("chrome://messenger/content/importDialog.xul","importDialog","chrome, modal, titlebar", {importType: "addressbook"});
}
const biffObserver =
{
observe: function observe(subject, topic, state)
{
// sanity check
if (topic == "mail:biff-state-changed") {
var biffManager = Components.classes["@mozilla.org/messenger/statusBarBiffManager;1"].getService(Components.interfaces.nsIStatusBarBiffManager);
document.getElementById("mini-mail").setAttribute("BiffState", ["NewMail", "NoMail", "UnknownMail"][biffManager.biffState]);
}
}
}
function mailTasksOnUnload(aEvent)
{
var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
observerService.removeObserver(biffObserver, "mail:biff-state-changed");
}
function mailTasksOnLoad(aEvent)
{
if (!document.getElementById('mini-mail')) return;
var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
observerService.addObserver(biffObserver, "mail:biff-state-changed", false);
biffObserver.observe(null, "mail:biff-state-changed", null);
addEventListener("unload", mailTasksOnUnload, false);
}
addEventListener("load", mailTasksOnLoad, false);
]]>
</script>
<keyset id="tasksKeys">
<key id="key_mail" key="&messengerCmd.commandkey;" command="Tasks:Mail" modifiers="accel"/>
<key id="key_addressbook" key="&addressBookCmd.commandkey;" command="Tasks:AddressBook" modifiers="accel"/>
</keyset>
<commandset id="tasksCommands">
<command id="Tasks:Mail" oncommand="toMessengerWindow();"/>
<command id="Tasks:AddressBook" oncommand="toAddressBook();"/>
</commandset>
<statusbarpanel id="component-bar">
<toolbarbutton class="taskbutton" id="mini-mail" oncommand="toMessengerWindow()"
position="2" tooltiptext="&taskMessenger.tooltip;"/>
<toolbarbutton id="mini-comp" insertafter="mini-mail"/>
<toolbarbutton class="taskbutton" id="mini-addr" oncommand="toAddressBook();"
insertafter="mini-comp" tooltiptext="&taskAddressBook.tooltip;"/>
</statusbarpanel>
<menupopup id="windowPopup">
<menuitem accesskey="&messengerCmd.accesskey;" label="&messengerCmd.label;" key="key_mail" command="Tasks:Mail" id="tasksMenuMail" insertafter="tasksMenuNavigator" class="menuitem-iconic icon-mail16 menu-iconic"/>
<menuitem id="tasksMenuEditor" insertafter="tasksMenuMail"/>
<menuitem label="&addressBookCmd.label;" accesskey="&addressBookCmd.accesskey;" key="key_addressbook" command="Tasks:AddressBook" id="tasksMenuAddressBook" insertafter="tasksMenuEditor" class="menuitem-iconic icon-addressbook16 menu-iconic"/>
</menupopup>
</overlay>