Minotaur base

This commit is contained in:
mscott%netscape.com 2003-04-05 07:27:20 +00:00
parent ab79cda8b9
commit 4c9c428741
11 changed files with 3563 additions and 236 deletions

View File

@ -0,0 +1,205 @@
<?xml version="1.0"?>
<!--
The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
-->
<?xml-stylesheet href="chrome://messenger/skin/searchDialog.css" type="text/css"?>
<?xul-overlay href="chrome://messenger/content/threadPane.xul"?>
<?xul-overlay href="chrome://messenger/content/searchTermOverlay.xul"?>
<?xul-overlay href="chrome://messenger/content/msgFolderPickerOverlay.xul"?>
<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>
<?xul-overlay href="chrome://messenger/content/platformMailnewsOverlay.xul"?>
<!DOCTYPE window SYSTEM "chrome://messenger/locale/SearchDialog.dtd" >
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:nc="http://home.netscape.com/NC-rdf#"
onload="searchOnLoad();"
onunload="searchOnUnload();"
onclose="onSearchStop();"
windowtype="mailnews:search"
title="&searchDialogTitle.label;"
width="640" height="470"
persist="screenX screenY width height">
<stringbundle id="bundle_search" src="chrome://messenger/locale/search.properties"/>
<stringbundle id="bundle_messenger" src="chrome://messenger/locale/messenger.properties"/>
<stringbundle id="bundle_brand" src="chrome://global/locale/brand.properties"/>
<!-- XXX: only mailWidgets.xml requires strres.js (<script> isn't valid in XBL yet - see hyatt)-->
<script type="application/x-javascript" src="chrome://global/content/strres.js"/>
<script src="chrome://messenger/content/mailWindow.js"/>
<script src="chrome://messenger/content/threadPane.js"/>
<script src="chrome://messenger/content/msgMail3PaneWindow.js"/>
<script src="chrome://global/content/globalOverlay.js"/>
<script src="chrome://messenger/content/mailCommands.js"/>
<script src="chrome://messenger/content/mailWindowOverlay.js"/>
<script src="chrome://messenger/content/commandglue.js"/>
<script src="chrome://messenger/content/SearchDialog.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/messengerdnd.js"/>
<script type="application/x-javascript" src="chrome://help/content/contextHelp.js"/>
<commands id="commands">
<commandset id="mailSearchItems"
commandupdater="true"
events="mail-search"
oncommandupdate="goUpdateSearchItems(this)">
<command id="cmd_open" oncommand="goDoCommand('cmd_open')" disabled="true"/>
<command id="button_delete" oncommand="goDoCommand('button_delete')" disabled="true"/>
<command id="goto_folder_button" oncommand="goDoCommand('goto_folder_button')" disabled="true"/>
<command id="file_message_button"/>
<command id="cmd_delete"/>
</commandset>
</commands>
<keyset id="mailKeys">
<key id="key_delete" oncommand="goDoCommand('cmd_delete');"/>
<key id="cmd_shiftDelete" oncommand="goDoCommand('cmd_shiftDelete');"/>
</keyset>
<broadcasterset id="mailBroadcasters">
<broadcaster id="Communicator:WorkMode"/>
</broadcasterset>
<dummy class="usesMailWidgets"/>
<vbox flex="1">
<vbox>
<hbox align="center">
<label value="&searchHeading.label;" accesskey="&searchHeading.accesskey;"
control="searchableFolders"/>
<menulist id="searchableFolders" flex="2"/>
<spacer flex="10"/>
<button label="&searchButton.label;" id="search-button" oncommand="onSearchButton(event);" default="true" accesskey="&searchButton.accesskey;"/>
</hbox>
<hbox align="center">
<spacer flex="2"/>
<button label="&resetButton.label;" oncommand="onResetSearch(event);" accesskey="&resetButton.accesskey;"/>
</hbox>
<hbox align="center">
<checkbox id="checkSearchSubFolders" label="&searchSubfolders.label;" checked="true" accesskey="&searchSubfolders.accesskey;"/>
<spacer flex="2"/>
<button label="&helpButton.label;" align="end" oncommand="openHelp('search_messages');" accesskey="&helpButton.accesskey;"/>
</hbox>
</vbox>
<hbox flex="1">
<vbox id="searchTermListBox" flex="1"/>
</hbox>
</vbox>
<splitter id="gray_horizontal_splitter" collapse="after" persist="state">
<grippy/>
</splitter>
<vbox flex="1">
<vbox id="searchResultListBox" flex="1" >
<tree id="threadTree" flex="1" context="threadPaneContext"/>
</vbox>
<hbox align="start">
<button label="&openButton.label;" id="openButton" command="cmd_open" accesskey="&openButton.accesskey;"/>
<button id="fileMessageButton" type="menu" label="&fileButton.label;"
accesskey="&fileButton.accesskey;"
observes="file_message_button"
oncommand="MoveMessageInSearch(event.target)"
sortResource="http://home.netscape.com/NC-rdf#FolderTreeName"
sortDirection="ascending"
datasources="rdf:msgaccountmanager rdf:mailnewsfolders"
ref="msgaccounts:/">
<menupopup/>
<template>
<rule nc:NoSelect="true" iscontainer="true" isempty="false">
<menupopup>
<menu uri="..." class="folderMenuItem menu-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name">
<menupopup>
<menuitem label="&fileHereMenu.label;" accesskey="&fileHereMenu.accesskey;" disabled="true"/>
<menuseparator/>
</menupopup>
</menu>
</menupopup>
</rule>
<rule nc:NoSelect="true">
<menupopup>
<menuitem uri="..." class="folderMenuItem menu-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name" disabled="true"/>
</menupopup>
</rule>
<rule nc:CanFileMessages="true" iscontainer="true" isempty="false">
<menupopup>
<menu uri="..." class="folderMenuItem menu-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name"
SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
<menupopup>
<menuitem file-uri="..." label="&fileHereMenu.label;" accesskey="&fileHereMenu.accesskey;" />
<menuseparator/>
</menupopup>
</menu>
</menupopup>
</rule>
<rule nc:CanFileMessagesOnServer="false">
<!-- don't show servers (nntp & any others) which does not allow message filing -->
<!-- File, Move & Copy menus -->
</rule>
<rule nc:CanFileMessages="false" iscontainer="true" isempty="false">
<!-- note, there is no "file here" -->
<menupopup>
<menu uri="..." class="folderMenuItem menu-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name"
SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
<menupopup/>
</menu>
</menupopup>
</rule>
<rule nc:CanFileMessages="true">
<menupopup>
<menuitem uri="..." class="folderMenuItem menuitem-iconic" label="rdf:http://home.netscape.com/NC-rdf#Name"
SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState"
IsServer="rdf:http://home.netscape.com/NC-rdf#IsServer"
IsSecure="rdf:http://home.netscape.com/NC-rdf#IsSecure"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"/>
</menupopup>
</rule>
</template>
</button>
<button label="&deleteButton.label;" id="deleteButton" command="button_delete" accesskey="&deleteButton.accesskey;"/>
<button label="&goToFolderButton.label;" id="goToFolderButton" command="goto_folder_button" accesskey="&goToFolderButton.accesskey;" />
<spacer flex="1" />
</hbox>
</vbox>
<statusbar class="chromeclass-status" id="status-bar">
<statusbarpanel class="statusbarpanel-progress">
<progressmeter class="progressmeter-statusbar" id="statusbar-icon" mode="normal" value="0" oncommand="dumpProgress()"/>
</statusbarpanel>
<statusbarpanel id="statusText" crop="right" flex="1"/>
</statusbar>
</window>

View File

@ -5,64 +5,73 @@
<!-- list all the packages being supplied by this jar -->
<RDF:Seq about="urn:mozilla:package:root">
<RDF:li resource="urn:mozilla:package:mail"/>
<RDF:li resource="urn:mozilla:package:messenger"/>
</RDF:Seq>
<!-- package information -->
<RDF:Description about="urn:mozilla:package:mail"
<RDF:Description about="urn:mozilla:package:messenger"
chrome:displayName="Messenger"
chrome:author="mozilla.org"
chrome:name="mail"
chrome:localeVersion="1.2a"
chrome:name="messenger"
chrome:localeVersion="1.4a"
chrome:skinVersion="1.2">
</RDF:Description>
<!-- overlay information -->
<RDF:Seq about="urn:mozilla:overlays">
<RDF:li resource="chrome://communicator/content/pref/preftree.xul"/>
<RDF:li resource="chrome://communicator/content/pref/pref-appearance.xul"/>
<RDF:li resource="chrome://communicator/content/pref/pref-scripts.xul"/>
<RDF:li resource="chrome://cookie/content/pref-cookies.xul"/>
<RDF:li resource="chrome://cookie/content/pref-images.xul"/>
<RDF:li resource="chrome://mail/content/addressbook/addressbook.xul"/>
<RDF:li resource="chrome://mail/content/addressbook/abSelectAddressesDialog.xul"/>
<RDF:li resource="chrome://messenger/content/messenger.xul"/>
<RDF:li resource="chrome://messenger/content/mail3PaneWindowVertLayout.xul"/>
<RDF:li resource="chrome://messenger/content/messengercompose/messengercompose.xul"/>
<RDF:li resource="chrome://messenger/content/addressbook/addressbook.xul"/>
<RDF:li resource="chrome://messenger/content/addressbook/abSelectAddressesDialog.xul"/>
</RDF:Seq>
<!-- messenger preferences branches -->
<RDF:Seq about="chrome://communicator/content/pref/preftree.xul">
<RDF:li>chrome://mail/content/mailPrefsOverlay.xul</RDF:li>
</RDF:Seq>
<!-- messenger startup pref -->
<RDF:Seq about="chrome://communicator/content/pref/pref-appearance.xul">
<RDF:li>chrome://mail/content/mailPrefsOverlay.xul</RDF:li>
<RDF:li>chrome://messenger/content/mailPrefsOverlay.xul</RDF:li>
</RDF:Seq>
<!-- messenger js toggle pref -->
<RDF:Seq about="chrome://communicator/content/pref/pref-scripts.xul">
<RDF:li>chrome://mail/content/mailPrefsOverlay.xul</RDF:li>
<RDF:li>chrome://messenger/content/mailPrefsOverlay.xul</RDF:li>
</RDF:Seq>
<!-- messenger cookie toggle pref -->
<RDF:Seq about="chrome://cookie/content/pref-cookies.xul">
<RDF:li>chrome://mail/content/mailPrefsOverlay.xul</RDF:li>
<RDF:li>chrome://messenger/content/mailPrefsOverlay.xul</RDF:li>
</RDF:Seq>
<!-- messenger image toggle pref -->
<RDF:Seq about="chrome://cookie/content/pref-images.xul">
<RDF:li>chrome://mail/content/mailPrefsOverlay.xul</RDF:li>
<RDF:li>chrome://messenger/content/mailPrefsOverlay.xul</RDF:li>
</RDF:Seq>
<!-- messenger items for Messenger -->
<RDF:Seq about="chrome://messenger/content/messenger.xul">
<RDF:li>chrome://messenger/content/mailMessengerOverlay.xul</RDF:li>
</RDF:Seq>
<RDF:Seq about="chrome://messenger/content/mail3PaneWindowVertLayout.xul">
<RDF:li>chrome://messenger/content/mailMessengerOverlay.xul</RDF:li>
</RDF:Seq>
<!-- messenger items for Mail Compose -->
<RDF:Seq about="chrome://messenger/content/messengercompose/messengercompose.xul">
<RDF:li>chrome://messenger/content/mailMessengerComposeOverlay.xul</RDF:li>
</RDF:Seq>
<!-- messenger items for Addressbook -->
<RDF:Seq about="chrome://mail/content/addressbook/addressbook.xul">
<RDF:li>chrome://mail/content/mailABOverlay.xul</RDF:li>
<RDF:Seq about="chrome://messenger/content/addressbook/addressbook.xul">
<RDF:li>chrome://messenger/content/mailABOverlay.xul</RDF:li>
</RDF:Seq>
<!-- messenger items for Select Addresses dialog -->
<RDF:Seq about="chrome://mail/content/addressbook/abSelectAddressesDialog.xul">
<RDF:li>chrome://mail/content/mailOverlay.xul</RDF:li>
<RDF:Seq about="chrome://messenger/content/addressbook/abSelectAddressesDialog.xul">
<RDF:li>chrome://messenger/content/mailOverlay.xul</RDF:li>
</RDF:Seq>
</RDF:RDF>

View File

@ -0,0 +1,47 @@
/*
The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is David Hyatt.
Portions created by David Hyatt are
Copyright (C) 2002 David Hyatt. All
Rights Reserved.
Contributor(s):
David Hyatt (hyatt@apple.com)
Blake Ross (blaker@netscape.com)
*/
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to XUL */
@namespace html url("http://www.w3.org/1999/xhtml"); /* namespace for HTML elements */
#palette-box {
overflow: auto;
margin: 0px 15px 10px 15px;
}
#palette-box > hbox > toolbarpaletteitem {
padding-top: 4px;
padding-bottom: 4px;
}
#palette-box > hbox {
}
#main-box {
border-right: 3px solid #7B969C;
border-bottom: 3px solid #7B969C;
border-left: 3px solid #7B969C;
border-style: outset;
}

