Begin work on mail context menus. This is for the thread pane. r= alecf.

This commit is contained in:
putterman%netscape.com 2000-01-12 02:25:35 +00:00
Родитель 20fdd8013d
Коммит c55c5754a3
9 изменённых файлов: 287 добавлений и 17 удалений

Просмотреть файл

@ -39,3 +39,4 @@ msgMail3PaneWindow.js
msgFolderPickerOverlay.xul msgFolderPickerOverlay.xul
msgFolderPickerOverlay.js msgFolderPickerOverlay.js
messengerdnd.js messengerdnd.js
mailContextMenus.js

Просмотреть файл

@ -48,6 +48,7 @@ EXPORT_RESOURCE_SAMPLES = \
msgFolderPickerOverlay.xul \ msgFolderPickerOverlay.xul \
renameFolderNameDialog.xul \ renameFolderNameDialog.xul \
messengerdnd.js \ messengerdnd.js \
mailContextMenus.js \
$(NULL) $(NULL)
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -693,3 +693,5 @@ function GetSelectTrashUri(folder)
} }
return null; return null;
} }

Просмотреть файл

@ -0,0 +1,91 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* 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) 2000 Netscape Communications Corporation. All
* Rights Reserved.
*
*/
function fillThreadPaneContextMenu()
{
var tree = GetThreadTree();
var selectedItems = tree.selectedItems;
var numSelected = selectedItems.length;
ShowMenuItem("threadPaneContext-openNewWindow", (numSelected <= 1));
EnableMenuItem("threadPaneContext-openNewWindow", false);
ShowMenuItem("threadPaneContext-editAsNew", (numSelected <= 1));
EnableMenuItem("threadPaneContext-editAsNew", false);
ShowMenuItem("threadPaneContext-sep-open", (numSelected <= 1));
ShowMenuItem("threadPaneContext-replySender", (numSelected <= 1));
EnableMenuItem("threadPaneContext-replySender", (numSelected == 1));
ShowMenuItem("threadPaneContext-replyAll", (numSelected <= 1));
EnableMenuItem("threadPaneContext-replyAll", (numSelected == 1));
ShowMenuItem("threadPaneContext-forward", true);
EnableMenuItem("threadPaneContext-forward", (numSelected > 0));
ShowMenuItem("threadPaneContext-sep-reply", true);
ShowMenuItem("threadPaneContext-moveMenu", true);
EnableMenuItem("threadPaneContext-moveMenu", (numSelected > 0));
ShowMenuItem("threadPaneContext-copyMenu", true);
EnableMenuItem("threadPaneContext-copyMenu", (numSelected > 0));
ShowMenuItem("threadPaneContext-saveAs", (numSelected <= 1));
EnableMenuItem("threadPaneContext-saveAs", (numSelected == 1));
ShowMenuItem("threadPaneContext-print", true);
EnableMenuItem("threadPaneContext-print", (numSelected > 0));
ShowMenuItem("threadPaneContext-delete", true);
EnableMenuItem("threadPaneContext-delete", (numSelected > 0));
ShowMenuItem("threadPaneContext-sep-edit", (numSelected <= 1));
ShowMenuItem("threadPaneContext-addSenderToAddressBook", (numSelected <= 1));
EnableMenuItem("threadPaneContext-addSenderToAddressBook", false);
ShowMenuItem("threadPaneContext-addAllToAddressBook", (numSelected <= 1));
EnableMenuItem("threadPaneContext-addAllToAddressBook", false);
return(true);
}
function ShowMenuItem(id, showItem)
{
var item = document.getElementById(id);
var showing = (item.getAttribute('hidden') !='true');
if(item && (showItem != showing))
item.setAttribute('hidden', showItem ? '' : 'true');
}
function EnableMenuItem(id, enableItem)
{
var item = document.getElementById(id);
var enabled = (item.getAttribute('disabled') !='true');
if(item && (enableItem != enabled))
{
item.setAttribute('disabled', enableItem ? '' : 'true');
}
}

Просмотреть файл

