From 82e628aef93b2025f37cdba16872e46accfa0a1d Mon Sep 17 00:00:00 2001 From: "sspitzer%netscape.com" Date: Fri, 20 Sep 2002 00:04:01 +0000 Subject: [PATCH] land spam UI: control panel UI, spam log UI, toolbar button, tools menu, thread pane UI. currently, hidden by default. more work to come. r/sr=bienvenu. bug #169638 git-svn-id: svn://10.0.0.236/trunk@130091 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/mailnews/base/build/nsMsgBaseCID.h | 11 ++ mozilla/mailnews/base/build/nsMsgFactory.cpp | 7 + mozilla/mailnews/base/public/Makefile.in | 1 + mozilla/mailnews/base/public/nsIMsgDBView.idl | 3 + .../mailnews/base/public/nsIMsgIdentity.idl | 1 - .../base/public/nsIMsgIncomingServer.idl | 9 +- .../base/resources/content/commandglue.js | 6 + .../content/mail3PaneWindowCommands.js | 8 ++ .../base/resources/content/mailCommands.js | 19 +-- .../resources/content/mailWindowOverlay.js | 19 +++ .../resources/content/mailWindowOverlay.xul | 7 +- .../base/resources/content/messageWindow.js | 6 + .../base/resources/content/threadPane.js | 6 + .../base/resources/content/threadPane.xul | 4 + .../base/resources/locale/en-US/messenger.dtd | 4 + .../resources/locale/en-US/threadpane.dtd | 1 + .../base/search/src/nsMsgFilterList.cpp | 6 +- mozilla/mailnews/base/src/Makefile.in | 1 + mozilla/mailnews/base/src/nsMsgDBView.cpp | 42 +++++- mozilla/mailnews/base/src/nsMsgDBView.h | 2 + mozilla/mailnews/base/util/nsMsgIdentity.cpp | 1 - .../base/util/nsMsgIncomingServer.cpp | 124 ++++++++++++++++++ .../mailnews/base/util/nsMsgIncomingServer.h | 10 +- .../db/msgdb/public/nsIMsgDatabase.idl | 2 +- .../mailnews/db/msgdb/src/nsMsgDatabase.cpp | 13 ++ mozilla/mailnews/mailnews.js | 11 +- mozilla/modules/libpref/src/init/mailnews.js | 11 +- .../classic/messenger/primaryToolbar.css | 15 +++ .../modern/messenger/primaryToolbar.css | 15 +++ 29 files changed, 339 insertions(+), 26 deletions(-) diff --git a/mozilla/mailnews/base/build/nsMsgBaseCID.h b/mozilla/mailnews/base/build/nsMsgBaseCID.h index 0d111e2d46b..844c88a82ed 100644 --- a/mozilla/mailnews/base/build/nsMsgBaseCID.h +++ b/mozilla/mailnews/base/build/nsMsgBaseCID.h @@ -438,6 +438,17 @@ 0x9f4dd201, 0x3b1f, 0x11d5, \ {0x9d, 0xaa, 0xc3, 0x45, 0xc9, 0x45, 0x3d, 0x3c }} +// +// nsSpamSettings +// +#define NS_SPAMSETTINGS_CONTRACTID \ + "@mozilla.org/messenger/spamsettings;1" + +#define NS_SPAMSETTINGS_CID \ +{ /* ce6038ae-e5e0-4372-9cff-2a6633333b2b */ \ + 0xce6038ae, 0xe5e0, 0x4372, \ + {0x9c, 0xff, 0x2a, 0x66, 0x33, 0x33, 0x3b, 0x2b }} + // // nsMessengerOSIntegration // diff --git a/mozilla/mailnews/base/build/nsMsgFactory.cpp b/mozilla/mailnews/base/build/nsMsgFactory.cpp index 6fcbdaee3fe..b86780b9de0 100644 --- a/mozilla/mailnews/base/build/nsMsgFactory.cpp +++ b/mozilla/mailnews/base/build/nsMsgFactory.cpp @@ -21,6 +21,7 @@ * * Contributor(s): * Pierre Phaneuf + * Seth Spitzer * * 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 @@ -101,6 +102,7 @@ #include "nsMsgOfflineManager.h" #include "nsMsgProgress.h" +#include "nsSpamSettings.h" #ifdef XP_WIN #include "nsMessengerWinIntegration.h" @@ -146,6 +148,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgSearchDBView); NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgQuickSearchDBView); NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgOfflineManager); NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgProgress); +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSpamSettings); #ifdef XP_WIN NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMessengerWinIntegration, Init); #endif @@ -320,6 +323,10 @@ static const nsModuleComponentInfo gComponents[] = { NS_MSGPROGRESS_CONTRACTID, nsMsgProgressConstructor, }, + { "Spam Settings", NS_SPAMSETTINGS_CID, + NS_SPAMSETTINGS_CONTRACTID, + nsSpamSettingsConstructor, + }, #ifdef XP_WIN { "Windows OS Integration", NS_MESSENGERWININTEGRATION_CID, NS_MESSENGEROSINTEGRATION_CONTRACTID, diff --git a/mozilla/mailnews/base/public/Makefile.in b/mozilla/mailnews/base/public/Makefile.in index b899f05a683..d6da781251c 100644 --- a/mozilla/mailnews/base/public/Makefile.in +++ b/mozilla/mailnews/base/public/Makefile.in @@ -79,6 +79,7 @@ XPIDLSRCS = \ nsIMsgProgress.idl \ nsIMessengerOSIntegration.idl \ nsIMsgMdnGenerator.idl \ + nsISpamSettings.idl \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/mozilla/mailnews/base/public/nsIMsgDBView.idl b/mozilla/mailnews/base/public/nsIMsgDBView.idl index e46606ab41c..ebdf5cb461a 100644 --- a/mozilla/mailnews/base/public/nsIMsgDBView.idl +++ b/mozilla/mailnews/base/public/nsIMsgDBView.idl @@ -95,6 +95,7 @@ interface nsMsgViewSortType const nsMsgViewSortTypeValue byRecipient = 0x1c; const nsMsgViewSortTypeValue byLocation = 0x1d; const nsMsgViewSortTypeValue byLabel = 0x1e; + const nsMsgViewSortTypeValue byScore = 0x1f; }; [scriptable, uuid(255d1c1e-fde7-11d4-a5be-0060b0fc04b7)] @@ -196,6 +197,8 @@ interface nsMsgViewCommandType const nsMsgViewCommandTypeValue label5 = 26; const nsMsgViewCommandTypeValue lastLabel = 26; + const nsMsgViewCommandTypeValue junk = 27; + const nsMsgViewCommandTypeValue unjunk = 28; }; [scriptable, uuid(65903eb2-1dd2-11b2-ac45-c5b69c1618d7)] diff --git a/mozilla/mailnews/base/public/nsIMsgIdentity.idl b/mozilla/mailnews/base/public/nsIMsgIdentity.idl index 63bed5f0550..006583b079a 100644 --- a/mozilla/mailnews/base/public/nsIMsgIdentity.idl +++ b/mozilla/mailnews/base/public/nsIMsgIdentity.idl @@ -104,7 +104,6 @@ interface nsIMsgIdentity : nsISupports { attribute string draftFolder; attribute string stationeryFolder; - attribute string junkMailFolder; attribute boolean showSaveMsgDlg; attribute string directoryServer; attribute boolean overrideGlobalPref; diff --git a/mozilla/mailnews/base/public/nsIMsgIncomingServer.idl b/mozilla/mailnews/base/public/nsIMsgIncomingServer.idl index 5ab76cb327b..1d4c1750fcf 100644 --- a/mozilla/mailnews/base/public/nsIMsgIncomingServer.idl +++ b/mozilla/mailnews/base/public/nsIMsgIncomingServer.idl @@ -20,6 +20,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): + * Seth Spitzer * * 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 @@ -46,6 +47,7 @@ interface nsIMsgWindow; interface nsIMsgFilterList; interface nsIMsgRetentionSettings; interface nsIMsgDownloadSettings; +interface nsISpamSettings; /* * Interface for incoming mail/news host @@ -148,7 +150,6 @@ interface nsIMsgIncomingServer : nsISupports { /* the on-disk path to message storage for this server */ attribute nsIFileSpec localPath; - /* the RDF URI for the root mail folder */ readonly attribute string serverURI; @@ -308,7 +309,6 @@ interface nsIMsgIncomingServer : nsISupports { */ attribute boolean defaultCopiesAndFoldersPrefsToServer; - /* can this server allows sub folder creation */ attribute boolean canCreateFoldersOnServer; @@ -362,6 +362,11 @@ interface nsIMsgIncomingServer : nsISupports { * the existing return receipts filter, if it exists. */ void configureTemporaryReturnReceiptsFilter(in nsIMsgFilterList filterList); + + /** + * spam settings + */ + attribute nsISpamSettings spamSettings; }; %{C++ diff --git a/mozilla/mailnews/base/resources/content/commandglue.js b/mozilla/mailnews/base/resources/content/commandglue.js index ca6c4c21be1..3db4a45a340 100644 --- a/mozilla/mailnews/base/resources/content/commandglue.js +++ b/mozilla/mailnews/base/resources/content/commandglue.js @@ -478,6 +478,9 @@ function ConvertColumnIDToSortType(columnID) case "labelCol": sortKey = nsMsgViewSortType.byLabel; break; + case "scoreCol": + sortKey = nsMsgViewSortType.byScore; + break; default: dump("unsupported sort column: " + columnID + "\n"); sortKey = 0; @@ -533,6 +536,9 @@ function ConvertSortTypeToColumnID(sortKey) // there is no orderReceivedCol, so return null columnID = null; break; + case nsMsgViewSortType.byScore: + columnID = "scoreCol"; + break; default: dump("unsupported sort key: " + sortKey + "\n"); columnID = null; diff --git a/mozilla/mailnews/base/resources/content/mail3PaneWindowCommands.js b/mozilla/mailnews/base/resources/content/mail3PaneWindowCommands.js index 20da07879ea..e11e69c813c 100644 --- a/mozilla/mailnews/base/resources/content/mail3PaneWindowCommands.js +++ b/mozilla/mailnews/base/resources/content/mail3PaneWindowCommands.js @@ -223,6 +223,7 @@ var DefaultController = case "cmd_createFilterFromMenu": case "cmd_delete": case "button_delete": + case "button_junk": case "cmd_shiftDelete": case "cmd_nextMsg": case "button_next": @@ -317,6 +318,10 @@ var DefaultController = if (gDBView) gDBView.getCommandStatus(nsMsgViewCommandType.deleteNoTrash, enabled, checkStatus); return enabled.value; + case "button_junk": + if (gDBView) + gDBView.getCommandStatus(nsMsgViewCommandType.junk, enabled, checkStatus); + return enabled.value; case "cmd_killThread": return ((GetNumSelectedMessages() == 1) && MailAreaHasFocus() && IsViewNavigationItemEnabled()); case "cmd_watchThread": @@ -610,6 +615,9 @@ var DefaultController = case "cmd_markAllRead": gDBView.doCommand(nsMsgViewCommandType.markAllRead); return; + case "button_junk": + MsgJunk(); + return; case "cmd_stop": MsgStop(); return; diff --git a/mozilla/mailnews/base/resources/content/mailCommands.js b/mozilla/mailnews/base/resources/content/mailCommands.js index dbee53beba5..9627c3f01d5 100644 --- a/mozilla/mailnews/base/resources/content/mailCommands.js +++ b/mozilla/mailnews/base/resources/content/mailCommands.js @@ -357,24 +357,19 @@ function SaveAsTemplate(uri, folder) } } +function JunkSelectedMessages(setAsJunk) +{ + gDBView.doCommand(setAsJunk ? nsMsgViewCommandType.junk : nsMsgViewCommandType.unjunk); +} + function MarkSelectedMessagesRead(markRead) { - if (markRead) { - gDBView.doCommand(nsMsgViewCommandType.markMessagesRead); - } - else { - gDBView.doCommand(nsMsgViewCommandType.markMessagesUnread); - } + gDBView.doCommand(markRead ? nsMsgViewCommandType.markMessagesRead : nsMsgViewCommandType.markMessagesUnread); } function MarkSelectedMessagesFlagged(markFlagged) { - if (markFlagged) { - gDBView.doCommand(nsMsgViewCommandType.flagMessages); - } - else { - gDBView.doCommand(nsMsgViewCommandType.unflagMessages); - } + gDBView.doCommand(markFlagged ? nsMsgViewCommandType.flagMessages : nsMsgViewCommandType.unflagMessages); } function MarkAllMessagesRead(compositeDataSource, folder) diff --git a/mozilla/mailnews/base/resources/content/mailWindowOverlay.js b/mozilla/mailnews/base/resources/content/mailWindowOverlay.js index e0713349c76..f07e08e4039 100644 --- a/mozilla/mailnews/base/resources/content/mailWindowOverlay.js +++ b/mozilla/mailnews/base/resources/content/mailWindowOverlay.js @@ -208,6 +208,7 @@ function InitViewSortByMenu() setSortByMenuItemCheckState("sortByThreadMenuitem", (sortType == nsMsgViewSortType.byThread)); setSortByMenuItemCheckState("sortByUnreadMenuitem", (sortType == nsMsgViewSortType.byUnread)); setSortByMenuItemCheckState("sortByLabelMenuitem", (sortType == nsMsgViewSortType.byLabel)); + setSortByMenuItemCheckState("sortByScoreMenuitem", (sortType == nsMsgViewSortType.byScore)); // the Sender / Recipient menu is dynamic setSortByMenuItemCheckState("sortBySenderOrRecipientMenuitem", (sortType == nsMsgViewSortType.byAuthor) || (sortType == nsMsgViewSortType.byRecipient)); @@ -543,6 +544,19 @@ function SelectedMessagesAreDeleted() } } +function SelectedMessagesAreJunk() +{ + var isJunk; + try { + var score = gDBView.hdrForFirstSelectedMessage.getStringProperty("score"); + isJunk = ((score != "") && (score != "0")); + } + catch (ex) { + isJunk = false; + } + return isJunk; +} + function SelectedMessagesAreRead() { var isRead; @@ -1118,6 +1132,11 @@ function CloseMailWindow() window.close(); } +function MsgJunk() +{ + JunkSelectedMessages(!SelectedMessagesAreJunk()); +} + function MsgMarkMsgAsRead(markRead) { if (!markRead) { diff --git a/mozilla/mailnews/base/resources/content/mailWindowOverlay.xul b/mozilla/mailnews/base/resources/content/mailWindowOverlay.xul index 0105af66a22..4f303f6e6a6 100644 --- a/mozilla/mailnews/base/resources/content/mailWindowOverlay.xul +++ b/mozilla/mailnews/base/resources/content/mailWindowOverlay.xul @@ -228,6 +228,7 @@ Rights Reserved. + @@ -1074,6 +1075,7 @@ Rights Reserved. + @@ -1414,7 +1416,7 @@ Rights Reserved. -