From c55c5754a32fb872077d6ba1ceee5377a3954a9e Mon Sep 17 00:00:00 2001 From: "putterman%netscape.com" Date: Wed, 12 Jan 2000 02:25:35 +0000 Subject: [PATCH] Begin work on mail context menus. This is for the thread pane. r= alecf. --- mailnews/base/resources/content/MANIFEST | 1 + mailnews/base/resources/content/Makefile.in | 1 + .../base/resources/content/commandglue.js | 2 + .../resources/content/mailContextMenus.js | 91 +++++++++++ mailnews/base/resources/content/makefile.win | 3 + mailnews/base/resources/content/messenger.xul | 153 +++++++++++++++++- .../resources/content/msgMail3PaneWindow.js | 36 +++-- .../base/resources/content/threadPane.xul | 4 +- .../base/resources/locale/en-US/messenger.dtd | 13 ++ 9 files changed, 287 insertions(+), 17 deletions(-) create mode 100644 mailnews/base/resources/content/mailContextMenus.js diff --git a/mailnews/base/resources/content/MANIFEST b/mailnews/base/resources/content/MANIFEST index 89f62938b3a..4a01d934f89 100644 --- a/mailnews/base/resources/content/MANIFEST +++ b/mailnews/base/resources/content/MANIFEST @@ -39,3 +39,4 @@ msgMail3PaneWindow.js msgFolderPickerOverlay.xul msgFolderPickerOverlay.js messengerdnd.js +mailContextMenus.js diff --git a/mailnews/base/resources/content/Makefile.in b/mailnews/base/resources/content/Makefile.in index 19870a4f315..ea3a5ed06f7 100644 --- a/mailnews/base/resources/content/Makefile.in +++ b/mailnews/base/resources/content/Makefile.in @@ -48,6 +48,7 @@ EXPORT_RESOURCE_SAMPLES = \ msgFolderPickerOverlay.xul \ renameFolderNameDialog.xul \ messengerdnd.js \ + mailContextMenus.js \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/mailnews/base/resources/content/commandglue.js b/mailnews/base/resources/content/commandglue.js index d5af999ec63..2d76fb7dcc0 100644 --- a/mailnews/base/resources/content/commandglue.js +++ b/mailnews/base/resources/content/commandglue.js @@ -693,3 +693,5 @@ function GetSelectTrashUri(folder) } return null; } + + diff --git a/mailnews/base/resources/content/mailContextMenus.js b/mailnews/base/resources/content/mailContextMenus.js new file mode 100644 index 00000000000..87cb50cc83a --- /dev/null +++ b/mailnews/base/resources/content/mailContextMenus.js @@ -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'); + } +} + diff --git a/mailnews/base/resources/content/makefile.win b/mailnews/base/resources/content/makefile.win index acf714b9ab4..2fd5ca564fa 100644 --- a/mailnews/base/resources/content/makefile.win +++ b/mailnews/base/resources/content/makefile.win @@ -43,6 +43,7 @@ install:: $(MAKE_INSTALL) msgFolderPickerOverlay.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) mailContextMenus.js $(DIST)\bin\chrome\messenger\content\default clobber:: 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\renameFolderNameDialog.xul rm -f $(DIST)\chrome\messenger\content\default\messengerdnd.js + rm -f $(DIST)\chrome\messenger\content\default\mailContextMenus.js + diff --git a/mailnews/base/resources/content/messenger.xul b/mailnews/base/resources/content/messenger.xul index 55f8c0c3448..799910092a0 100644 --- a/mailnews/base/resources/content/messenger.xul +++ b/mailnews/base/resources/content/messenger.xul @@ -51,6 +51,7 @@ Rights Reserved. + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -573,7 +724,7 @@ Rights Reserved. - + - + + + + + + + + + + + + +