@ -43,6 +43,7 @@ install::
$(MAKE_INSTALL) msgFolderPickerOverlay.xul $(DIST)\bin\chrome\messenger\content\default $(MAKE_INSTALL) msgFolderPickerOverlay.xul $(DIST)\bin\chrome\messenger\content\default
$(MAKE_INSTALL) renameFolderNameDialog.xul $(DIST)\bin\chrome\messenger\content\default $(MAKE_INSTALL) renameFolderNameDialog.xul $(DIST)\bin\chrome\messenger\content\default
$(MAKE_INSTALL) messengerdnd.js $(DIST)\bin\chrome\messenger\content\default $(MAKE_INSTALL) messengerdnd.js $(DIST)\bin\chrome\messenger\content\default
$(MAKE_INSTALL) mailContextMenus.js $(DIST)\bin\chrome\messenger\content\default
clobber:: clobber::
rm -f $(DIST)\chrome\messenger\content\default\messenger.xul rm -f $(DIST)\chrome\messenger\content\default\messenger.xul
@ -64,4 +65,6 @@ clobber::
rm -f $(DIST)\chrome\messenger\content\default\msgFolderPickerOverlay.xul rm -f $(DIST)\chrome\messenger\content\default\msgFolderPickerOverlay.xul
rm -f $(DIST)\chrome\messenger\content\default\renameFolderNameDialog.xul rm -f $(DIST)\chrome\messenger\content\default\renameFolderNameDialog.xul
rm -f $(DIST)\chrome\messenger\content\default\messengerdnd.js rm -f $(DIST)\chrome\messenger\content\default\messengerdnd.js
rm -f $(DIST)\chrome\messenger\content\default\mailContextMenus.js

Просмотреть файл

