Bug 341010: No labels, no actions in message filters dialog; r=IanN, sr=Neil

This commit is contained in:
mnyromyr%tprac.de 2006-06-15 22:46:38 +00:00
Родитель 6163084fd4
Коммит e83f3e87c7
10 изменённых файлов: 187 добавлений и 138 удалений

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

@ -22,6 +22,7 @@
* Contributor(s):
* Pierre Phaneuf <pp@ludusdesign.com>
* Seth Spitzer <sspitzer@netscape.com>
* Karsten Düsterloh <mnyromyr@tprac.de>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -107,6 +108,7 @@
#include "nsSpamSettings.h"
#include "nsMsgContentPolicy.h"
#include "nsCidProtocolHandler.h"
#include "nsMsgTagService.h"
#ifdef XP_WIN
#include "nsMessengerWinIntegration.h"
@ -170,6 +172,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgOfflineManager)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgProgress)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSpamSettings)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCidProtocolHandler)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgTagService)
#ifdef XP_WIN
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMessengerWinIntegration, Init)
#endif
@ -420,6 +423,10 @@ static const nsModuleComponentInfo gComponents[] = {
NS_CIDPROTOCOLHANDLER_CONTRACTID,
nsCidProtocolHandlerConstructor,
},
{ "Tag Service", NS_MSGTAGSERVICE_CID,
NS_MSGTAGSERVICE_CONTRACTID,
nsMsgTagServiceConstructor,
},
#ifdef XP_WIN
{ "Windows OS Integration", NS_MESSENGERWININTEGRATION_CID,
NS_MESSENGEROSINTEGRATION_CONTRACTID,

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

@ -129,7 +129,7 @@ function fillThreadPaneContextMenu()
SetupCopyMessageUrlMenuItem("threadPaneContext-copyMessageUrl", numSelected, isNewsgroup, numSelected != 1);
SetupCopyMenuItem("threadPaneContext-copyMenu", numSelected, false);
SetupMoveMenuItem("threadPaneContext-moveMenu", numSelected, isNewsgroup, false);
EnableMenuItem("threadPaneContext-labels", (numSelected >= 1));
EnableMenuItem("threadPaneContext-tags", (numSelected >= 1));
EnableMenuItem("threadPaneContext-mark", (numSelected >= 1));
SetupSaveAsMenuItem("threadPaneContext-saveAs", numSelected, false);
SetupPrintPreviewMenuItem("threadPaneContext-printpreview", numSelected, false);
@ -207,7 +207,7 @@ function SetupCopyMenuItem(menuID, numSelected, forceHide)
EnableMenuItem(menuID, (numSelected > 0));
}
function SetupLabelsMenuItem(menuID, numSelected, forceHide)
function SetupTagsMenuItem(menuID, numSelected, forceHide)
{
ShowMenuItem(menuID, (numSelected <= 1) && !forceHide);
EnableMenuItem(menuID, (numSelected == 1));
@ -467,7 +467,7 @@ function fillMessagePaneContextMenu()
SetupCopyMessageUrlMenuItem("messagePaneContext-copyMessageUrl", numSelected, isNewsgroup, (numSelected == 0 || hideMailItems));
SetupCopyMenuItem("messagePaneContext-copyMenu", numSelected, (numSelected == 0 || hideMailItems));
SetupMoveMenuItem("messagePaneContext-moveMenu", numSelected, isNewsgroup, (numSelected == 0 || hideMailItems));
SetupLabelsMenuItem("messagePaneContext-labels", numSelected, (numSelected == 0 || hideMailItems));
SetupTagsMenuItem("messagePaneContext-tags", numSelected, (numSelected == 0 || hideMailItems));
SetupMarkMenuItem("messagePaneContext-mark", numSelected, (numSelected == 0 || hideMailItems));
SetupSaveAsMenuItem("messagePaneContext-saveAs", numSelected, (numSelected == 0 || hideMailItems));
SetupPrintPreviewMenuItem("messagePaneContext-printpreview", numSelected, (numSelected == 0 || hideMailItems));
@ -492,8 +492,8 @@ function fillMessagePaneContextMenu()
ShowMenuItem("messagePaneContext-sep-link", ShowSeparator("messagePaneContext-sep-link"));
ShowMenuItem("messagePaneContext-sep-image", ShowSeparator("messagePaneContext-sep-image"));
ShowMenuItem("messagePaneContext-sep-copy", ShowSeparator("messagePaneContext-sep-copy"));
ShowMenuItem("messagePaneContext-sep-labels-1", ShowSeparator("messagePaneContext-sep-labels-1"));
ShowMenuItem("messagePaneContext-sep-labels-2", ShowSeparator("messagePaneContext-sep-labels-2"));
ShowMenuItem("messagePaneContext-sep-tags", ShowSeparator("messagePaneContext-sep-tags"));
ShowMenuItem("messagePaneContext-sep-mark", ShowSeparator("messagePaneContext-sep-mark"));
// if we are on an non-mailto link, go ahead and hide this separator
if (gContextMenu.onLink && !gContextMenu.onMailtoLink)

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

@ -23,11 +23,12 @@
* Contributor(s):
* timeless
* slucy@objectivesw.co.uk
* Håkan Waara <hwaara@chello.se>
* Håkan Waara <hwaara@chello.se>
* Jan Varga <varga@ku.sk>
* Seth Spitzer <sspitzer@netscape.com>
* David Bienvenu <bienvenu@netscape.com>
* Ian Neal <bugzilla@arlen.demon.co.uk>
* Karsten Düsterloh <mnyromyr@tprac.de>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -413,14 +414,14 @@ function InitMessageMenu()
if(copyMenu)
copyMenu.setAttribute("disabled", !aMessage);
// Disable Forward as/Label menu items if no message is selected
// Disable Forward as/tag menu items if no message is selected
var forwardAsMenu = document.getElementById("forwardAsMenu");
if(forwardAsMenu)
forwardAsMenu.setAttribute("disabled", !aMessage);
var labelMenu = document.getElementById("labelMenu");
if(labelMenu)
labelMenu.setAttribute("disabled", !aMessage);
var tagMenu = document.getElementById("tagMenu");
if(tagMenu)
tagMenu.setAttribute("disabled", !aMessage);
// Disable mark menu when we're not in a folder
var markMenu = document.getElementById("markMenu");
@ -526,6 +527,81 @@ function SetMenuItemLabel(menuItemId, customLabel)
menuItem.setAttribute('label', customLabel);
}
function ToggleMessageTagCmd(target)
{
var key = target.getAttribute("value");
var addKey = target.getAttribute("checked") == "true";
ToggleMessageTag(key, addKey);
}
function ToggleMessageTag(key, addKey)
{
// XXX need to do all selected messages
var msgHdr = gDBView.hdrForFirstSelectedMessage;
var messages = Components.classes["@mozilla.org/supports-array;1"]
.createInstance(Components.interfaces.nsISupportsArray);
messages.AppendElement(msgHdr);
var toggler = addKey ? "addKeywordToMessages" : "removeKeywordFromMessages";
msgHdr.folder[toggler](messages, key);
}
function AddTag()
{
var args = {result: "", okCallback: AddTagCallback};
var dialog = window.openDialog("chrome://messenger/content/newTagDialog.xul",
"",
"chrome,titlebar,modal",
args);
}
function AddTagCallback(name, color)
{
var tagService = Components.classes["@mozilla.org/messenger/tagservice;1"]
.getService(Components.interfaces.nsIMsgTagService);
tagService.addTag(name, color);
try
{
ToggleMessageTag(tagService.getKeyForTag(name), true);
}
catch(ex)
{
return false;
}
return true;
}
function InitMessageTags(menuType)
{
var tagService = Components.classes["@mozilla.org/messenger/tagservice;1"]
.getService(Components.interfaces.nsIMsgTagService);
var allTags = tagService.tagEnumerator;
var allKeys = tagService.keyEnumerator;
// remove any existing non-static entries...
var menuItemId = menuType + "-tagpopup";
var menupopupNode = document.getElementById(menuItemId);
for (var i = menupopupNode.childNodes.length; i > 2; --i)
menupopupNode.removeChild(menupopupNode.firstChild);
var menuseparator = menupopupNode.firstChild;
// now rebuild the list
var msgHdr = gDBView.hdrForFirstSelectedMessage;
var curKeys = msgHdr.getStringProperty("keywords");
while (allTags.hasMore())
{
var tag = allTags.getNext();
var key = allKeys.getNext();
// TODO we want to either remove or "check" the tags that already exist
var newMenuItem = document.createElement("menuitem");
newMenuItem.setAttribute("label", tag);
newMenuItem.setAttribute("value", key);
newMenuItem.setAttribute("type", "checkbox");
var removeKey = (" " + curKeys + " ").indexOf(" " + key + " ") > -1;
newMenuItem.setAttribute('checked', removeKey);
newMenuItem.setAttribute('oncommand', 'ToggleMessageTagCmd(event.target)');
menupopupNode.insertBefore(newMenuItem, menuseparator);
}
}
function InitMessageMark()
{
var areMessagesRead = SelectedMessagesAreRead();

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

@ -24,6 +24,7 @@
Contributor(s):
Neil Rashbrook <neil@parkwaycc.co.uk>
Ian Neal <iann_bugzilla@arlen.demon.co.uk>
Karsten Düsterloh <mnyromyr@tprac.de>
Alternatively, the contents of this file may be used under the terms of
either of the GNU General Public License Version 2 or later (the "GPL"),
@ -577,45 +578,13 @@
</rule>
</template>
</menu>
<menu id="threadPaneContext-labels" label="&labelMenu.label;" accesskey="&labelMenu.accesskey;">
<menupopup onpopupshowing="InitMessageLabel('threadPaneContext')">
<menuitem
id="threadPaneContext-labelMenuItem0"
type="radio"
checked="false"
accesskey="&labelCmd0.accesskey;"
command="cmd_label0"/>
<menu id="threadPaneContext-tags" label="&tagMenu.label;" accesskey="&tagMenu.accesskey;">
<menupopup id="threadPaneContext-tagpopup" onpopupshowing="InitMessageTags('threadPaneContext')">
<menuseparator/>
<menuitem
id="threadPaneContext-labelMenuItem1"
type="radio"
checked="false"
accesskey="&labelCmd1.accesskey;"
command="cmd_label1"/>
<menuitem
id="threadPaneContext-labelMenuItem2"
type="radio"
checked="false"
accesskey="&labelCmd2.accesskey;"
command="cmd_label2"/>
<menuitem
id="threadPaneContext-labelMenuItem3"
type="radio"
checked="false"
accesskey="&labelCmd3.accesskey;"
command="cmd_label3"/>
<menuitem
id="threadPaneContext-labelMenuItem4"
type="radio"
checked="false"
accesskey="&labelCmd4.accesskey;"
command="cmd_label4"/>
<menuitem
id="threadPaneContext-labelMenuItem5"
type="radio"
checked="false"
accesskey="&labelCmd5.accesskey;"
command="cmd_label5"/>
<menuitem id="threadPaneContext-tagNew"
label="&newTag.label;"
accesskey="&newTag.accesskey;"
oncommand="AddTag()"/>
</menupopup>
</menu>
<menu id="threadPaneContext-mark" label="&markMenu.label;" accesskey="&markMenu.accesskey;">
@ -927,46 +896,14 @@
</rule>
</template>
</menu>
<menuseparator id="messagePaneContext-sep-labels-1"/>
<menu id="messagePaneContext-labels" label="&labelMenu.label;" accesskey="&labelMenu.accesskey;">
<menupopup onpopupshowing="InitMessageLabel('messagePaneContext')">
<menuitem
id="messagePaneContext-labelMenuItem0"
type="radio"
checked="false"
accesskey="&labelCmd0.accesskey;"
command="cmd_label0"/>
<menuseparator id="messagePaneContext-sep-tags"/>
<menu id="messagePaneContext-tags" label="&tagMenu.label;" accesskey="&tagMenu.accesskey;">
<menupopup id="messagePaneContext-tagpopup" onpopupshowing="InitMessageTags('messagePaneContext')">
<menuseparator/>
<menuitem
id="messagePaneContext-labelMenuItem1"
type="radio"
checked="false"
accesskey="&labelCmd1.accesskey;"
command="cmd_label1"/>
<menuitem
id="messagePaneContext-labelMenuItem2"
type="radio"
checked="false"
accesskey="&labelCmd2.accesskey;"
command="cmd_label2"/>
<menuitem
id="messagePaneContext-labelMenuItem3"
type="radio"
checked="false"
accesskey="&labelCmd3.accesskey;"
command="cmd_label3"/>
<menuitem
id="messagePaneContext-labelMenuItem4"
type="radio"
checked="false"
accesskey="&labelCmd4.accesskey;"
command="cmd_label4"/>
<menuitem
id="messagePaneContext-labelMenuItem5"
type="radio"
checked="false"
accesskey="&labelCmd5.accesskey;"
command="cmd_label5"/>
<menuitem id="messagePaneContext-tagNew"
label="&newTag.label;"
accesskey="&newTag.accesskey;"
oncommand="AddTag()"/>
</menupopup>
</menu>
<menu id="messagePaneContext-mark" label="&markMenu.label;" accesskey="&markMenu.accesskey;">
@ -1009,7 +946,7 @@
command="cmd_markAsNotPhish"/>
</menupopup>
</menu>
<menuseparator id="messagePaneContext-sep-labels-2"/>
<menuseparator id="messagePaneContext-sep-mark"/>
<menuitem id="messagePaneContext-saveAs"
label="&contextSaveAs.label;"
accesskey="&contextSaveAs.accesskey;"
@ -1629,45 +1566,13 @@
</rule>
</template>
</menu>
<menu id="labelMenu" label="&labelMenu.label;" accesskey="&labelMenu.accesskey;">
<menupopup id="menuPopup-labels" onpopupshowing="InitMessageLabel('menuPopup')">
<menuitem
id="menuPopup-labelMenuItem0"
type="radio"
checked="false"
accesskey="&labelCmd0.accesskey;"
command="cmd_label0"/>
<menu id="tagMenu" label="&tagMenu.label;" accesskey="&tagMenu.accesskey;">
<menupopup id="tagMenu-tagpopup" onpopupshowing="InitMessageTags('tagMenu')">
<menuseparator/>
<menuitem
id="menuPopup-labelMenuItem1"
type="radio"
checked="false"
accesskey="&labelCmd1.accesskey;"
command="cmd_label1"/>
<menuitem
id="menuPopup-labelMenuItem2"
type="radio"
checked="false"
accesskey="&labelCmd2.accesskey;"
command="cmd_label2"/>
<menuitem
id="menuPopup-labelMenuItem3"
type="radio"
checked="false"
accesskey="&labelCmd3.accesskey;"
command="cmd_label3"/>
<menuitem
id="menuPopup-labelMenuItem4"
type="radio"
checked="false"
accesskey="&labelCmd4.accesskey;"
command="cmd_label4"/>
<menuitem
id="menuPopup-labelMenuItem5"
type="radio"
checked="false"
accesskey="&labelCmd5.accesskey;"
command="cmd_label5"/>
<menuitem id="tagMenu-tagNew"
label="&newTag.label;"
accesskey="&newTag.accesskey;"
oncommand="AddTag()"/>
</menupopup>
</menu>
<menu id="markMenu" label="&markMenu.label;" accesskey="&markMenu.accesskey;">

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

@ -22,6 +22,7 @@
*
* Contributor(s):
* David Bienvenu <bienvenu@nventure.com>
* Karsten Düsterloh <mnyromyr@tprac.de>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -73,18 +74,13 @@ function onOK()
var messengerBundle = document.getElementById("bundle_messenger");
var alertText = messengerBundle.getString("tagExists");
window.alert(alertText);
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
promptService.alert(window, document.title, alertText);
return false;
}
function doEnabling()
{
if (dialog.nameField.value) {
if (dialog.OKButton.disabled)
dialog.OKButton.disabled = false;
} else {
if (!dialog.OKButton.disabled)
dialog.OKButton.disabled = true;
}
dialog.OKButton.disabled = !dialog.nameField.value;
}

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