View File

@ -0,0 +1,917 @@
/*
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is Mozilla Communicator client code, released
# March 31, 1998.
#
# The Initial Developer of the Original Code is David Hyatt.
# Portions created by David Hyatt are
# Copyright (C) 2002 David Hyatt. All
# Rights Reserved.
#
# Contributor(s):
# David Hyatt (hyatt@apple.com)
# Blake Ross (blaker@netscape.com)
# Joe Hewitt (hewitt@netscape.com)
*/
const kRowMax = 4;
const kWindowWidth = 600;
const kWindowHeight = 400;
const kAnimateIncrement = 50;
const kAnimateSteps = kWindowHeight / kAnimateIncrement - 1;
var gToolboxDocument = null;
var gToolbox = null;
var gCurrentDragOverItem = null;
var gToolboxChanged = false;
function onLoad()
{
gToolbox = window.arguments[0];
gToolboxDocument = gToolbox.ownerDocument;
gToolbox.addEventListener("draggesture", onToolbarDragGesture, false);
gToolbox.addEventListener("dragover", onToolbarDragOver, false);
gToolbox.addEventListener("dragexit", onToolbarDragExit, false);
gToolbox.addEventListener("dragdrop", onToolbarDragDrop, false);
document.documentElement.setAttribute("hidechrome", "true");
repositionDialog();
window.outerWidth = kWindowWidth;
window.outerHeight = 50;
slideOpen(0);
}
function onUnload(aEvent)
{
removeToolboxListeners();
unwrapToolbarItems();
persistCurrentSets();
notifyParentComplete();
}
function onAccept(aEvent)
{
document.getElementById("main-box").collapsed = true;
slideClosed(0);
}
function initDialog()
{
document.getElementById("main-box").collapsed = false;
var mode = gToolbox.getAttribute("mode");
document.getElementById("modelist").value = mode;
var iconSize = gToolbox.getAttribute("iconsize");
var smallIconsCheckbox = document.getElementById("smallicons");
if (mode == "text")
smallIconsCheckbox.disabled = true;
else
smallIconsCheckbox.checked = iconSize == "small";
// Build up the palette of other items.
buildPalette();
// Wrap all the items on the toolbar in toolbarpaletteitems.
wrapToolbarItems();
}
function slideOpen(aStep)
{
if (aStep < kAnimateSteps) {
window.outerHeight += kAnimateIncrement;
setTimeout(slideOpen, 20, ++aStep);
} else {
initDialog();
}
}
function slideClosed(aStep)
{
if (aStep < kAnimateSteps) {
window.outerHeight -= kAnimateIncrement;
setTimeout(slideClosed, 10, ++aStep);
} else {
window.close();
}
}
function repositionDialog()
{
// Position the dialog touching the bottom of the toolbox and centered with it
var screenX = gToolbox.boxObject.screenX + ((gToolbox.boxObject.width - kWindowWidth) / 2);
var screenY = gToolbox.boxObject.screenY + gToolbox.boxObject.height;
window.moveTo(screenX, screenY);
}
function removeToolboxListeners()
{
gToolbox.removeEventListener("draggesture", onToolbarDragGesture, false);
gToolbox.removeEventListener("dragover", onToolbarDragOver, false);
gToolbox.removeEventListener("dragexit", onToolbarDragExit, false);
gToolbox.removeEventListener("dragdrop", onToolbarDragDrop, false);
}
/**
* Invoke a callback on the toolbox to notify it that the dialog is done
* and going away.
*/
function notifyParentComplete()
{
if ("customizeDone" in gToolbox)
gToolbox.customizeDone(gToolboxChanged);
}
function getToolbarAt(i)
{
return gToolbox.childNodes[i];
}
/**
* Persist the current set of buttons in all customizable toolbars to
* localstore.
*/
function persistCurrentSets()
{
if (!gToolboxChanged)
return;
var customCount = 0;
for (var i = 0; i < gToolbox.childNodes.length; ++i) {
// Look for customizable toolbars that need to be persisted.
var toolbar = getToolbarAt(i);
if (isCustomizableToolbar(toolbar)) {
// Calculate currentset and store it in the attribute.
var currentSet = toolbar.currentSet;
toolbar.setAttribute("currentset", currentSet);
var customIndex = toolbar.hasAttribute("customindex");
if (customIndex) {
if (!toolbar.firstChild) {
// Remove custom toolbars whose contents have been removed.
gToolbox.removeChild(toolbar);
--i;
} else {
// Persist custom toolbar info on the <toolbarset/>
gToolbox.toolbarset.setAttribute("toolbar"+(++customCount),
toolbar.toolbarName + ":" + currentSet);
gToolboxDocument.persist(gToolbox.toolbarset.id, "toolbar"+customCount);
}
}
if (!customIndex) {
// Persist the currentset attribute directly on hardcoded toolbars.
gToolboxDocument.persist(toolbar.id, "currentset");
}
}
}
// Remove toolbarX attributes for removed toolbars.
while (gToolbox.toolbarset.hasAttribute("toolbar"+(++customCount))) {
gToolbox.toolbarset.removeAttribute("toolbar"+customCount);
gToolboxDocument.persist(gToolbox.toolbarset.id, "toolbar"+customCount);
}
}
/**
* Wraps all items in all customizable toolbars in a toolbox.
*/
function wrapToolbarItems()
{
for (var i = 0; i < gToolbox.childNodes.length; ++i) {
var toolbar = getToolbarAt(i);
if (isCustomizableToolbar(toolbar)) {
for (var k = 0; k < toolbar.childNodes.length; ++k) {
var item = toolbar.childNodes[k];
if (isToolbarItem(item)) {
var nextSibling = item.nextSibling;
var wrapper = wrapToolbarItem(item);
if (nextSibling)
toolbar.insertBefore(wrapper, nextSibling);
else
toolbar.appendChild(wrapper);
}
}
}
}
}
/**
* Unwraps all items in all customizable toolbars in a toolbox.
*/
function unwrapToolbarItems()
{
for (var i = 0; i < gToolbox.childNodes.length; ++i) {
var toolbar = getToolbarAt(i);
if (isCustomizableToolbar(toolbar)) {
for (var k = 0; k < toolbar.childNodes.length; ++k) {
var paletteItem = toolbar.childNodes[k];
var toolbarItem = paletteItem.firstChild;
if (isToolbarItem(toolbarItem)) {
var nextSibling = paletteItem.nextSibling;
if (paletteItem.hasAttribute("itemcommand"))
toolbarItem.setAttribute("command", paletteItem.getAttribute("itemcommand"));
if (paletteItem.hasAttribute("itemobserves"))
toolbarItem.setAttribute("observes", paletteItem.getAttribute("itemobserves"));
paletteItem.removeChild(toolbarItem);
paletteItem.parentNode.removeChild(paletteItem);
if (nextSibling)
toolbar.insertBefore(toolbarItem, nextSibling);
else
toolbar.appendChild(toolbarItem);
}
}
}
}
}
/**
* Creates a wrapper that can be used to contain a toolbaritem and prevent
* it from receiving UI events.
*/
function createWrapper(aId)
{
var wrapper = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"toolbarpaletteitem");
wrapper.id = "wrapper-"+aId;
return wrapper;
}
/**
* Wraps an item that has been cloned from a template and adds
* it to the end of a row in the palette.
*/
function wrapPaletteItem(aPaletteItem, aCurrentRow, aSpacer)
{
var wrapper = createWrapper(aPaletteItem.id);
wrapper.setAttribute("flex", 1);
wrapper.setAttribute("align", "center");
wrapper.setAttribute("pack", "center");
wrapper.setAttribute("minheight", "0");
wrapper.setAttribute("minwidth", "0");
wrapper.appendChild(aPaletteItem);
// XXX We need to call this AFTER the palette item has been appended
// to the wrapper or else we crash dropping certain buttons on the
// palette due to removal of the command and disabled attributes - JRH
cleanUpItemForPalette(aPaletteItem, wrapper);
if (aSpacer)
aCurrentRow.insertBefore(wrapper, aSpacer);
else
aCurrentRow.appendChild(wrapper);
}
/**
* Wraps an item that is currently on a toolbar and replaces the item
* with the wrapper. This is not used when dropping items from the palette,
* only when first starting the dialog and wrapping everything on the toolbars.
*/
function wrapToolbarItem(aToolbarItem)
{
var wrapper = createWrapper(aToolbarItem.id);
cleanupItemForToolbar(aToolbarItem, wrapper);
wrapper.flex = aToolbarItem.flex;
if (aToolbarItem.parentNode)
aToolbarItem.parentNode.removeChild(aToolbarItem);
wrapper.appendChild(aToolbarItem);
return wrapper;
}
/**
* Get the list of ids for the current set of items on each toolbar.
*/
function getCurrentItemIds()
{
var currentItems = {};
for (var i = 0; i < gToolbox.childNodes.length; ++i) {
var toolbar = getToolbarAt(i);
if (isCustomizableToolbar(toolbar)) {
var child = toolbar.firstChild;
while (child) {
if (isToolbarItem(child))
currentItems[child.id] = 1;
child = child.nextSibling;
}
}
}
return currentItems;
}
/**
* Builds the palette of draggable items that are not yet in a toolbar.
*/
function buildPalette()
{
// Empty the palette first.
var paletteBox = document.getElementById("palette-box");
while (paletteBox.lastChild)
paletteBox.removeChild(paletteBox.lastChild);
var currentRow = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"hbox");
currentRow.setAttribute("class", "paletteRow");
// Add the toolbar separator item.
var templateNode = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"toolbarseparator");
templateNode.id = "separator";
wrapPaletteItem(templateNode, currentRow, null);
// Add the toolbar spring item.
templateNode = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"toolbarspring");
templateNode.id = "spring";
templateNode.flex = 1;
wrapPaletteItem(templateNode, currentRow, null);
// Add the toolbar spacer item.
templateNode = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"toolbarspacer");
templateNode.id = "spacer";
templateNode.flex = 1;
wrapPaletteItem(templateNode, currentRow, null);
var rowSlot = 3;
var currentItems = getCurrentItemIds();
templateNode = gToolbox.palette.firstChild;
while (templateNode) {
// Check if the item is already in a toolbar before adding it to the palette.
if (!(templateNode.id in currentItems)) {
var paletteItem = templateNode.cloneNode(true);
if (rowSlot == kRowMax) {
// Append the old row.
paletteBox.appendChild(currentRow);
// Make a new row.
currentRow = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"hbox");
currentRow.setAttribute("class", "paletteRow");
rowSlot = 0;
}
++rowSlot;
wrapPaletteItem(paletteItem, currentRow, null);
}
templateNode = templateNode.nextSibling;
}
if (currentRow) {
fillRowWithFlex(currentRow);
paletteBox.appendChild(currentRow);
}
}
/**
* Creates a new palette item for a cloned template node and
* adds it to the last slot in the palette.
*/
function appendPaletteItem(aItem)
{
var paletteBox = document.getElementById("palette-box");
var lastRow = paletteBox.lastChild;
var lastSpacer = lastRow.lastChild;
if (lastSpacer.localName != "spacer") {
// The current row is full, so we have to create a new row.
lastRow = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"hbox");
lastRow.setAttribute("class", "paletteRow");
paletteBox.appendChild(lastRow);
wrapPaletteItem(aItem, lastRow, null);
fillRowWithFlex(lastRow);
} else {
// Decrement the flex of the last spacer or remove it entirely.
var flex = lastSpacer.getAttribute("flex");
if (flex == 1) {
lastRow.removeChild(lastSpacer);
lastSpacer = null;
} else
lastSpacer.setAttribute("flex", --flex);
// Insert the wrapper where the last spacer was.
wrapPaletteItem(aItem, lastRow, lastSpacer);
}
}
function fillRowWithFlex(aRow)
{
var remainingFlex = kRowMax - aRow.childNodes.length;
if (remainingFlex > 0) {
var spacer = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"spacer");
spacer.setAttribute("flex", remainingFlex);
aRow.appendChild(spacer);
}
}
/**
* Makes sure that an item that has been cloned from a template
* is stripped of all properties that may adversely affect it's
* appearance in the palette.
*/
function cleanUpItemForPalette(aItem, aWrapper)
{
aWrapper.setAttribute("place", "palette");
setWrapperType(aItem, aWrapper);
if (aItem.hasAttribute("title"))
aWrapper.setAttribute("title", aItem.getAttribute("title"));
else if (isSpecialItem(aItem)) {
var stringBundle = document.getElementById("stringBundle");
var title = stringBundle.getString(aItem.id + "Title");
aWrapper.setAttribute("title", title);
}
// Remove attributes that screw up our appearance.
aItem.removeAttribute("command");
aItem.removeAttribute("observes");
aItem.removeAttribute("disabled");
aItem.removeAttribute("type");
if (aItem.localName == "toolbaritem" && aItem.firstChild) {
aItem.firstChild.removeAttribute("observes");
// So the throbber doesn't throb in the dialog,
// cute as that may be...
aItem.firstChild.removeAttribute("busy");
}
}
/**
* Makes sure that an item that has been cloned from a template
* is stripped of all properties that may adversely affect it's
* appearance in the toolbar. Store critical properties on the
* wrapper so they can be put back on the item when we're done.
*/
function cleanupItemForToolbar(aItem, aWrapper)
{
setWrapperType(aItem, aWrapper);
aWrapper.setAttribute("place", "toolbar");
if (aItem.hasAttribute("command")) {
aWrapper.setAttribute("itemcommand", aItem.getAttribute("command"));
aItem.removeAttribute("command");
}
if (aItem.hasAttribute("observes"))
{
aWrapper.setAttribute("itemobserves", aItem.getAttribute("observes"));
aItem.removeAttribute("observes");
}
if (aItem.disabled) {
aWrapper.setAttribute("itemdisabled", "true");
aItem.disabled = false;
}
}
function setWrapperType(aItem, aWrapper)
{
if (aItem.localName == "toolbarseparator") {
aWrapper.setAttribute("type", "separator");
} else if (aItem.localName == "toolbarspring") {
aWrapper.setAttribute("type", "spring");
} else if (aItem.localName == "toolbarspacer") {
aWrapper.setAttribute("type", "spacer");
} else if (aItem.localName == "toolbaritem" && aItem.firstChild) {
aWrapper.setAttribute("type", aItem.firstChild.localName);
}
}
function setDragActive(aItem, aValue)
{
var node = aItem;
var value = "left";
if (aItem.localName == "toolbar") {
node = aItem.lastChild;
value = "right";
}
if (!node)
return;
if (aValue) {
if (!node.hasAttribute("dragover"))
node.setAttribute("dragover", value);
} else {
node.removeAttribute("dragover");
}
}
/**
* Restore the default set of buttons to fixed toolbars,
* remove all custom toolbars, and rebuild the palette.
*/
function restoreDefaultSet()
{
// Restore the defaultset for fixed toolbars.
var toolbar = gToolbox.firstChild;
while (toolbar) {
if (isCustomizableToolbar(toolbar)) {
if (!toolbar.hasAttribute("customindex")) {
var defaultSet = toolbar.getAttribute("defaultset");
if (defaultSet)
{
toolbar.currentSet = defaultSet;
}
}
}
toolbar = toolbar.nextSibling;
}
// Remove all of the customized toolbars.
var child = gToolbox.lastChild;
while (child) {
if (child.hasAttribute("customindex")) {
var thisChild = child;
child = child.previousSibling;
gToolbox.removeChild(thisChild);
} else {
child = child.previousSibling;
}
}
// Now rebuild the palette.
buildPalette();
// Now re-wrap the items on the toolbar.
wrapToolbarItems();
repositionDialog();
gToolboxChanged = true;
}
function updateIconSize(aUseSmallIcons)
{
var val = aUseSmallIcons ? "small" : null;
setAttribute(gToolbox, "iconsize", val);
gToolboxDocument.persist(gToolbox.id, "iconsize");
for (var i = 0; i < gToolbox.childNodes.length; ++i) {
var toolbar = getToolbarAt(i);
if (isCustomizableToolbar(toolbar)) {
setAttribute(toolbar, "iconsize", val);
gToolboxDocument.persist(toolbar.id, "iconsize");
}
}
repositionDialog();
}
function updateToolbarMode(aModeValue)
{
setAttribute(gToolbox, "mode", aModeValue);
gToolboxDocument.persist(gToolbox.id, "mode");
for (var i = 0; i < gToolbox.childNodes.length; ++i) {
var toolbar = getToolbarAt(i);
if (isCustomizableToolbar(toolbar)) {
setAttribute(toolbar, "mode", aModeValue);
gToolboxDocument.persist(toolbar.id, "mode");
}
}
var iconSizeCheckbox = document.getElementById("smallicons");
if (aModeValue == "text") {
iconSizeCheckbox.disabled = true;
iconSizeCheckbox.checked = false;
updateIconSize(false);
}
else {
iconSizeCheckbox.disabled = false;
}
repositionDialog();
}
function setAttribute(aElt, aAttr, aVal)
{
if (aVal)
aElt.setAttribute(aAttr, aVal);
else
aElt.removeAttribute(aAttr);
}
function isCustomizableToolbar(aElt)
{
return aElt.localName == "toolbar" &&
aElt.getAttribute("customizable") == "true";
}
function isSpecialItem(aElt)
{
return aElt.localName == "toolbarseparator" ||
aElt.localName == "toolbarspring" ||
aElt.localName == "toolbarspacer";
}
function isToolbarItem(aElt)
{
return aElt.localName == "toolbarbutton" ||
aElt.localName == "toolbaritem" ||
aElt.localName == "toolbarseparator" ||
aElt.localName == "toolbarspring" ||
aElt.localName == "toolbarspacer";
}
///////////////////////////////////////////////////////////////////////////
//// Drag and Drop observers
function onToolbarDragGesture(aEvent)
{
nsDragAndDrop.startDrag(aEvent, dragStartObserver);
}
function onToolbarDragOver(aEvent)
{
nsDragAndDrop.dragOver(aEvent, toolbarDNDObserver);
}
function onToolbarDragDrop(aEvent)
{
nsDragAndDrop.drop(aEvent, toolbarDNDObserver);
}
function onToolbarDragExit(aEvent)
{
if (gCurrentDragOverItem)
setDragActive(gCurrentDragOverItem, false);
}
var dragStartObserver =
{
onDragStart: function (aEvent, aXferData, aDragAction) {
var documentId = gToolboxDocument.documentElement.id;
var item = aEvent.target;
while (item && item.localName != "toolbarpaletteitem")
item = item.parentNode;
item.setAttribute("dragactive", "true");
aXferData.data = new TransferDataSet();
var data = new TransferData();
data.addDataForFlavour("text/toolbarwrapper-id/"+documentId, item.firstChild.id);
aXferData.data.push(data);
}
}
var toolbarDNDObserver =
{
onDragOver: function (aEvent, aFlavour, aDragSession)
{
var toolbar = aEvent.target;
var dropTarget = aEvent.target;
while (toolbar && toolbar.localName != "toolbar") {
dropTarget = toolbar;
toolbar = toolbar.parentNode;
}
var previousDragItem = gCurrentDragOverItem;
// Make sure we are dragging over a customizable toolbar.
if (!isCustomizableToolbar(toolbar)) {
gCurrentDragOverItem = null;
return;
}
if (dropTarget.localName == "toolbar") {
gCurrentDragOverItem = dropTarget;
} else {
var dropTargetWidth = dropTarget.boxObject.width;
var dropTargetX = dropTarget.boxObject.x;
gCurrentDragOverItem = null;
if (aEvent.clientX > (dropTargetX + (dropTargetWidth / 2))) {
gCurrentDragOverItem = dropTarget.nextSibling;
if (!gCurrentDragOverItem)
gCurrentDragOverItem = toolbar;
} else
gCurrentDragOverItem = dropTarget;
}
if (previousDragItem && gCurrentDragOverItem != previousDragItem) {
setDragActive(previousDragItem, false);
}
setDragActive(gCurrentDragOverItem, true);
aDragSession.canDrop = true;
},
onDrop: function (aEvent, aXferData, aDragSession)
{
if (!gCurrentDragOverItem)
return;
setDragActive(gCurrentDragOverItem, false);
var draggedItemId = aXferData.data;
if (gCurrentDragOverItem.id == draggedItemId)
return;
var toolbar = aEvent.target;
while (toolbar.localName != "toolbar")
toolbar = toolbar.parentNode;
var draggedPaletteWrapper = document.getElementById("wrapper-"+draggedItemId);
if (!draggedPaletteWrapper) {
// The wrapper has been dragged from the toolbar.
// Get the wrapper from the toolbar document and make sure that
// it isn't being dropped on itself.
var wrapper = gToolboxDocument.getElementById("wrapper-"+draggedItemId);
if (wrapper == gCurrentDragOverItem)
return;
// Don't allow static kids (e.g., the menubar) to move.
if (wrapper.parentNode.firstPermanentChild && wrapper.parentNode.firstPermanentChild.id == wrapper.firstChild.id)
return;
if (wrapper.parentNode.lastPermanentChild && wrapper.parentNode.lastPermanentChild.id == wrapper.firstChild.id)
return;
// Remove the item from it's place in the toolbar.
wrapper.parentNode.removeChild(wrapper);
// Determine which toolbar we are dropping on.
var dropToolbar = null;
if (gCurrentDragOverItem.localName == "toolbar")
dropToolbar = gCurrentDragOverItem;
else
dropToolbar = gCurrentDragOverItem.parentNode;
// Insert the item into the toolbar.
if (gCurrentDragOverItem != dropToolbar)
dropToolbar.insertBefore(wrapper, gCurrentDragOverItem);
else
dropToolbar.appendChild(wrapper);
} else {
// The item has been dragged from the palette
// Create a new wrapper for the item. We don't know the id yet.
var wrapper = createWrapper("");
// Ask the toolbar to clone the item's template, place it inside the wrapper, and insert it in the toolbar.
var newItem = toolbar.insertItem(draggedItemId, gCurrentDragOverItem == toolbar ? null : gCurrentDragOverItem, wrapper);
// Prepare the item and wrapper to look good on the toolbar.
cleanupItemForToolbar(newItem, wrapper);
wrapper.id = "wrapper-"+newItem.id;
wrapper.flex = newItem.flex;
// Remove the wrapper from the palette.
var currentRow = draggedPaletteWrapper.parentNode;
if (draggedItemId != "separator" &&
draggedItemId != "spring" &&
draggedItemId != "spacer")
{
currentRow.removeChild(draggedPaletteWrapper);
while (currentRow) {
// Pull the first child of the next row up
// into this row.
var nextRow = currentRow.nextSibling;
if (!nextRow) {
var last = currentRow.lastChild;
var first = currentRow.firstChild;
if (first == last) {
// Kill the row.
currentRow.parentNode.removeChild(currentRow);
break;
}
if (last.localName == "spacer") {
var flex = last.getAttribute("flex");
last.setAttribute("flex", ++flex);
// Reflow doesn't happen for some reason. Trigger it with a hide/show. ICK! -dwh
last.hidden = true;
last.hidden = false;
break;
} else {
// Make a spacer and give it a flex of 1.
var spacer = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"spacer");
spacer.setAttribute("flex", "1");
currentRow.appendChild(spacer);
}
break;
}
currentRow.appendChild(nextRow.firstChild);
currentRow = currentRow.nextSibling;
}
}
}
gCurrentDragOverItem = null;
repositionDialog();
gToolboxChanged = true;
},
_flavourSet: null,
getSupportedFlavours: function ()
{
if (!this._flavourSet) {
this._flavourSet = new FlavourSet();
var documentId = gToolboxDocument.documentElement.id;
this._flavourSet.appendFlavour("text/toolbarwrapper-id/"+documentId);
}
return this._flavourSet;
}
}
var paletteDNDObserver =
{
onDragOver: function (aEvent, aFlavour, aDragSession)
{
aDragSession.canDrop = true;
},
onDrop: function(aEvent, aXferData, aDragSession)
{
var itemId = aXferData.data;
var wrapper = gToolboxDocument.getElementById("wrapper-"+itemId);
if (wrapper) {
// Don't allow static kids (e.g., the menubar) to move.
if (wrapper.parentNode.firstPermanentChild && wrapper.parentNode.firstPermanentChild.id == wrapper.firstChild.id)
return;
if (wrapper.parentNode.lastPermanentChild && wrapper.parentNode.lastPermanentChild.id == wrapper.firstChild.id)
return;
// The item was dragged out of the toolbar.
wrapper.parentNode.removeChild(wrapper);
var wrapperType = wrapper.getAttribute("type");
if (wrapperType != "separator" && wrapperType != "spacer" && wrapperType != "spring") {
// Find the template node in the toolbox palette
var templateNode = gToolbox.palette.firstChild;
while (templateNode) {
if (templateNode.id == itemId)
break;
templateNode = templateNode.nextSibling;
}
if (!templateNode)
return;
// Clone the template and add it to our palette.
var paletteItem = templateNode.cloneNode(true);
appendPaletteItem(paletteItem);
}
}
repositionDialog();
gToolboxChanged = true;
},
_flavourSet: null,
getSupportedFlavours: function ()
{
if (!this._flavourSet) {
this._flavourSet = new FlavourSet();
var documentId = gToolboxDocument.documentElement.id;
this._flavourSet.appendFlavour("text/toolbarwrapper-id/"+documentId);
}
return this._flavourSet;
}
}