@ -51,6 +51,7 @@ Rights Reserved.
<html:script src="chrome://messenger/content/shareglue.js"/> <html:script src="chrome://messenger/content/shareglue.js"/>
<html:script src="chrome://messenger/content/msgViewNavigation.js"/> <html:script src="chrome://messenger/content/msgViewNavigation.js"/>
<html:script src="chrome://messenger/content/msgMail3PaneWindow.js"/> <html:script src="chrome://messenger/content/msgMail3PaneWindow.js"/>
<html:script src="chrome://messenger/content/mailContextMenus.js"/>
<commands id="commands"> <commands id="commands">
<commandset id="CommandUpdate_Mail" <commandset id="CommandUpdate_Mail"
@ -105,6 +106,156 @@ Rights Reserved.
onkeypress="goDoCommand('button_delete')"/> onkeypress="goDoCommand('button_delete')"/>
</keyset> </keyset>
<popupset>
<popup id="threadPaneContext" oncreate="return fillThreadPaneContextMenu();" >
<menuitem id="threadPaneContext-openNewWindow"
value="&contextOpenNewWindow.label;"
accesskey=""
oncommand="MsgOpenNewWindowForMessage();"/>
<menuitem id="threadPaneContext-editAsNew"
value="&contextEditAsNew.label;"
accesskey=""
oncommand="MsgEditMessageAsNew();"/>
<menuseparator id="threadPaneContext-sep-open"/>
<menuitem id="threadPaneContext-replySender"
value="&contextReplySender.label;"
accesskey=""
oncommand="MsgReplyMessage(null);"/>
<menuitem id="threadPaneContext-replyAll"
value="&contextReplyAll.label;"
accesskey=""
oncommand="MsgReplyToAllMessage(null);"/>
<menuitem id="threadPaneContext-forward"
value="&contextForward.label;"
accesskey=""
oncommand="MsgForwardMessage(null);"/>
<menuseparator id="threadPaneContext-sep-reply"/>
<menu id="threadPaneContext-moveMenu"
value="&contextMoveMsgMenu.label;"
datasources="rdf:null"
rdf:ignore="http://home.netscape.com/NC-rdf#MessageChild">
<menupopup/>
<template>
<rule nc:CanFileMessages="true" iscontainer="true" isempty="false">
<menupopup>
<menu uri="..." class="folderMenuItem" value="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"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
<menupopup>
<menuitem uri="..." value="&fileHereMenu.label;"
oncommand="MsgMoveMessage(event.target)"
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"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType" />
<menuseparator/>
</menupopup>
</menu>
</menupopup>
</rule>
<rule nc:CanFileMessages="false" nc:ServerType="nntp">
<!-- don't show nntp servers in the file and copies menus -->
</rule>
<rule nc:CanFileMessages="false" iscontainer="true" isempty="false">
<!-- note, there is no "file here" -->
<menupopup>
<menu uri="..." class="folderMenuItem" value="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"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
<menupopup/>
</menu>
</menupopup>
</rule>
<rule nc:CanFileMessages="true">
<menupopup>
<menuitem uri="..." class="folderMenuItem" value="rdf:http://home.netscape.com/NC-rdf#Name" oncommand="MsgMoveMessage(event.target)"
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"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"/>
</menupopup>
</rule>
</template>
</menu>
<menu id="threadPaneContext-copyMenu"
value="&contextCopyMsgMenu.label;"
datasources="rdf:null"
rdf:ignore="http://home.netscape.com/NC-rdf#MessageChild">
<menupopup/>
<template>
<rule nc:CanFileMessages="true" iscontainer="true" isempty="false">
<menupopup>
<menu uri="..." class="folderMenuItem" value="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"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
<menupopup>
<menuitem uri="..." value="&fileHereMenu.label;"
oncommand="MsgCopyMessage(event.target)"
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"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"/>
<menuseparator/>
</menupopup>
</menu>
</menupopup>
</rule>
<rule nc:CanFileMessages="false" nc:ServerType="nntp">
<!-- don't show nntp servers in the file and copies menus -->
</rule>
<rule nc:CanFileMessages="false" iscontainer="true" isempty="false">
<!-- note, there is no "file here" -->
<menupopup>
<menu uri="..." class="folderMenuItem" value="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"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType">
<menupopup/>
</menu>
</menupopup>
</rule>
<rule nc:CanFileMessages="true">
<menupopup>
<menuitem uri="..." class="folderMenuItem" value="rdf:http://home.netscape.com/NC-rdf#Name"
oncommand="MsgCopyMessage(event.target)"
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"
ServerType="rdf:http://home.netscape.com/NC-rdf#ServerType"/>
</menupopup>
</rule>
</template>
</menu>
<menuitem id="threadPaneContext-saveAs"
value="&contextSaveAs.label;"
accesskey=""
oncommand="MsgSaveAsFile();"/>
<menuitem id="threadPaneContext-print"
value="&contextPrint.label;"
accesskey=""
oncommand="Print();"/>
<menuitem id="threadPaneContext-delete"
value="&contextDelete.label;"
accesskey=""
oncommand="MsgDeleteMessage(false);"/>
<menuseparator id="threadPaneContext-sep-edit"/>
<menuitem id="threadPaneContext-addSenderToAddressBook"
value="&contextAddSenderToAddressBook.label;"
accesskey=""
oncommand="MsgAddSenderToAddressBook();"/>
<menuitem id="threadPaneContext-addAllToAddressBook"
value="&contextAddAllToAddressBook.label;"
accesskey=""
oncommand="MsgAddAllToAddressBook();"/>
</popup>
</popupset>
<menubar> <menubar>
<menu id="menu_File"> <menu id="menu_File">
<menupopup id="menu_FilePopup"> <menupopup id="menu_FilePopup">
@ -573,7 +724,7 @@ Rights Reserved.
<box align="vertical" flex="1"> <box align="vertical" flex="1">
<tree id="threadTree" flex="2" style="height:0px"/> <tree id="threadTree" flex="2" style="height:0px" context="threadPaneContext"/>
<!-- if you change this id, please change GetThreadAndMessagePaneSplitter() --> <!-- if you change this id, please change GetThreadAndMessagePaneSplitter() -->
<splitter id="gray_horizontal_splitter" collapse="after" persist="state" <splitter id="gray_horizontal_splitter" collapse="after" persist="state"

Просмотреть файл