@ -20,6 +20,7 @@
the Initial Developer. All Rights Reserved.
Contributor(s):
Karsten Düsterloh <mnyromyr@tprac.de>
Alternatively, the contents of this file may be used under the terms of
either of the GNU General Public License Version 2 or later (the "GPL"),
@ -391,8 +392,10 @@
<!ENTITY addSenderToAddressBookCmd.accesskey "S">
<!ENTITY addAllToAddressBookCmd.label ".Add All to Address Book">
<!ENTITY addAllToAddressBookCmd.accesskey "A">
<!ENTITY labelMenu.label "Label">
<!ENTITY labelMenu.accesskey "L">
<!ENTITY tagMenu.label "Tag">
<!ENTITY tagMenu.accesskey "g">
<!ENTITY newTag.label "New Tag...">
<!ENTITY newTag.accesskey "N">
<!ENTITY labelCmd0.accesskey "0">
<!ENTITY labelCmd0.key "0">
<!ENTITY labelCmd1.label "1">

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

@ -21,6 +21,7 @@
# Contributor(s):
# Seth Spitzer <sspitzer@netscape.com>
# Lorenzo Colitti <lorenzo@colitti.com>
# Karsten Düsterloh <mnyromyr@tprac.de>
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
@ -354,6 +355,9 @@ passwordTitle=Mail Server Password Required
openWindowWarningTitle=Confirm
openWindowWarningText=Opening %S messages may be slow. Continue?
# for warning the user that a tag he's trying to create already exists
tagExists=A tag with that name already exists!
# for checking if the user really wants to delete the adaptive filter training set
confirmResetJunkTrainingTitle=Confirm
confirmResetJunkTrainingText=Are you sure you want to reset the adaptive filter training data?

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