View File

@ -0,0 +1,85 @@
<?xml version="1.0"?>
<!--
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is Mozilla Communicator client code, released
# March 31, 1998.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-1999 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
# David Hyatt (hyatt@apple.com)
# Blake Ross (blaker@netscape.com)
-->
<!DOCTYPE dialog [
<!ENTITY % customizeToolbarDTD SYSTEM "chrome://global/locale/customizeToolbar.dtd">
%customizeToolbarDTD;
]>
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://global/content/customizeToolbar.css" type="text/css"?>
<?xml-stylesheet href="chrome://global/skin/customizeToolbar.css" type="text/css"?>
<?xml-stylesheet href="chrome://messenger/skin/primaryToolbar.css" type="text/css"?>
<?xml-stylesheet href="chrome://messenger/skin/addressbook/addressbook.css" type="text/css"?>
<?xml-stylesheet href="chrome://messenger/skin/messengercompose/messengercompose.css" type="text/css"?>
<?xml-stylesheet href="chrome://messenger/skin/messengersmime/msgCompSMIMEOverlay.css" type="text/css"?>
<window id="CustomizeToolbarWindow"
title="&dialog.title;"
onload="onLoad();"
onunload="onUnload();"
onclose="onAccept(); return false;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript" src="chrome://global/content/customizeToolbar.js"/>
<script type="application/x-javascript" src="chrome://global/content/nsDragAndDrop.js"/>
<script type="application/x-javascript" src="chrome://global/content/nsTransferable.js"/>
<stringbundle id="stringBundle" src="chrome://global/locale/customizeToolbar.properties"/>
<vbox id="main-box" flex="1" collapsed="true">
<description id="instructions">
&instructions.description;
</description>
<vbox flex="1" id="palette-box"
ondraggesture="gDraggingFromPalette = true; nsDragAndDrop.startDrag(event, dragStartObserver);"
ondragover="nsDragAndDrop.dragOver(event, paletteDNDObserver);"
ondragdrop="nsDragAndDrop.drop(event, paletteDNDObserver);"/>
<box align="center">
<label value="&show.label;"/>
<menulist id="modelist" value="icons" oncommand="updateToolbarMode(this.value);">
<menupopup>
<menuitem value="full" label="&iconsAndText.label;"/>
<menuitem value="icons" label="&icons.label;"/>
<menuitem value="text" label="&text.label;"/>
</menupopup>
</menulist>
<checkbox collapsed="true" id="smallicons" oncommand="updateIconSize(this.checked);" label="&useSmallIcons.label;"/>
<button label="&restoreDefaultSet.label;" oncommand="restoreDefaultSet();"/>
</box>
<separator class="groove"/>
<hbox align="center" pack="end">
<button label="&saveChanges.label;" oncommand="onAccept();" default="true"/>
</hbox>
</vbox>
</window>