@ -338,25 +338,20 @@ function InitMsgWindow()
function AddDataSources() function AddDataSources()
{ {
//to move menu item
accountManagerDataSource = accountManagerDataSource.QueryInterface(Components.interfaces.nsIRDFDataSource); accountManagerDataSource = accountManagerDataSource.QueryInterface(Components.interfaces.nsIRDFDataSource);
folderDataSource = folderDataSource.QueryInterface(Components.interfaces.nsIRDFDataSource); folderDataSource = folderDataSource.QueryInterface(Components.interfaces.nsIRDFDataSource);
var moveMenu = document.getElementById('moveMenu'); //to move menu item
if(moveMenu) SetupMoveCopyMenus('moveMenu', accountManagerDataSource, folderDataSource);
{
moveMenu.database.AddDataSource(accountManagerDataSource);
moveMenu.database.AddDataSource(folderDataSource);
moveMenu.setAttribute('ref', 'msgaccounts:/');
}
//to copy menu item //to copy menu item
var copyMenu = document.getElementById('copyMenu'); SetupMoveCopyMenus('copyMenu', accountManagerDataSource, folderDataSource);
if(copyMenu)
{ //To threadpane move context menu
copyMenu.database.AddDataSource(accountManagerDataSource); SetupMoveCopyMenus('threadPaneContext-moveMenu', accountManagerDataSource, folderDataSource);
copyMenu.database.AddDataSource(folderDataSource);
copyMenu.setAttribute('ref', 'msgaccounts:/'); //To threadpane copy content menu
} SetupMoveCopyMenus('threadPaneContext-copyMenu', accountManagerDataSource, folderDataSource);
//Add statusFeedback //Add statusFeedback
var msgDS = folderDataSource.QueryInterface(Components.interfaces.nsIMsgRDFDataSource); var msgDS = folderDataSource.QueryInterface(Components.interfaces.nsIMsgRDFDataSource);
@ -370,6 +365,17 @@ function AddDataSources()
} }
function SetupMoveCopyMenus(menuid, accountManagerDataSource, folderDataSource)
{
var menu = document.getElementById(menuid);
if(menu)
{
menu.database.AddDataSource(accountManagerDataSource);
menu.database.AddDataSource(folderDataSource);
menu.setAttribute('ref', 'msgaccounts:/');
}
}
function InitPanes() function InitPanes()
{ {
var threadTree = GetThreadTree(); var threadTree = GetThreadTree();

Просмотреть файл

@ -34,7 +34,9 @@ Rights Reserved.
<html:script src="chrome://global/content/treePopups.js"/> <html:script src="chrome://global/content/treePopups.js"/>
<html:script src="chrome://messenger/content/messengerdnd.js"/> <html:script src="chrome://messenger/content/messengerdnd.js"/>
<tree datasources="rdf:null" id="threadTree"
<tree datasources="rdf:null" id="threadTree"
onselect="top.ThreadPaneSelectionChange(); document.commandDispatcher.updateCommands('tree-select');" onselect="top.ThreadPaneSelectionChange(); document.commandDispatcher.updateCommands('tree-select');"
onblur="goOnEvent(this,'blur')" onblur="goOnEvent(this,'blur')"
containment="http://home.netscape.com/NC-rdf#MessageChild" containment="http://home.netscape.com/NC-rdf#MessageChild"

Просмотреть файл

@ -257,3 +257,16 @@ Rights Reserved.
<!-- Destination for click on throbber button --> <!-- Destination for click on throbber button -->
<!ENTITY throbber.url "http://www.mozilla.org/mailnews"> <!ENTITY throbber.url "http://www.mozilla.org/mailnews">
<!-- Thread Pane Context Menu -->
<!ENTITY contextOpenNewWindow.label "Open in New Window">
<!ENTITY contextEditAsNew.label "Edit As New...">
<!ENTITY contextReplySender.label "Reply To Sender">
<!ENTITY contextReplyAll.label "Reply To All">
<!ENTITY contextForward.label "Forward">
<!ENTITY contextMoveMsgMenu.label "Move To">
<!ENTITY contextCopyMsgMenu.label "Copy To">
<!ENTITY contextSaveAs.label "Save As...">
<!ENTITY contextPrint.label "Print...">
<!ENTITY contextDelete.label "Delete">
<!ENTITY contextAddSenderToAddressBook.label "Add Sender To Address Book">
<!ENTITY contextAddAllToAddressBook.label "Add All To Address Book">