@ -1,3 +1,57 @@
<!-- ***** BEGIN LICENSE BLOCK *****
Version: MPL 1.1/GPL 2.0/LGPL 2.1
The contents of this file are subject to the Mozilla 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/MPL/
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 the Initial Developer are Copyright (C) 1998-1999
the Initial Developer. All Rights Reserved.
Contributor(s):
Alec Flett <alecf@netscape.com>
Seth Spitzer <sspitzer@netscape.com>
Allan Masri <amasri@netscape.com>
Henrik Gemal <bugzilla@gemal.dk>
Gayatri Bhimaraju <gayatrib@netscape.com>
Stephen Donner <stephend@netscape.com>
Gervase Markham <gervase.markham@univ.ox.ac.uk>
Håkan Waara <hwaara@chello.se>
Navin Gupta <naving@netscape.com>
David Bienvenu <bienvenu@netscape.com>
Sean Su <ssu@netscape.com>
Serge Gautheri <gautheri@noos.fr>
Scott MacGregor <scott@scott-macgregor.org>
Howard Chu <hyc@symas.com>
Mark Banner <mark@standard8.demon.co.uk>
Mike Shaver <shaver@mozilla.org>
Karsten Düsterloh <mnyromyr@tprac.de>
Alternatively, the contents of this file may be used under the terms of
either of the GNU General Public License Version 2 or later (the "GPL"),
or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
in which case the provisions of the GPL or the LGPL are applicable instead
of those above. If you wish to allow use of your version of this file only
under the terms of either the GPL or the LGPL, and not to allow others to
use your version of this file under the terms of the MPL, indicate your
decision by deleting the provisions above and replace them with the notice
and other provisions required by the GPL or the LGPL. If you do not delete
the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL.
***** END LICENSE BLOCK ***** -->
<!ENTITY window.title "Filter Rules">
<!ENTITY subject.label "subject">
<!ENTITY sender.label "sender">
@ -44,6 +98,7 @@
<!ENTITY markMessageFlagged.label "Mark As Flagged">
<!ENTITY labelMessage.label "Label Message As">
<!ENTITY setPriority.label "Set Priority to">
<!ENTITY addTag.label "Tag Message">
<!ENTITY setJunkScore.label "Set Junk Status to">
<!ENTITY deleteMessage.label "Delete Message">
<!ENTITY deleteFromPOP.label "Delete From POP Server">

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