View File

@ -0,0 +1,196 @@
<?xml version="1.0"?>
<!--
The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
-->
<?xml-stylesheet href="chrome://messenger/skin/mailWindow2.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>
<?xul-overlay href="chrome://messenger/content/platformMailnewsOverlay.xul"?>
<?xul-overlay href="chrome://messenger/content/threadPane.xul"?>
<?xul-overlay href="chrome://messenger/content/folderPane.xul"?>
<?xul-overlay href="chrome://messenger/content/msgHdrViewOverlay.xul"?>
<?xul-overlay href="chrome://messenger/content/mailWindowOverlay.xul"?>
<?xul-overlay href="chrome://messenger/content/mailOverlay.xul"?>
<?xul-overlay href="chrome://communicator/content/contentAreaContextOverlay.xul"?>
<?xul-overlay href="chrome://communicator/content/communicatorOverlay.xul"?>
<!DOCTYPE window [
<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd" >
%brandDTD;
<!ENTITY % messengerDTD SYSTEM "chrome://messenger/locale/messenger.dtd" >
%messengerDTD;
]>
<window id="messengerWindow"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:nc="http://home.netscape.com/NC-rdf#"
title="&messengerWindow.title;"
titlemodifier="&titleModifier.label;"
titlemenuseparator="&titleSeparator.label;"
onload="OnLoadMessenger()"
onunload="OnUnloadMessenger()"
width="750"
height="500"
screenX="10" screenY="10"
persist="width height screenX screenY sizemode"
windowtype="mail:3pane">
<stringbundleset id="stringbundleset">
<stringbundle id="bundle_messenger" src="chrome://messenger/locale/messenger.properties"/>
<stringbundle id="bundle_brand" src="chrome://global/locale/brand.properties"/>
<stringbundle id="bundle_search" src="chrome://messenger/locale/search.properties"/>
</stringbundleset>
<script type="application/x-javascript" src="chrome://messenger/content/widgetglue.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/commandglue.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/shareglue.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/msgViewNavigation.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/mailWindow.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/msgMail3PaneWindow.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/mail3PaneWindowCommands.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/mailContextMenus.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/messengerdnd.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/accountUtils.js"/>
<script type="application/x-javascript" src="chrome://communicator/content/contentAreaClick.js"/>
<script type="application/x-javascript" src="chrome://global/content/nsTransferable.js"/>
<script type="application/x-javascript" src="chrome://global/content/nsDragAndDrop.js"/>
<script type="application/x-javascript" src="chrome://messenger/content/searchBar.js"/>
<commandset id="mailCommands">
<commandset id="mailFileMenuItems"/>
<commandset id="mailViewMenuItems"/>
<commandset id="mailEditMenuItems"/>
<commandset id="mailEditContextMenuItems"/>
<commandset id="mailSearchMenuItems"/>
<commandset id="mailGoMenuItems"/>
<commandset id="mailMessageMenuItems"/>
<commandset id="mailToolbarItems"/>
<commandset id="mailGetMsgMenuItems"/>
<commandset id="mailMarkMenuItems"/>
<commandset id="mailLabelMenuItems"/>
<commandset id="mailToolsMenuItems"/>
<commandset id="globalEditMenuItems"/>
<commandset id="selectEditMenuItems"/>
<commandset id="clipboardEditMenuItems"/>
<commandset id="FocusRingUpdate_Mail"
commandupdater="true"
events="focus"
oncommandupdate="FocusRingUpdate_Mail()"/>
<commandset id="tasksCommands"/>
<command id="toggleSidebar"/>
</commandset>
<broadcasterset id="mailBroadcasters">
<!-- File Menu -->
<broadcaster id="Communicator:WorkMode"/>
<!-- Edit Menu -->
</broadcasterset>
<keyset id="mailKeys">
<key id="showHideSidebar"/>
<keyset id="tasksKeys"/>
</keyset>
<popup id="threadPaneContext"/>
<popup id="folderPaneContext"/>
<popup id="attachmentListContext"/>
<tooltip id="attachmentListTooltip"/>
<popup id="emailAddressPopup" popupanchor="bottomleft" onpopupshowing="goUpdateCommand('cmd_createFilterFromPopup')">
<menuitem label="&AddToAddressBook.label;"
accesskey="&AddToAddressBook.accesskey;"
oncommand="AddNodeToAddressBook(document.popupNode)"/>
<menuitem label="&SendMailTo.label;"
accesskey="&SendMailTo.accesskey;"
oncommand="SendMailToNode(document.popupNode)"/>
<menuitem label="&CopyEmailAddress.label;"
accesskey="&CopyEmailAddress.accesskey;"
oncommand="CopyEmailAddress(document.popupNode)"/>
<menuitem label="&CreateFilter.label;"
accesskey="&CreateFilter.accesskey;"
oncommand="CreateFilter(document.popupNode)"
observes="cmd_createFilterFromPopup"/>
</popup>
<popup id="allHeadersPopup" onpopupshowing="return fillAllHeadersPopup(document.popupNode);" popupanchor="bottomleft">
<hbox id="allHeadersPopupContainer">
</hbox>
</popup>
<popup id="messagePaneContext"/>
<toolbox id="mail-toolbox" class="toolbox-top">
</toolbox>
<!-- The main mail three pane frame -->
<hbox style="height:100px" flex="1">
<vbox flex="1">
<hbox id="mail3PaneVertLayoutBox" persist="collapsed height" flex="1">
<vbox id="folderPaneBox" flex="1" autostretch="always" persist="width">
<tree id="folderTree" flex="1" style="min-width: 100px;" context="folderPaneContext" persist="collapsed width height"/>
</vbox>
<splitter id="gray_vertical_splitter" collapse="before" persist="state">
<grippy/>
</splitter>
<hbox id="messengerBox" persist="collapsed width" flex="2">
<vbox id="searchAndthreadpaneBox" persist="width" flex ="1">
<vbox id="messagesBox" flex="1">
<hbox id="searchBox"/>
<vbox id="threadpaneBox" flex="1" persist="width">
<tree id="threadTree" flex="1" persist="width" style="width:0px" context="threadPaneContext"/>
</vbox>
</vbox>
</vbox>
<hbox id="accountCentralBox" flex="1" persist="width">
<iframe name="accountCentralPane" style="width:0px;" flex="1" src="about:blank"/>
</hbox>
</hbox>
</hbox>
<!-- if you change this id, please change GetThreadAndMessagePaneSplitter() and MsgToggleMessagePane() -->
<splitter id="threadpane-splitter" collapse="after" persist="state"
onmouseup="OnMouseUpThreadAndMessagePaneSplitter()">
<grippy onclick="OnClickThreadAndMessagePaneSplitterGrippy()"/>
</splitter>
<!-- msg header view -->
<vbox id="messagepanebox" flex="4" persist="collapsed height">
<hbox id="junkBar"/>
<hbox id="msgHeaderView"/>
<!-- message view -->
<browser id="messagepane" context="messagePaneContext" autofind="false"
style="height: 0px; min-height: 1px" flex="1" name="messagepane"
disablehistory="true" type="content-primary" src="about:blank"
disablesecurity="true" onclick="contentAreaClick(event);"/>
</vbox>
</vbox>
</hbox>
<statusbar id="status-bar" class="mailwindow-statusbar">
<statusbarpanel id="unreadMessageCount" style="min-width: 5px"/>
<statusbarpanel id="totalMessageCount" style="min-width: 5px"/>
</statusbar>
</window>

