From 30ff878a2ea17468e7a488b81d3eace5d1b1a921 Mon Sep 17 00:00:00 2001 From: "ssu%netscape.com" Date: Fri, 7 Dec 2001 21:37:22 +0000 Subject: [PATCH] fixing bug 81292 - RFE: Labels feature to help users organize their messages. r=sspitzer, sr=beinvenu --- .../base/prefs/resources/content/MANIFEST | 2 + .../resources/content/mailPrefsOverlay.xul | 5 + .../base/prefs/resources/content/makefile.win | 83 --- .../prefs/resources/content/pref-labels.js | 102 ++++ .../prefs/resources/content/pref-labels.xul | 188 ++++++ .../prefs/resources/locale/en-US/MANIFEST | 1 + .../locale/en-US/mailPrefsOverlay.dtd | 1 + .../prefs/resources/locale/en-US/makefile.win | 58 -- .../resources/locale/en-US/pref-labels.dtd | 42 ++ mailnews/base/public/nsIMsgDBView.idl | 13 +- .../content/mail3PaneWindowCommands.js | 5 + .../resources/content/mailWindowOverlay.js | 48 +- .../resources/content/mailWindowOverlay.xul | 95 ++- .../base/resources/content/threadPane.xul | 3 +- .../base/resources/locale/en-US/messenger.dtd | 5 +- .../locale/en-US/messenger.properties | 27 + mailnews/base/src/nsMsgDBView.cpp | 339 ++++++++++- mailnews/base/src/nsMsgDBView.h | 33 +- mailnews/jar.mn | 3 + mailnews/mailnews.js | 19 + modules/libpref/src/init/mailnews.js | 19 + themes/classic/messenger/mac/jar.mn | 20 - themes/classic/messenger/mac/threadPane.css | 6 +- .../messenger/mac/threadPaneLabels.css | 0 themes/classic/messenger/win/jar.mn | 20 - themes/classic/messenger/win/threadPane.css | 6 +- .../messenger/win/threadPaneLabels.css | 0 themes/modern/jar.mn | 1 + themes/modern/messenger/threadPane.css | 6 +- themes/modern/messenger/threadPaneLabels.css | 562 ++++++++++++++++++ 30 files changed, 1489 insertions(+), 223 deletions(-) create mode 100644 mailnews/base/prefs/resources/content/pref-labels.js create mode 100644 mailnews/base/prefs/resources/content/pref-labels.xul create mode 100644 mailnews/base/prefs/resources/locale/en-US/pref-labels.dtd create mode 100644 themes/classic/messenger/mac/threadPaneLabels.css create mode 100644 themes/classic/messenger/win/threadPaneLabels.css create mode 100644 themes/modern/messenger/threadPaneLabels.css diff --git a/mailnews/base/prefs/resources/content/MANIFEST b/mailnews/base/prefs/resources/content/MANIFEST index 0522bc5f599..e96e4396f34 100644 --- a/mailnews/base/prefs/resources/content/MANIFEST +++ b/mailnews/base/prefs/resources/content/MANIFEST @@ -73,3 +73,5 @@ mailPrefsOverlay.xul am-prefs.js am-offline.xul am-offline.js +pref-labels.xul +pref-labels.js diff --git a/mailnews/base/prefs/resources/content/mailPrefsOverlay.xul b/mailnews/base/prefs/resources/content/mailPrefsOverlay.xul index 4fceb3cfeee..4bab0ceb85c 100644 --- a/mailnews/base/prefs/resources/content/mailPrefsOverlay.xul +++ b/mailnews/base/prefs/resources/content/mailPrefsOverlay.xul @@ -70,6 +70,11 @@ + + + + + diff --git a/mailnews/base/prefs/resources/content/makefile.win b/mailnews/base/prefs/resources/content/makefile.win index 50724b5fb16..e69de29bb2d 100644 --- a/mailnews/base/prefs/resources/content/makefile.win +++ b/mailnews/base/prefs/resources/content/makefile.win @@ -1,83 +0,0 @@ -#!nmake -# -# 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.org code. -# -# The Initial Developer of the Original Code is Netscape -# Communications Corporation. Portions created by Netscape are -# Copyright (C) 1998 Netscape Communications Corporation. All -# Rights Reserved. -# -# Contributor(s): - -DEPTH=..\..\..\..\.. - -CHROME_DIR = packages\messenger -CHROME_CONTENT_DIR = messenger\content - -CHROME_CONTENT = \ - .\AccountManager.xul \ - .\AccountManager.js \ - .\am-main.xul \ - .\am-main.js \ - .\am-identity-advanced.xul \ - .\am-identity-advanced.js \ - .\am-server.xul \ - .\am-serverwithnoidentities.xul \ - .\am-serverwithnoidentities.js \ - .\am-server.js \ - .\am-server-top.xul \ - .\am-copies.xul \ - .\am-copies.js \ - .\am-advanced.xul \ - .\am-imap-advanced.xul \ - .\am-imap-advanced.js \ - .\am-smtp.xul \ - .\am-smtp.js \ - .\pref-advanced_overlay.xul \ - .\pref-appearance_overlay.xul \ - .\pref-mailnews.xul \ - .\pref-mailnews.js \ - .\pref-viewing_messages.xul \ - .\pref-receipts.xul \ - .\custreceipt.xul \ - .\AccountWizard.xul \ - .\AccountWizard.js \ - .\aw-wizardAdapter.js \ - .\aw-accounttype.xul \ - .\aw-accounttype.js \ - .\aw-identity.xul \ - .\aw-identity.js \ - .\aw-server.xul \ - .\aw-newsserver.xul \ - .\aw-server.js \ - .\aw-login.xul \ - .\aw-login.js \ - .\aw-accname.xul \ - .\aw-accname.js \ - .\aw-done.xul \ - .\aw-done.js \ - .\accountUtils.js \ - .\ispUtils.js \ - .\SmtpServerList.xul \ - .\SmtpServerList.js \ - .\SmtpServerEdit.xul \ - .\SmtpServerEdit.js \ - .\smtpEditOverlay.xul \ - .\smtpEditOverlay.js \ - .\mailPrefsOverlay.xul \ - .\am-offline.xul \ - .\am-offline.js \ - $(NULL) - -include <$(DEPTH)\config\rules.mak> - diff --git a/mailnews/base/prefs/resources/content/pref-labels.js b/mailnews/base/prefs/resources/content/pref-labels.js new file mode 100644 index 00000000000..870b11af79a --- /dev/null +++ b/mailnews/base/prefs/resources/content/pref-labels.js @@ -0,0 +1,102 @@ +/* ***** 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. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corp. + * Portions created by the Initial Developer are Copyright (C) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Sean Su + * + * 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 + * 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 ***** */ + +function setColorWell(aPicker) +{ + var colorRef; + + colorRef = aPicker.nextSibling; // colour value is held here + colorRef.setAttribute( "value", aPicker.color ); +} + +function getColorFromWellAndSetValue(aPickerId) +{ + var picker; + var colorRef; + var color; + + picker = document.getElementById(aPickerId); + colorRef = picker.nextSibling; + color = colorRef.getAttribute("value"); + picker.color = color; + + return color; +} + +function Startup() +{ + getColorFromWellAndSetValue("labelColorPicker1"); + getColorFromWellAndSetValue("labelColorPicker2"); + getColorFromWellAndSetValue("labelColorPicker3"); + getColorFromWellAndSetValue("labelColorPicker4"); + getColorFromWellAndSetValue("labelColorPicker5"); + + return true; +} + +/* Function to restore pref values to application defaults */ +function restoreColorAndDescriptionToDefaults() +{ + var prefColor; + var description; + var pickerColor; + var dataColor; + var labelDescription; + var prefService = Components.classes["@mozilla.org/preferences-service;1"] + .getService(Components.interfaces.nsIPrefService); + var prefs = prefService.getDefaultBranch(null); + + /* there are only 5 labels */ + for(var i = 1; i <= 5; i++) + { + /* set the default description from prefs */ + description = prefs.getComplexValue("mailnews.labels.description." + i, + Components.interfaces.nsIPrefLocalizedString).data; + labelDescription = document.getElementById("label" + i + "TextBox"); + labelDescription.value = description; + + /* set the default color from prefs */ + prefColor = prefs.getCharPref("mailnews.labels.color." + i); + pickerColor = document.getElementById("labelColorPicker" + i); + pickerColor.color = prefColor; + + // need to call setColorWell() so that the default pref value will be updated + // in the preferences file. + setColorWell(pickerColor); + } +} + diff --git a/mailnews/base/prefs/resources/content/pref-labels.xul b/mailnews/base/prefs/resources/content/pref-labels.xul new file mode 100644 index 00000000000..4262a87a478 --- /dev/null +++ b/mailnews/base/prefs/resources/content/pref-labels.xul @@ -0,0 +1,188 @@ + + + + + + + + + + + + + + + + + + +