@ -50,5 +50,5 @@
46=Attachment Status
47=Junk Status
48=Label
49=Customize
# don't use above 49
49=Customize...

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

@ -117,6 +117,8 @@ messenger.jar:
content/messenger/subscribe.js (base/resources/content/subscribe.js)
content/messenger/newFolderDialog.xul (base/resources/content/newFolderDialog.xul)
content/messenger/newFolderDialog.js (base/resources/content/newFolderDialog.js)
content/messenger/newTagDialog.xul (base/resources/content/newTagDialog.xul)
content/messenger/newTagDialog.js (base/resources/content/newTagDialog.js)
content/messenger/msgViewNavigation.js (base/resources/content/msgViewNavigation.js)
content/messenger/msgMail3PaneWindow.js (base/resources/content/msgMail3PaneWindow.js)
content/messenger/searchBar.js (base/resources/content/searchBar.js)
@ -206,6 +208,7 @@ en-US.jar:
locale/en-US/messenger/messenger.properties (base/resources/locale/en-US/messenger.properties)
locale/en-US/messenger/threadpane.dtd (base/resources/locale/en-US/threadpane.dtd)
locale/en-US/messenger/folderpane.dtd (base/resources/locale/en-US/folderpane.dtd)
locale/en-US/messenger/newTagDialog.dtd (base/resources/locale/en-US/newTagDialog.dtd)
locale/en-US/messenger/newFolderDialog.dtd (base/resources/locale/en-US/newFolderDialog.dtd)
locale/en-US/messenger/renameFolderDialog.dtd (base/resources/locale/en-US/renameFolderDialog.dtd)
locale/en-US/messenger/virtualFolderProperties.dtd (base/resources/locale/en-US/virtualFolderProperties.dtd)