View File

@ -0,0 +1,118 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
*
* Contributor(s):
*/
/*
* Core mail routines used by all of the major mail windows (address book, 3-pane, compose and stand alone message window).
* Routines to support custom toolbars in mail windows, opening up a new window of a particular type all live here.
* Before adding to this file, ask yourself, is this a JS routine that is going to be used by all of the main mail windows?
*/
function CustomizeMailToolbar(id)
{
// Disable the toolbar context menu items
var menubar = document.getElementById("mail-menubar");
for (var i = 0; i < menubar.childNodes.length; ++i)
menubar.childNodes[i].setAttribute("disabled", true);
//var cmd = document.getElementById("cmd_CustomizeToolbars");
//cmd.setAttribute("disabled", "true");
window.openDialog("chrome://global/content/customizeToolbar.xul", "CustomizeToolbar",
"chrome,all,dependent", document.getElementById(id));
}
function MailToolboxCustomizeDone(aToolboxChanged)
{
// Update global UI elements that may have been added or removed
// Re-enable parts of the UI we disabled during the dialog
var menubar = document.getElementById("mail-menubar");
for (var i = 0; i < menubar.childNodes.length; ++i)
menubar.childNodes[i].setAttribute("disabled", false);
//var cmd = document.getElementById("cmd_CustomizeToolbars");
//cmd.removeAttribute("disabled");
// make sure our toolbar buttons have the correct enabled state restored to them...
if (this.UpdateMailToolbar != undefined)
UpdateMailToolbar(focus);
}
function onViewToolbarCommand(id, aEvent)
{
var toolbar = document.getElementById(id);
if (!toolbar) return;
toolbar.collapsed = aEvent.originalTarget.getAttribute("checked") != "true";
document.persist(id, "collapsed");
}
function toJavaScriptConsole()
{
toOpenWindowByType("global:console", "chrome://global/content/console.xul");
}
const nsIWindowMediator = Components.interfaces.nsIWindowMediator;
function toOpenWindowByType( inType, uri )
{
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();
var windowManagerInterface = windowManager.QueryInterface(nsIWindowMediator);
var topWindow = windowManagerInterface.getMostRecentWindow( inType );
if ( topWindow )
topWindow.focus();
else
window.open(uri, "_blank", "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar");
}
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 toImport()
{
window.openDialog("chrome://messenger/content/importDialog.xul","importDialog","chrome, modal, titlebar", {importType: "addressbook"});
}
// this method is overridden by mail-offline.js if we build with the offline extensions
function CheckOnline()
{
return true;
}

