This commit is contained in:
scott%scott-macgregor.org 2006-12-02 07:27:04 +00:00
Родитель 18bb702c99
Коммит 82ba36af7d
3 изменённых файлов: 104 добавлений и 104 удалений

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

@ -663,8 +663,8 @@ function InitMessageTags(menuPopup)
var removeKey = (" " + curKeys + " ").indexOf(" " + taginfo.key + " ") > -1;
newMenuItem.setAttribute('checked', removeKey);
newMenuItem.setAttribute('oncommand', 'ToggleMessageTagMenu(event.target);');
var color = taginfo.color;
if (color)
var color = taginfo.color;
if (color)
newMenuItem.setAttribute("class", "lc-" + color.substr(1));
menuPopup.insertBefore(newMenuItem, menuseparator);
}

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

@ -522,52 +522,52 @@ var messageHeaderSink = {
}
};
function SetTagHeader()
{
// it would be nice if we passed in the msgHdr from the back end
var msgHdr;
try
{
msgHdr = gDBView.hdrForFirstSelectedMessage;
}
catch (ex)
{
return; // no msgHdr to add our tags to
}
// get the list of known tags
var tagService = Components.classes["@mozilla.org/messenger/tagservice;1"]
.getService(Components.interfaces.nsIMsgTagService);
var tagArray = tagService.getAllTags({});
var tagKeys = {};
for each (var tagInfo in tagArray)
if (tagInfo.tag)
tagKeys[tagInfo.key] = true;
// extract the tag keys from the msgHdr
var msgKeyArray = msgHdr.getStringProperty("keywords").split(" ");
// attach legacy label to the front if not already there
var label = msgHdr.label;
if (label)
{
var labelKey = "$label" + label;
if (msgKeyArray.indexOf(labelKey) < 0)
msgKeyArray.unshift(labelKey);
}
// Rebuild the keywords string with just the keys that are actual tags or
// legacy labels and not other keywords like Junk and NonJunk.
// Retain their order, though, with the label as oldest element.
for (var i = msgKeyArray.length - 1; i >= 0; --i)
if (!(msgKeyArray[i] in tagKeys))
msgKeyArray.splice(i, 1); // remove non-tag key
var msgKeys = msgKeyArray.join(" ");
if (msgKeys)
currentHeaderData.tags = {headerName: "tags", headerValue: msgKeys};
else // no more tags, so clear out the header field
delete currentHeaderData.tags;
function SetTagHeader()
{
// it would be nice if we passed in the msgHdr from the back end
var msgHdr;
try
{
msgHdr = gDBView.hdrForFirstSelectedMessage;
}
catch (ex)
{
return; // no msgHdr to add our tags to
}
// get the list of known tags
var tagService = Components.classes["@mozilla.org/messenger/tagservice;1"]
.getService(Components.interfaces.nsIMsgTagService);
var tagArray = tagService.getAllTags({});
var tagKeys = {};
for each (var tagInfo in tagArray)
if (tagInfo.tag)
tagKeys[tagInfo.key] = true;
// extract the tag keys from the msgHdr
var msgKeyArray = msgHdr.getStringProperty("keywords").split(" ");
// attach legacy label to the front if not already there
var label = msgHdr.label;
if (label)
{
var labelKey = "$label" + label;
if (msgKeyArray.indexOf(labelKey) < 0)
msgKeyArray.unshift(labelKey);
}
// Rebuild the keywords string with just the keys that are actual tags or
// legacy labels and not other keywords like Junk and NonJunk.
// Retain their order, though, with the label as oldest element.
for (var i = msgKeyArray.length - 1; i >= 0; --i)
if (!(msgKeyArray[i] in tagKeys))
msgKeyArray.splice(i, 1); // remove non-tag key
var msgKeys = msgKeyArray.join(" ");
if (msgKeys)
currentHeaderData.tags = {headerName: "tags", headerValue: msgKeys};
else // no more tags, so clear out the header field
delete currentHeaderData.tags;
}
function EnsureSubjectValue()
@ -587,28 +587,28 @@ function CheckNotify()
NotifyClearAddresses();
}
function OnTagsChange()
{
// rebuild the tag headers
SetTagHeader();
// now update the expanded header view to rebuild the tags,
// and then show or hide the tag header box.
if (gBuiltExpandedView)
{
var headerEntry = gExpandedHeaderView.tags;
if (headerEntry)
{
headerEntry.valid = ("tags" in currentHeaderData);
if (headerEntry.valid)
headerEntry.outputFunction(headerEntry, currentHeaderData.tags.headerValue);
// if we are showing the expanded header view then we may need to collapse or
// show the tag header box...
if (!gCollapsedHeaderViewMode)
headerEntry.enclosingBox.collapsed = !headerEntry.valid;
}
}
function OnTagsChange()
{
// rebuild the tag headers
SetTagHeader();
// now update the expanded header view to rebuild the tags,
// and then show or hide the tag header box.
if (gBuiltExpandedView)
{
var headerEntry = gExpandedHeaderView.tags;
if (headerEntry)
{
headerEntry.valid = ("tags" in currentHeaderData);
if (headerEntry.valid)
headerEntry.outputFunction(headerEntry, currentHeaderData.tags.headerValue);
// if we are showing the expanded header view then we may need to collapse or
// show the tag header box...
if (!gCollapsedHeaderViewMode)
headerEntry.enclosingBox.collapsed = !headerEntry.valid;
}
}
}
// flush out any local state being held by a header entry for a given

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

@ -1,37 +1,37 @@
/* ***** 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 Tag Color Style rules
* The Initial Developer of the Original Code is
* Scott MacGregor <mscott@mozilla.org>.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* 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 ***** */
/* ***** 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 Tag Color Style rules
* The Initial Developer of the Original Code is
* Scott MacGregor <mscott@mozilla.org>.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* 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 ***** */
/* ::::: thread labels decoration ::::: */