View File

@ -0,0 +1,68 @@
<?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"});
}
]]>
</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>
<menupopup id="windowPopup">
<menuitem accesskey="&messengerCmd.accesskey;" label="&messengerCmd.label;" key="key_mail" command="Tasks:Mail" id="tasksMenuMail" class="menuitem-iconic icon-mail16 menu-iconic"/>
<menuitem label="&addressBookCmd.label;" accesskey="&addressBookCmd.accesskey;" key="key_addressbook" command="Tasks:AddressBook" id="tasksMenuAddressBook" class="menuitem-iconic icon-addressbook16 menu-iconic"/>
<menuseparator id="sep-window-list"/>
</menupopup>
</overlay>

View File

@ -33,6 +33,7 @@ var gOfflineManager;
var gWindowManagerInterface;
var gPrefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
var gPrintSettings = null;
var gWindowReuse = 0;
var gTimelineService = null;
var gTimelineEnabled = ("@mozilla.org;timeline-service;1" in Components.classes);
@ -172,6 +173,10 @@ function view_init()
thread_menuitem.setAttribute('checked',threadColumn.getAttribute('currentView')=='threaded');
}
// Initialize the View Attachment Inline menu
var viewAttachmentInline = pref.getBoolPref("mail.inline_attachments");
document.getElementById("viewAttachmentsInlineMenuitem").setAttribute("checked", viewAttachmentInline ? "true" : "false");
document.commandDispatcher.updateCommands('create-menu-view');
}
@ -197,7 +202,7 @@ function InitViewSortByMenu()
setSortByMenuItemCheckState("sortByThreadMenuitem", (sortType == nsMsgViewSortType.byThread));
setSortByMenuItemCheckState("sortByUnreadMenuitem", (sortType == nsMsgViewSortType.byUnread));
setSortByMenuItemCheckState("sortByLabelMenuitem", (sortType == nsMsgViewSortType.byLabel));
setSortByMenuItemCheckState("sortByScoreMenuitem", (sortType == nsMsgViewSortType.byScore));
setSortByMenuItemCheckState("sortByJunkStatusMenuitem", (sortType == nsMsgViewSortType.byJunkStatus));
// the Sender / Recipient menu is dynamic
setSortByMenuItemCheckState("sortBySenderOrRecipientMenuitem", (sortType == nsMsgViewSortType.byAuthor) || (sortType == nsMsgViewSortType.byRecipient));
@ -217,6 +222,9 @@ function InitViewSortByMenu()
setSortByMenuItemCheckState("sortAscending", (sortOrder == nsMsgViewSortOrder.ascending));
setSortByMenuItemCheckState("sortDescending", (sortOrder == nsMsgViewSortOrder.descending));
var threadMenuItem = document.getElementById("sortByThreadMenuitem");
threadMenuItem.setAttribute("disabled", !gDBView.supportsThreading);
}
function InitViewMessagesMenu()
@ -337,69 +345,14 @@ function InitViewHeadersMenu()
menuitem.setAttribute("checked", "true");
}
function InitViewBodyMenu()
{
var html_as = 0;
var prefer_plaintext = false;
var disallow_classes = 0;
try
{
prefer_plaintext = pref.getBoolPref("mailnews.display.prefer_plaintext");
html_as = pref.getIntPref("mailnews.display.html_as");
disallow_classes =
pref.getIntPref("mailnews.display.disallow_mime_handlers");
if (disallow_classes > 0)
disallow_classes_no_html = disallow_classes;
// else disallow_classes_no_html keeps its inital value (see top)
}
catch (ex)
{
dump("failed to get the body plaintext vs. HTML prefs\n");
}
var AllowHTML_checked = false;
var Sanitized_checked = false;
var AsPlaintext_checked = false;
if (prefer_plaintext == false && html_as == 0 && disallow_classes == 0)
AllowHTML_checked = true;
else if (prefer_plaintext == false && html_as == 3 && disallow_classes > 0)
Sanitized_checked = true;
else if (prefer_plaintext == true && html_as == 1 && disallow_classes > 0)
AsPlaintext_checked = true;
// else (the user edited prefs/user.js) check none of the radio menu items
var AllowHTML_menuitem = document.getElementById("bodyAllowHTML");
var Sanitized_menuitem = document.getElementById("bodySanitized");
var AsPlaintext_menuitem = document.getElementById("bodyAsPlaintext");
if (AllowHTML_menuitem
&& Sanitized_menuitem
&& AsPlaintext_menuitem)
{
AllowHTML_menuitem.setAttribute("checked",
AllowHTML_checked ? "true" : "false");
Sanitized_menuitem.setAttribute("checked",
Sanitized_checked ? "true" : "false");
AsPlaintext_menuitem.setAttribute("checked",
AsPlaintext_checked ? "true" : "false");
}
else
dump("Where is my View|Body menu?\n");
}
function IsNewsMessage(messageUri)
{
if (!messageUri)
return false;
else
return (messageUri.substring(0,14) == "news-message:/");
return (/^news-message:/.test(messageUri));
}
function IsImapMessage(messageUri)
{
if (!messageUri)
return false;
else
return (messageUri.substring(0,14) == "imap-message:/");
return (/^imap-message:/.test(messageUri));
}
function SetMenuItemLabel(menuItemId, customLabel)
@ -506,6 +459,25 @@ function InitMessageMark()
document.commandDispatcher.updateCommands('create-menu-mark');
}
function UpdateJunkToolbarButton()
{
try
{
var junkButton = document.getElementById("button-junk");
if (SelectedMessagesAreJunk())
{
junkButton.label = junkButton.getAttribute('notjunk_label');
junkButton.setAttribute('tooltiptext', junkButton.getAttribute('notjunk_tooltiptext'));
}
else
{
junkButton.label = junkButton.getAttribute('junk_label');
junkButton.setAttribute('tooltiptext', junkButton.getAttribute('junk_tooltiptext'));
}
}
catch(e) {}
}
function UpdateDeleteCommand()
{
var value = "value";
@ -537,8 +509,8 @@ function SelectedMessagesAreJunk()
{
var isJunk;
try {
var score = gDBView.hdrForFirstSelectedMessage.getStringProperty("score");
isJunk = ((score != "") && (score != "0"));
var junkScore = gDBView.hdrForFirstSelectedMessage.getStringProperty("junkscore");
isJunk = ((junkScore != "") && (junkScore != "0"));
}
catch (ex) {
isJunk = false;
@ -963,11 +935,9 @@ function MsgNewFolder(callBackFunctionName)
dump ("Exception: dualUseFolders = true\n");
}
}
CreateNewSubfolder("chrome://messenger/content/newFolderDialog.xul", destinationFolder, dualUseFolders, callBackFunctionName);
}
function getDestinationFolder(preselectedFolder, server)
{
var destinationFolder = null;
@ -986,10 +956,7 @@ function getDestinationFolder(preselectedFolder, server)
if (!verifyCreateSubfolders)
{
try {
var account = accountManager.defaultAccount;
var defaultServer = account.incomingServer;
var defaultFolder = defaultServer.rootMsgFolder;
var defaultFolder = GetDefaultAccountRootFolder();
var checkCreateSubfolders = null;
if (defaultFolder)
checkCreateSubfolders = defaultFolder.canCreateSubfolders;
@ -1084,11 +1051,83 @@ function MsgOpenSelectedMessages()
var indices = GetSelectedIndices(dbView);
var numMessages = indices.length;
for (var i = 0; i < numMessages; i++) {
MsgOpenNewWindowForMessage(dbView.getURIForViewIndex(indices[i]),dbView.getFolderForViewIndex(indices[i]).URI);
gWindowReuse = gPrefs.getBoolPref("mailnews.reuse_message_window");
// This is a radio type button pref, currently with only 2 buttons.
// We need to keep the pref type as 'bool' for backwards compatibility
// with 4.x migrated prefs. For future radio button(s), please use another
// pref (either 'bool' or 'int' type) to describe it.
//
// gWindowReuse values: false, true
// false: open new standalone message window for each message
// true : reuse existing standalone message window for each message
if ((gWindowReuse) && (numMessages == 1)) {
if (!MsgOpenExistingWindowForMessage(dbView.getURIForViewIndex(indices[0]))) {
MsgOpenNewWindowForMessage(dbView.getURIForViewIndex(indices[0]),dbView.getFolderForViewIndex(indices[0]).URI);
}
} else {
for (var i = 0; i < numMessages; i++) {
MsgOpenNewWindowForMessage(dbView.getURIForViewIndex(indices[i]),dbView.getFolderForViewIndex(indices[i]).URI);
}
}
}
function MsgOpenExistingWindowForMessage(aMessageUri)
{
var messageUri;
var msgHdr = null;
var windowID = GetWindowByWindowType("mail:messageWindow");
if (!windowID)
return false;
if (!aMessageUri) {
var currentIndex = gDBView.QueryInterface(Components.interfaces.nsIOutlinerView).outlinerView.selection;
messageUri = gDBView.getURIForViewIndex(currentIndex);
}
else
messageUri = aMessageUri;
// be sure to pass in the current view....
if (!messageUri)
return false;
try {
msgHdr = messenger.messageServiceFromURI(messageUri).messageURIToMsgHdr(messageUri);
if (!msgHdr)
return false;
// even if the folder uri's match, we can't use the existing view
// (msgHdr.folder.URI == windowID.gCurrentFolderUri)
// the reason is quick search and mail views.
// see bug #187673
//
// for the sake of simplicity,
// let's always call CreateView(gDBView)
// which will clone gDBView
if ("CreateView" in windowID) {
// Reset the window's message uri and folder uri vars, and
// update the command handlers to what's going to be used.
// This has to be done before the call to CreateView().
windowID.gCurrentMessageUri = messageUri;
windowID.gCurrentFolderUri = msgHdr.folder.URI;
windowID.UpdateMailToolbar('MsgOpenExistingWindowForMessage');
windowID.CreateView(gDBView);
windowID.gDBView.loadMessageByMsgKey(msgHdr.messageKey);
}
else
return false;
}
catch (ex) {
dump("reusing existing standalone message window failed: " + ex + "\n");
return false;
}
// bring existing window to front
windowID.focus();
return true;
}
function MsgOpenNewWindowForMessage(messageUri, folderUri)
{
if (!messageUri)
@ -1276,33 +1315,14 @@ function MsgViewBriefHeaders()
return true;
}
function MsgBodyAllowHTML()
{
gPrefs.setBoolPref("mailnews.display.prefer_plaintext", false);
gPrefs.setIntPref("mailnews.display.html_as", 0);
gPrefs.setIntPref("mailnews.display.disallow_mime_handlers", 0);
MsgReload();
return true;
}
function MsgBodySanitized()
function ToggleInlineAttachment(target)
{
gPrefs.setBoolPref("mailnews.display.prefer_plaintext", false);
gPrefs.setIntPref("mailnews.display.html_as", 3);
gPrefs.setIntPref("mailnews.display.disallow_mime_handlers",
disallow_classes_no_html);
var viewAttachmentInline = !pref.getBoolPref("mail.inline_attachments");
pref.setBoolPref("mail.inline_attachments", viewAttachmentInline)
target.setAttribute("checked", viewAttachmentInline ? "true" : "false");
MsgReload();
return true;
}
function MsgBodyAsPlaintext()
{
gPrefs.setBoolPref("mailnews.display.prefer_plaintext", true);
gPrefs.setIntPref("mailnews.display.html_as", 1);
gPrefs.setIntPref("mailnews.display.disallow_mime_handlers",
disallow_classes_no_html);
MsgReload();
return true;
}
function MsgReload()
@ -1364,11 +1384,8 @@ function GetPrintSettings()
return gPrintSettings;
}
function PrintEnginePrint()
function PrintEnginePrintInternal(messageList, numMessages, doPrintPreview, msgType)
{
var messageList = GetSelectedMessages();
var numMessages = messageList.length;
if (numMessages == 0) {
dump("PrintEnginePrint(): No messages selected.\n");
return false;
@ -1377,12 +1394,24 @@ function PrintEnginePrint()
if (gPrintSettings == null) {
gPrintSettings = GetPrintSettings();
}
printEngineWindow = window.openDialog("chrome://messenger/content/msgPrintEngine.xul",
"",
"chrome,dialog=no,all,centerscreen",
numMessages, messageList, statusFeedback, gPrintSettings);
numMessages, messageList, statusFeedback, gPrintSettings, doPrintPreview, msgType, window);
return true;
}
function PrintEnginePrint()
{
var messageList = GetSelectedMessages();
return PrintEnginePrintInternal(messageList, messageList.length, false, Components.interfaces.nsIMsgPrintEngine.MNAB_PRINT_MSG);
}
function PrintEnginePrintPreview()
{
var messageList = GetSelectedMessages();
return PrintEnginePrintInternal(messageList, 1, true, Components.interfaces.nsIMsgPrintEngine.MNAB_PRINTPREVIEW_MSG);
}
function IsMailFolderSelected()
@ -1406,25 +1435,13 @@ function IsMailFolderSelected()
function IsGetNewMessagesEnabled()
{
var selectedFolders = GetSelectedMsgFolders();
var numFolders = selectedFolders.length;
if(numFolders !=1)
return false;
var folder = selectedFolders[0];
if (!folder)
return false;
var server = folder.server;
var isServer = folder.isServer;
var serverType = server.type;
if(isServer && (serverType == "nntp"))
return false;
else if(serverType == "none")
return false;
else
return true;
// users don't like it when the "Get Msgs" button is disabled
// so let's never do that.
// we'll just handle it as best we can in GetFolderMessages()
// when they click "Get Msgs" and
// Local Folders or a news server is selected
// see bugs #89404 and #111102
return true;
}
function IsGetNextNMessagesEnabled()
@ -1489,7 +1506,7 @@ var gMarkButton = null;
function SetUpToolbarButtons(uri)
{
// dump("SetUpToolbarButtons("+uri+")\n");
//dump("SetUpToolbarButtons("+uri+")\n");
// eventually, we might want to set up the toolbar differently for imap,
// pop, and news. for now, just tweak it based on if it is news or not.
@ -1565,16 +1582,28 @@ function MsgGoForward() {}
function MsgAddSenderToAddressBook() {}
function MsgAddAllToAddressBook() {}
function SpaceHit()
function SpaceHit(event)
{
var contentWindow = window.top._content;
var oldScrollY = contentWindow.scrollY;
contentWindow.scrollByPages(1);
var numPages;
var command;
// if at the end of the message, go to the next one
if (event && event.shiftKey) {
numPages = -1;
command = "cmd_previousUnreadMsg";
}
else {
numPages = 1;
command = "cmd_nextUnreadMsg";
}
contentWindow.scrollByPages(numPages);
// if at the end (or start) of the message, go to the next one
if (oldScrollY == contentWindow.scrollY) {
goDoCommand('cmd_nextUnreadMsg');
goDoCommand(command);
}
}
@ -1635,23 +1664,66 @@ function PromptSendMessagesOffline()
return buttonPressed;
}
function GetDefaultAccountRootFolder()
{
try {
var account = accountManager.defaultAccount;
var defaultServer = account.incomingServer;
var defaultFolder = defaultServer.rootMsgFolder;
return defaultFolder;
}
catch (ex) {
}
return null;
}
function GetFolderMessages()
{
var folders = GetSelectedMsgFolders();
var selectedFolders = GetSelectedMsgFolders();
var defaultAccountRootFolder = GetDefaultAccountRootFolder();
// if no default account, get msg isn't going do anything anyways
// so bail out
if (!defaultAccountRootFolder)
return;
// if nothing selected, use the default
var folder = selectedFolders.length ? selectedFolders[0] : defaultAccountRootFolder;
var serverType = folder.server.type;
if (folder.isServer && (serverType == "nntp")) {
// if we're doing "get msgs" on a news server
// update unread counts on this server
folder.server.performExpand(msgWindow);
return;
}
else if (serverType == "none") {
// if "Local Folders" is selected
// and the user does "Get Msgs"
// get new mail for the default account
//
// XXX TODO
// should shift click get mail for all (authenticated) accounts?
// see bug #125885
folder = defaultAccountRootFolder;
}
var folders = new Array(1);
folders[0] = folder;
var compositeDataSource = GetCompositeDataSource("GetNewMessages");
GetNewMessages(folders, compositeDataSource);
}
function SendUnsentMessages()
{
var am = Components.classes["@mozilla.org/messenger/account-manager;1"]
.getService(Components.interfaces.nsIMsgAccountManager);
var msgSendlater = Components.classes["@mozilla.org/messengercompose/sendlater;1"]
.getService(Components.interfaces.nsIMsgSendLater);
var identitiesCount, allIdentities, currentIdentity, numMessages, msgFolder;
if(am) {
allIdentities = am.allIdentities;
if (accountManager) {
allIdentities = accountManager.allIdentities;
identitiesCount = allIdentities.Count();
for (var i = 0; i < identitiesCount; i++) {
currentIdentity = allIdentities.QueryElementAt(i, Components.interfaces.nsIMsgIdentity);
@ -1760,11 +1832,54 @@ function SetupUndoRedoCommand(command)
return canUndoOrRedo;
}
function OnMsgLoaded(folder, msgURI)
function HandleJunkStatusChanged(folder)
{
if (IsCurrentLoadedFolder(folder)) {
var messageURI = GetLoadedMessage();
// if multiple message are selected
// and we change the junk status
// we don't want to show the junk bar
// (since the message pane is blank)
if (messageURI && (GetNumSelectedMessages() == 1))
SetUpJunkBar(messenger.messageServiceFromURI(messageURI).messageURIToMsgHdr(messageURI));
else
SetUpJunkBar(null);
}
}
function SetUpJunkBar(aMsgHdr)
{
// XXX todo
// should this happen on the start, or at the end?
// if at the end, we might keep the "this message is junk" up for a while, until a big message is loaded
// or do we need to wait until here, to make sure the message is fully analyzed
// what about almost hiding it on the start, and then showing here?
var isJunk = false;
if (aMsgHdr) {
var junkScore = aMsgHdr.getStringProperty("junkscore");
isJunk = ((junkScore != "") && (junkScore != "0"));
}
var junkBar = document.getElementById("junkBar");
if (isJunk)
junkBar.removeAttribute("collapsed");
else
junkBar.setAttribute("collapsed","true");
goUpdateCommand('button_junk');
}
function OnMsgLoaded(folder, aMessageURI)
{
var msgHdr = messenger.messageServiceFromURI(aMessageURI).messageURIToMsgHdr(aMessageURI);
SetUpJunkBar(msgHdr);
var currentMsgFolder = folder.QueryInterface(Components.interfaces.nsIMsgFolder);
if (!IsImapMessage(msgURI))
if (!IsImapMessage(aMessageURI))
return;
var imapServer = currentMsgFolder.server.QueryInterface(Components.interfaces.nsIImapIncomingServer);
var storeReadMailInPFC = imapServer.storeReadMailInPFC;
if (storeReadMailInPFC)
@ -1776,17 +1891,7 @@ function OnMsgLoaded(folder, msgURI)
// look in read mail PFC for msg with same msg id - if we find one,
// don't put this message in the read mail pfc.
var outputPFC = imapServer.GetReadMailPFC(true);
var messageURI = GetLoadedMessage();
if (messageURI != msgURI)
{
// XXX TODO
// bienvenu tells me:
// if you have two message windows open, you can get multiple attempts
// to copy into the pfc. the second will fail and assert.
dump("not loading msg into this window - loaded message = " + messageURI + "loading " + msgURI + "\n");
// return;
}
var msgHdr = messenger.messageServiceFromURI(messageURI).messageURIToMsgHdr(messageURI);
if (msgHdr)
{
messageID = msgHdr.messageId;
@ -1831,6 +1936,16 @@ function MsgJunkMail()
OpenOrFocusWindow(args, "mailnews:junk", "chrome://messenger/content/junkMail.xul");
}
function MsgJunkMailInfo()
{
var desiredWindow = GetWindowByWindowType("mailnews:junkmailinfo");
if (desiredWindow)
desiredWindow.focus();
else
window.openDialog("chrome://messenger/content/junkMailInfo.xul", "mailnews:junkmailinfo", "centerscreen,resizeable=no,titlebar,chrome", null);
}
function MsgSearchAddresses()
{
var args = { directory: null };
@ -1842,10 +1957,15 @@ function MsgFilterList(args)
OpenOrFocusWindow(args, "mailnews:filterlist", "chrome://messenger/content/FilterListDialog.xul");
}
function OpenOrFocusWindow(args, windowType, chromeURL)
function GetWindowByWindowType(windowType)
{
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService(Components.interfaces.nsIWindowMediator);
var desiredWindow = windowManager.getMostRecentWindow(windowType);
return windowManager.getMostRecentWindow(windowType);
}
function OpenOrFocusWindow(args, windowType, chromeURL)
{
var desiredWindow = GetWindowByWindowType(windowType);
if (desiredWindow) {
desiredWindow.focus();
@ -1856,3 +1976,11 @@ function OpenOrFocusWindow(args, windowType, chromeURL)
window.openDialog(chromeURL, "", "chrome,resizable,status,centerscreen,dialog=no", args);
}
function loadThrobberUrl(urlPref)
{
var url;
try {
url = gPrefs.getComplexValue(urlPref, Components.interfaces.nsIPrefLocalizedString).data;
messenger.loadURL(window, url);
} catch (ex) {}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,74 +1,51 @@
mail.jar:
content/mail/contents.rdf (content/contents.rdf)
content/mail/messenger.css (content/messenger.css)
content/mail/mail.xul (content/mail.xul)
content/mail/mail3PaneWindowVertLayout.xul (content/mail3PaneWindowVertLayout.xul)
content/mail/mailWindowExtrasOverlay.xul (content/mailWindowExtrasOverlay.xul)
content/mail/mailWindowOverlay.xul (content/mailWindowOverlay.xul)
content/mail/mailWindowOverlay.js (content/mailWindowOverlay.js)
content/mail/msgSynchronize.xul (content/msgSynchronize.xul)
content/mail/msgSynchronize.js (content/msgSynchronize.js)
content/mail/msgSelectOffline.xul (content/msgSelectOffline.xul)
content/mail/mailWindow.js (content/mailWindow.js)
content/mail/messageWindow.xul (content/messageWindow.xul)
content/mail/messageWindow.js (content/messageWindow.js)
content/mail/folderProps.xul (content/folderProps.xul)
content/mail/folderProps.js (content/folderProps.js)
content/mail/msgHdrViewOverlay.xul (content/msgHdrViewOverlay.xul)
content/mail/msgHdrViewOverlay.js (content/msgHdrViewOverlay.js)
content/mail/msgHdrViewAddresses.js (content/msgHdrViewAddresses.js)
content/mail/widgetglue.js (content/widgetglue.js)
content/mail/commandglue.js (content/commandglue.js)
content/mail/mailCommands.js (content/mailCommands.js)
content/mail/shareglue.js (content/shareglue.js)
content/mail/subscribe.xul (content/subscribe.xul)
content/mail/subscribe.js (content/subscribe.js)
content/mail/newFolderDialog.xul (content/newFolderDialog.xul)
content/mail/newFolderDialog.js (content/newFolderDialog.js)
content/mail/msgViewNavigation.js (content/msgViewNavigation.js)
content/mail/msgMail3PaneWindow.js (content/msgMail3PaneWindow.js)
content/mail/searchBar.js (content/searchBar.js)
content/mail/msgAccountCentral.xul (content/msgAccountCentral.xul)
content/mail/msgAccountCentral.js (content/msgAccountCentral.js)
content/mail/mail3PaneWindowCommands.js (content/mail3PaneWindowCommands.js)
content/mail/msgFolderPickerOverlay.js (content/msgFolderPickerOverlay.js)
content/mail/msgFolderPickerOverlay.xul (content/msgFolderPickerOverlay.xul)
content/mail/renameFolderDialog.xul (content/renameFolderDialog.xul)
content/mail/renameFolderDialog.js (content/renameFolderDialog.js)
content/mail/messengerdnd.js (content/messengerdnd.js)
content/mail/mailContextMenus.js (content/mailContextMenus.js)
content/mail/msgPrintEngine.js (content/msgPrintEngine.js)
content/mail/msgPrintEngine.xul (content/msgPrintEngine.xul)
content/mail/mailTasksOverlay.xul (content/mailTasksOverlay.xul)
content/mail/mailNavigatorOverlay.xul (content/mailNavigatorOverlay.xul)
content/mail/mailEditorOverlay.xul (content/mailEditorOverlay.xul)
content/mail/mailABOverlay.xul (content/mailABOverlay.xul)
content/mail/mailMessengerOverlay.xul (content/mailMessengerOverlay.xul)
content/mail/mailMessengerComposeOverlay.xul (content/mailMessengerComposeOverlay.xul)
content/mail/mailWidgets.xml (content/mailWidgets.xml)
content/mail/mail-offline.js (content/mail-offline.js)
content/mail/threadPane.js (content/threadPane.js)
messenger.jar:
+ content/messenger/contents.rdf (content/contents.rdf)
+ content/messenger/mail3PaneWindowVertLayout.xul (content/mail3PaneWindowVertLayout.xul)
+ content/messenger/mailTasksOverlay.xul (content/mailTasksOverlay.xul)
+ content/messenger/mailWindow.js (content/mailWindow.js)
+ content/messenger/mailWindowOverlay.js (content/mailWindowOverlay.js)
+ content/messenger/mailWindowOverlay.xul (content/mailWindowOverlay.xul)
+ content/messenger/messageWindow.xul (content/messageWindow.xul)
+ content/messenger/messageWindow.js (content/messageWindow.js)
+ content/messenger/messenger.xul (content/messenger.xul)
+ content/messenger/msgMail3PaneWindow.js (content/msgMail3PaneWindow.js)
+ content/messenger/mailCore.js (content/mailCore.js)
+ content/messenger/SearchDialog.xul (content/SearchDialog.xul)
classic.jar:
+ skin/classic/global/tree/twisty-open.gif (skin/icons/twisty-open.gif)
+ skin/classic/global/tree/twisty-clsd.gif (skin/icons/twisty-clsd.gif)
+ skin/classic/global/toolbar.css (skin/toolbar.css)
+ skin/classic/global/tree.css (skin/tree.css)
+ skin/classic/messenger/primaryToolbar.css (skin/primaryToolbar.css)
+ skin/classic/messenger/accountCentral.css (skin/accountCentral.css)
+ skin/classic/messenger/threadPane.css (skin/threadPane.css)
+ skin/classic/messenger/messageHeader.css (skin/messageHeader.css)
toolkit.jar:
+ content/global/customizeToolbar.xul (content/customizeToolbar.xul)
+ content/global/customizeToolbar.js (content/customizeToolbar.js)
+ content/global/customizeToolbar.css (content/customizeToolbar.css)
+ content/global/bindings/toolbar.xml (content/toolbar.xml)
+ content/global/xul.css (content/xul.css)
+ content/communicator/nsContextMenu.js (content/nsContextMenu.js)
+ content/communicator/tasksOverlay.xul (content/tasksOverlay.xul)
+ content/communicator/utilityOverlay.xul (content/utilityOverlay.xul)
en-US.jar:
locale/en-US/mail/messenger.dtd (locale/messenger.dtd)
locale/en-US/mail/msgAccountCentral.dtd (locale/msgAccountCentral.dtd)
locale/en-US/mail/messenger.properties (locale/messenger.properties)
locale/en-US/mail/newFolderDialog.dtd (locale/newFolderDialog.dtd)
locale/en-US/mail/renameFolderDialog.dtd (locale/renameFolderDialog.dtd)
locale/en-US/mail/folderProps.dtd (locale/folderProps.dtd)
locale/en-US/mail/subscribe.dtd (locale/subscribe.dtd)
locale/en-US/mail/subscribe.properties (locale/subscribe.properties)
locale/en-US/mail/msgFolderPickerOverlay.dtd (locale/msgFolderPickerOverlay.dtd)
locale/en-US/mail/msgHdrViewOverlay.dtd (locale/msgHdrViewOverlay.dtd)
locale/en-US/mail/mailTasksOverlay.dtd (locale/mailTasksOverlay.dtd)
locale/en-US/mail/mailTurboMenu.properties (locale/mailTurboMenu.properties)
locale/en-US/mail/mailNavigatorOverlay.dtd (locale/mailNavigatorOverlay.dtd)
locale/en-US/mail/mailEditorOverlay.dtd (locale/mailEditorOverlay.dtd)
locale/en-US/mail/msgSynchronize.dtd (locale/msgSynchronize.dtd)
locale/en-US/mail/offline.properties (locale/offline.properties)
locale/en-US/mail/contents.rdf (locale/contents.rdf)
+ locale/en-US/messenger/messenger.dtd (locale/messenger.dtd)
+ locale/en-US/messenger/mailTasksOverlay.dtd (locale/mailTasksOverlay.dtd)
+ locale/en-US/messenger/msgAccountCentral.dtd (locale/msgAccountCentral.dtd)
+ locale/en-US/messenger/SearchDialog.dtd (locale/SearchDialog.dtd)
+ locale/en-US/global/customizeToolbar.dtd (locale/customizeToolbar.dtd)
+ locale/en-US/global/customizeToolbar.properties (locale/customizeToolbar.properties)
+ locale/en-US/global/brand.properties (locale/brand.properties)
+ locale/en-US/global/brand.dtd (locale/brand.dtd)
+ locale/en-US/communicator/utilityOverlay.dtd (locale/utilityOverlay.dtd)
US.jar:
+ locale/US/messenger-region/region.properties (locale/region.properties)
+ locale/US/messenger-region/region.properties (locale/region.properties)