mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 18:47:53 +00:00
Bug #342576 --> toolbar button for tags, show message tags in the header pane, colorize the menu items based on the color associated with the tag, add color support to the add tag dialog. sr=bienvenu
This commit is contained in:
parent
1621ac24bd
commit
38987b729d
@ -203,6 +203,7 @@ var DefaultController =
|
||||
case "cmd_findPrevious":
|
||||
case "cmd_search":
|
||||
case "button_mark":
|
||||
case "cmd_tag":
|
||||
case "cmd_markAsRead":
|
||||
case "cmd_markAllRead":
|
||||
case "cmd_markThreadAsRead":
|
||||
@ -338,6 +339,7 @@ var DefaultController =
|
||||
gDBView.getCommandStatus(nsMsgViewCommandType.deleteJunk, enabled, checkStatus);
|
||||
return enabled.value;
|
||||
case "button_mark":
|
||||
case "cmd_tag":
|
||||
case "cmd_markAsRead":
|
||||
case "cmd_markThreadAsRead":
|
||||
return GetNumSelectedMessages() > 0;
|
||||
|
@ -561,6 +561,7 @@ function TagCurMessage(key)
|
||||
var messages = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
|
||||
messages.AppendElement(msgHdr);
|
||||
msgHdr.folder.addKeywordToMessages(messages, key);
|
||||
onTagsChange();
|
||||
}
|
||||
|
||||
function UnTagCurMessage(key)
|
||||
@ -570,12 +571,12 @@ function UnTagCurMessage(key)
|
||||
var messages = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
|
||||
messages.AppendElement(msgHdr);
|
||||
msgHdr.folder.removeKeywordFromMessages(messages, key);
|
||||
onTagsChange();
|
||||
}
|
||||
|
||||
|
||||
function AddTag()
|
||||
{
|
||||
var args = {result: "", okCallback: AddTagCallback};
|
||||
var args = {result: "", okCallback: AddTagCallback};
|
||||
var dialog = window.openDialog(
|
||||
"chrome://messenger/content/newTagDialog.xul",
|
||||
"",
|
||||
@ -585,22 +586,23 @@ function AddTag()
|
||||
|
||||
function AddTagCallback(name, color)
|
||||
{
|
||||
var tagService = Components.classes["@mozilla.org/messenger/tagservice;1"].getService(Components.interfaces.nsIMsgTagService);
|
||||
var tagService = Components.classes["@mozilla.org/messenger/tagservice;1"].getService(Components.interfaces.nsIMsgTagService);
|
||||
tagService.addTag(name, color);
|
||||
TagCurMessage(name);
|
||||
return true;
|
||||
}
|
||||
|
||||
function InitMessageTags(menuType)
|
||||
function InitMessageTags(menuPopup)
|
||||
{
|
||||
var tagService = Components.classes["@mozilla.org/messenger/tagservice;1"].getService(Components.interfaces.nsIMsgTagService);
|
||||
var tagService = Components.classes["@mozilla.org/messenger/tagservice;1"].getService(Components.interfaces.nsIMsgTagService);
|
||||
var allTags = tagService.tagEnumerator;
|
||||
var allKeys = tagService.keyEnumerator;
|
||||
// remove any existing entries...
|
||||
var menuItemId = menuType + "-tagpopup";
|
||||
var menupopupNode = document.getElementById(menuItemId);
|
||||
for (var i = menupopupNode.childNodes.length - 1; i >= 0; --i)
|
||||
menupopupNode.removeChild(menupopupNode.childNodes[i]);
|
||||
|
||||
// remove existing entries up until the menuseparator which precedes the Add New Tag option
|
||||
while (menuPopup.firstChild && menuPopup.firstChild.localName != 'menuseparator')
|
||||
menuPopup.removeChild(menuPopup.firstChild);
|
||||
|
||||
var menuSeparatorNode = menuPopup.firstChild;
|
||||
|
||||
// now rebuild the list
|
||||
var msgHdr = gDBView.hdrForFirstSelectedMessage;
|
||||
@ -620,6 +622,8 @@ function InitMessageTags(menuType)
|
||||
newMenuItem.setAttribute('label', tag);
|
||||
newMenuItem.setAttribute('value', key);
|
||||
newMenuItem.setAttribute('type', 'checkbox');
|
||||
newMenuItem.style.color = tagService.getColorForKey(key);
|
||||
|
||||
var keySet = false;
|
||||
for ( var index = 0; index < curMsgHdrKeyArray.length; index++ )
|
||||
{
|
||||
@ -633,15 +637,8 @@ function InitMessageTags(menuType)
|
||||
var command = ((keySet) ? "Un" : "") + "TagCurMessage(" + "'" + key + "');";
|
||||
newMenuItem.setAttribute('oncommand', command);
|
||||
newMenuItem.setAttribute('checked', keySet);
|
||||
menupopupNode.appendChild(newMenuItem);
|
||||
menuPopup.insertBefore(newMenuItem, menuSeparatorNode);
|
||||
}
|
||||
var menuseparator = document.createElement('menuseparator');
|
||||
menupopupNode.appendChild(menuseparator);
|
||||
|
||||
newMenuItem = document.createElement('menuitem');
|
||||
newMenuItem.setAttribute('label', gMessengerBundle.getString("newTag"));
|
||||
newMenuItem.setAttribute('oncommand', "AddTag()");
|
||||
menupopupNode.appendChild(newMenuItem);
|
||||
}
|
||||
|
||||
function InitMessageMark()
|
||||
|
@ -229,7 +229,6 @@
|
||||
<command id="cmd_createFilterFromMenu" oncommand="goDoCommand('cmd_createFilterFromMenu')"/>
|
||||
<command id="cmd_killThread" oncommand="goDoCommand('cmd_killThread')"/>
|
||||
<command id="cmd_watchThread" oncommand="goDoCommand('cmd_watchThread')"/>
|
||||
|
||||
</commandset>
|
||||
|
||||
<commandset id="mailToolbarItems"
|
||||
@ -242,6 +241,7 @@
|
||||
<command id="button_forward"/>
|
||||
<command id="button_delete"/>
|
||||
<command id="button_mark"/>
|
||||
<command id="cmd_tag"/>
|
||||
<command id="button_getNewMessages"/>
|
||||
<command id="button_print"/>
|
||||
<command id="button_next"/>
|
||||
@ -607,7 +607,10 @@
|
||||
</template>
|
||||
</menu>
|
||||
<menu id="threadPaneContext-tags" label="&tagMenu.label;" accesskey="&tagMenu.accesskey;">
|
||||
<menupopup id="threadPaneContext-tagpopup" onpopupshowing="InitMessageTags('threadPaneContext')">
|
||||
<menupopup id="threadPaneContext-tagpopup" onpopupshowing="InitMessageTags(this)">
|
||||
<menuseparator/>
|
||||
<menuitem id="addNewTag" label="&addNewTag.label;" accesskey="&addNewTag.accesskey;"
|
||||
oncommand="AddTag();"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu id="threadPaneContext-mark" label="&markMenu.label;" accesskey="&markMenu.accesskey;">
|
||||
@ -913,7 +916,10 @@
|
||||
</menu>
|
||||
<menuseparator id="messagePaneContext-sep-tags-1"/>
|
||||
<menu id="messagePaneContext-tags" label="&tagMenu.label;" accesskey="&tagMenu.accesskey;">
|
||||
<menupopup id="messagePaneContext-tagpopup" onpopupshowing="InitMessageTags('messagePaneContext')">
|
||||
<menupopup id="messagePaneContext-tagpopup" onpopupshowing="InitMessageTags(this)">
|
||||
<menuseparator/>
|
||||
<menuitem id="addNewTag" label="&addNewTag.label;" accesskey="&addNewTag.accesskey;"
|
||||
oncommand="AddTag();"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu id="messagePaneContext-mark" label="&markMenu.label;" accesskey="&markMenu.accesskey;">
|
||||
@ -1539,8 +1545,11 @@
|
||||
</template>
|
||||
</menu>
|
||||
|
||||
<menu id="tagMenu" label="&tagMenu.label;" accesskey="&tagMenu.accesskey;">
|
||||
<menupopup id="tagMenu-tagpopup" onpopupshowing="InitMessageTags('tagMenu')">
|
||||
<menu id="tagMenu" label="&tagMenu.label;" accesskey="&tagMenu.accesskey;" observes="cmd_tag">
|
||||
<menupopup id="tagMenu-tagpopup" onpopupshowing="InitMessageTags(this)">
|
||||
<menuseparator/>
|
||||
<menuitem id="addNewTag" label="&addNewTag.label;" accesskey="&addNewTag.accesskey;"
|
||||
oncommand="AddTag();"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu id="markMenu" label="&markMenu.label;" accesskey="&markMenu.accesskey;">
|
||||
@ -1853,6 +1862,15 @@
|
||||
</menupopup>
|
||||
</toolbarbutton>
|
||||
|
||||
<toolbarbutton id="button-tag" type="menu" class="toolbarbutton-1"
|
||||
label="&tagButton.label;" tooltiptext="&tagButton.tooltip;" observes="cmd_tag">
|
||||
<menupopup onpopupshowing="InitMessageTags(this)">
|
||||
<menuseparator/>
|
||||
<menuitem id="addNewTag" label="&addNewTag.label;" accesskey="&addNewTag.accesskey;"
|
||||
oncommand="AddTag();"/>
|
||||
</menupopup>
|
||||
</toolbarbutton>
|
||||
|
||||
<toolbarbutton id="button-address" class="toolbarbutton-1" label="&addressBookButton.label;" oncommand="toAddressBook();" tooltiptext="&addressBookButton.tooltip;"/>
|
||||
|
||||
<toolbaritem id="throbber-box" title="&throbberItem.title;" align="center" pack="center">
|
||||
@ -1919,9 +1937,9 @@
|
||||
customizable="true"
|
||||
context="toolbar-context-menu"
|
||||
#ifdef XP_MACOSX
|
||||
defaultset="button-getmsg,button-newmsg,button-address,spacer,button-reply,button-replyall,button-forward,spacer,button-delete,button-junk,spacer,button-print,button-stop,spring,search-container,throbber-box">
|
||||
defaultset="button-getmsg,button-newmsg,button-address,spacer,button-reply,button-replyall,button-forward,spacer,button-tag,button-delete,button-junk,spacer,button-print,button-stop,spring,search-container,throbber-box">
|
||||
#else
|
||||
defaultset="button-getmsg,button-newmsg,button-address,separator,button-reply,button-replyall,button-forward,separator,button-delete,button-junk,separator,button-print,button-stop,spring,search-container">
|
||||
defaultset="button-getmsg,button-newmsg,button-address,separator,button-reply,button-replyall,button-forward,separator,button-tag,button-delete,button-junk,separator,button-print,button-stop,spring,search-container">
|
||||
#endif
|
||||
</toolbar>
|
||||
<toolbarset id="customToolbars" context="toolbar-context-menu"/>
|
||||
|
@ -756,6 +756,7 @@ var MessageWindowController =
|
||||
case "cmd_saveAsTemplate":
|
||||
case "cmd_viewPageSource":
|
||||
case "cmd_getMsgsForAuthAccounts":
|
||||
case "cmd_tag":
|
||||
case "button_mark":
|
||||
case "cmd_markAsRead":
|
||||
case "cmd_markAllRead":
|
||||
@ -867,6 +868,7 @@ var MessageWindowController =
|
||||
case "cmd_viewPageSource":
|
||||
case "cmd_reload":
|
||||
case "cmd_find":
|
||||
case "cmd_tag":
|
||||
case "button_mark":
|
||||
case "cmd_markAsRead":
|
||||
case "cmd_markAllRead":
|
||||
|
@ -79,6 +79,10 @@ mail-urlfield {
|
||||
-moz-binding: url("chrome://messenger/content/mailWidgets.xml#mail-urlfield");
|
||||
}
|
||||
|
||||
mail-tagfield {
|
||||
-moz-binding: url("chrome://messenger/content/mailWidgets.xml#mail-headerfield-tags");
|
||||
}
|
||||
|
||||
searchattribute {
|
||||
-moz-binding: url("chrome://messenger/content/mailWidgets.xml#searchattribute");
|
||||
}
|
||||
|
@ -128,7 +128,8 @@ var gExpandedHeaderList = [ {name:"subject"},
|
||||
{name:"bcc", useToggle:true, outputFunction:OutputEmailAddresses},
|
||||
{name:"newsgroups", outputFunction:OutputNewsgroups},
|
||||
{name:"followup-to", outputFunction:OutputNewsgroups},
|
||||
{name:"content-base"} ];
|
||||
{name:"content-base"},
|
||||
{name:"tags"} ];
|
||||
|
||||
// Now, for each view the message pane can generate, we need a global table of headerEntries. These
|
||||
// header entry objects are generated dynamically based on the static date in the header lists (see above)
|
||||
@ -331,16 +332,18 @@ var messageHeaderSink = {
|
||||
ClearHeaderView(gCollapsedHeaderView);
|
||||
ClearHeaderView(gExpandedHeaderView);
|
||||
|
||||
EnsureSubjectValue(); // make sure there is a subject even if it's empty so we'll show the subject and the twisty
|
||||
EnsureSubjectValue(); // make sure there is a subject even if it's empty so we'll show the subject and the twisty
|
||||
|
||||
ShowMessageHeaderPane();
|
||||
UpdateMessageHeaders();
|
||||
|
||||
if (gIsEditableMsgFolder)
|
||||
ShowEditMessageButton();
|
||||
|
||||
for (index in gMessageListeners)
|
||||
gMessageListeners[index].onEndHeaders();
|
||||
},
|
||||
|
||||
processHeaders: function(headerNameEnumerator, headerValueEnumerator, dontCollectAddress)
|
||||
{
|
||||
this.onStartHeaders();
|
||||
@ -395,6 +398,9 @@ var messageHeaderSink = {
|
||||
else
|
||||
currentHeaderData[lowerCaseHeaderName] = header;
|
||||
} // while we have more headers to parse
|
||||
|
||||
// process message tags as if they were headers in the message
|
||||
setTagHeader();
|
||||
|
||||
if (("from" in currentHeaderData) && ("sender" in currentHeaderData) && msgHeaderParser)
|
||||
{
|
||||
@ -408,7 +414,7 @@ var messageHeaderSink = {
|
||||
|
||||
this.onEndHeaders();
|
||||
},
|
||||
|
||||
|
||||
handleAttachment: function(contentType, url, displayName, uri, isExternalAttachment)
|
||||
{
|
||||
// presentation level change....don't show vcards as external attachments in the UI.
|
||||
@ -510,6 +516,57 @@ var messageHeaderSink = {
|
||||
}
|
||||
};
|
||||
|
||||
// private method which generates a space delimited list of tag names
|
||||
// for the current message. This list is then stored in
|
||||
// currentHeaderData['tags']. Each tag is encoded.
|
||||
function setTagHeader()
|
||||
{
|
||||
// it would be nice if we passed in the msg hdr from the back end
|
||||
var msgHdr = gDBView.hdrForFirstSelectedMessage;
|
||||
var tagsString = "";
|
||||
|
||||
// extract the tags from the msg hdr
|
||||
var tags = msgHdr.getStringProperty('keywords');
|
||||
|
||||
var label = msgHdr.label;
|
||||
if (label > 0)
|
||||
{
|
||||
var labelTag = '$label' + label + '0';
|
||||
tagsString = encodeURIComponent(gPrefBranch.getComplexValue("mailnews.labels.description." + label,
|
||||
Components.interfaces.nsIPrefLocalizedString).data);
|
||||
}
|
||||
|
||||
// now convert the list of tag ids into user presentable strings, separate by commas
|
||||
var tagService = Components.classes["@mozilla.org/messenger/tagservice;1"]
|
||||
.getService(Components.interfaces.nsIMsgTagService);
|
||||
// tokenize the keywords based on ' '
|
||||
var tagsArray = tags.split(' ');
|
||||
for (var index = 0; index < tagsArray.length; index++)
|
||||
{
|
||||
if (tagsArray[index])
|
||||
{
|
||||
var tagName;
|
||||
try {
|
||||
// if we got a bad tag name, getTagForKey will throw an exception, skip it
|
||||
// and go to the next one.
|
||||
tagName = tagService.getTagForKey(tagsArray[index]);
|
||||
} catch (ex) { continue; }
|
||||
|
||||
if (tagName)
|
||||
{
|
||||
if (tagsString)
|
||||
tagsString += " ";
|
||||
tagsString += encodeURIComponent(tagName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tagsString)
|
||||
currentHeaderData['tags'] = { headerName: 'tags', headerValue: tagsString};
|
||||
else if (currentHeaderData['tags']) // no more tags, so clear out the header field
|
||||
currentHeaderData['tags'] = null;
|
||||
}
|
||||
|
||||
function EnsureSubjectValue()
|
||||
{
|
||||
if (!('subject' in currentHeaderData))
|
||||
@ -527,6 +584,33 @@ function CheckNotify()
|
||||
NotifyClearAddresses();
|
||||
}
|
||||
|
||||
// Public method called by the tag front end code when the tags for the selected
|
||||
// message has changed.
|
||||
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)
|
||||
{
|
||||
headerEntry = gExpandedHeaderView['tags'];
|
||||
if (headerEntry)
|
||||
{
|
||||
if (currentHeaderData['tags'])
|
||||
{
|
||||
headerEntry.outputFunction(headerEntry, currentHeaderData['tags'].headerValue);
|
||||
headerEntry.valid = true;
|
||||
}
|
||||
|
||||
// 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 = !currentHeaderData['tags'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// flush out any local state being held by a header entry for a given
|
||||
// table
|
||||
@ -728,10 +812,10 @@ function UpdateMessageHeaders()
|
||||
} // if we are in expanded view....
|
||||
|
||||
if (headerEntry)
|
||||
{
|
||||
headerEntry.outputFunction(headerEntry, headerField.headerValue);
|
||||
headerEntry.valid = true;
|
||||
}
|
||||
{
|
||||
headerEntry.outputFunction(headerEntry, headerField.headerValue);
|
||||
headerEntry.valid = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (gCollapsedHeaderViewMode)
|
||||
|
@ -148,8 +148,9 @@
|
||||
|
||||
<mail-headerfield id="expandednewsgroupsBox" label="&newsgroupsField.label;" collapsed="true"/>
|
||||
<mail-headerfield id="expandedfollowup-toBox" label="&followupToField.label;" collapsed="true"/>
|
||||
<mail-tagfield id="expandedtagsBox" label="&tagsHdr.label;" collapsed="true"/>
|
||||
<mail-urlfield id="expandedcontent-baseBox" label="&originalWebsite.label;" collapsed="true"/>
|
||||
<mail-headerfield id="expandeduser-agentBox" label="&userAgentField.label;" collapsed="true"/>
|
||||
<mail-urlfield id="expandedcontent-baseBox" label="&originalWebsite.label;" collapsed="true"/>
|
||||
</vbox>
|
||||
|
||||
<vbox id="editMessageBox" class="header-part1" originalclass="header-part1" collapsed="true">
|
||||
|
@ -443,6 +443,7 @@
|
||||
<!ENTITY addressBookButton.label "Address Book">
|
||||
<!ENTITY searchItem.title "Quick Search">
|
||||
<!ENTITY mailViewsToolbarItem.title "Mail Views">
|
||||
<!ENTITY tagButton.label "Tag">
|
||||
|
||||
<!-- Mail Toolbar Tooltips-->
|
||||
<!ENTITY advancedButton.tooltip "Advanced message search">
|
||||
@ -463,6 +464,11 @@
|
||||
<!ENTITY junkButton.tooltip "Mark the selected messages as junk">
|
||||
<!ENTITY notJunkButton.tooltip "Mark the selected messages as not junk">
|
||||
<!ENTITY addressBookButton.tooltip "Go to the address book">
|
||||
<!ENTITY tagButton.tooltip "Tag messages">
|
||||
|
||||
<!-- Tags Menu Popup -->
|
||||
<!ENTITY addNewTag.label "New Tag...">
|
||||
<!ENTITY addNewTag.accesskey "N">
|
||||
|
||||
<!-- Folder Pane -->
|
||||
<!ENTITY folderColumn.label "Name">
|
||||
|
@ -47,7 +47,7 @@
|
||||
<!ENTITY bccField.label "Bcc: ">
|
||||
<!ENTITY newsgroupsField.label "Newsgroups: ">
|
||||
<!ENTITY followupToField.label "Followup-To: ">
|
||||
|
||||
<!ENTITY tagsHdr.label "Tags: ">
|
||||
<!ENTITY dateField.label "Date: ">
|
||||
<!ENTITY userAgentField.label "User-Agent: ">
|
||||
<!ENTITY originalWebsite.label "Website: ">
|
||||
|
@ -1,38 +1,4 @@
|
||||
<!-- ***** 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 new tag dialog
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- The Mozilla Corporation.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2006
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- 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 LGPL or the GPL. 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 ***** -->
|
||||
|
||||
<!-- Labels -->
|
||||
<!ENTITY newTagDialog.title "New Tag">
|
||||
<!ENTITY name.label "Tag:">
|
||||
<!ENTITY name.accesskey "T">
|
||||
<!-- New Tag Dialog -->
|
||||
<!ENTITY newTagDialog.title "Create New Tag">
|
||||
<!ENTITY name.label "Tag Name:">
|
||||
<!ENTITY name.accesskey "T">
|
||||
|
@ -178,6 +178,11 @@ description[selectable="true"]:focus > descriptionitem[selected="true"]
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.tagvalue {
|
||||
font-weight: bold;
|
||||
margin-left: 0px;
|
||||
}
|
||||
|
||||
/* ::::: msg header email addresses ::::: */
|
||||
|
||||
.emailDisplayButton {
|
||||
|
@ -238,6 +238,21 @@ toolbarbutton[type="menu-button"] > toolbarbutton {
|
||||
-moz-image-region: rect(64px 448px 96px 416px) !important;
|
||||
}
|
||||
|
||||
/* temporarily re-use the mark button for tags */
|
||||
|
||||
#button-tag {
|
||||
-moz-image-region: rect(0px 448px 32px 416px);
|
||||
}
|
||||
|
||||
#button-tag:hover:active,
|
||||
#button-tag[open="true"] {
|
||||
-moz-image-region: rect(32px 448px 64px 416px);
|
||||
}
|
||||
|
||||
#button-tag[disabled] {
|
||||
-moz-image-region: rect(64px 448px 96px 416px) !important;
|
||||
}
|
||||
|
||||
/* ::::: small primary toolbar buttons ::::: */
|
||||
|
||||
toolbar[iconsize="small"] .toolbarbutton-1 {
|
||||
@ -391,6 +406,21 @@ toolbar[iconsize="small"] #button-mark[disabled] {
|
||||
-moz-image-region: rect(48px 288px 72px 264px) !important;
|
||||
}
|
||||
|
||||
/* temporarily re-use the mark button for tags */
|
||||
|
||||
toolbar[iconsize="small"] #button-tag {
|
||||
-moz-image-region: rect(0px 288px 24px 264px);
|
||||
}
|
||||
|
||||
toolbar[iconsize="small"] #button-tag:hover:active,
|
||||
toolbar[iconsize="small"] #button-tag[open] {
|
||||
-moz-image-region: rect(24px 288px 48px 264px);
|
||||
}
|
||||
|
||||
toolbar[iconsize="small"] #button-tag[disabled] {
|
||||
-moz-image-region: rect(48px 288px 72px 264px) !important;
|
||||
}
|
||||
|
||||
toolbar[iconsize="small"] #button-previous {
|
||||
-moz-image-region: rect(0px 314px 24px 288px);
|
||||
}
|
||||
|
@ -161,6 +161,11 @@ description[selectable="true"]:focus > descriptionitem[selected="true"]
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.tagvalue {
|
||||
font-weight: bold;
|
||||
margin-left: 0px;
|
||||
}
|
||||
|
||||
/* ::::: msg header email addresses ::::: */
|
||||
|
||||
.emailDisplayButton {
|
||||
|
@ -225,6 +225,18 @@ toolbar[mode="full"] .toolbarbutton-1 {
|
||||
-moz-image-region: rect(48px 336px 72px 312px) !important;
|
||||
}
|
||||
|
||||
/* Temporary tag button...re-use the mark button */
|
||||
#button-tag {
|
||||
-moz-image-region: rect(0px 336px 24px 312px);
|
||||
}
|
||||
|
||||
#button-tag:hover {
|
||||
-moz-image-region: rect(24px 336px 48px 312px);
|
||||
}
|
||||
|
||||
#button-tag[disabled] {
|
||||
-moz-image-region: rect(48px 336px 72px 312px) !important;
|
||||
}
|
||||
|
||||
/* ::::: small primary toolbar buttons ::::: */
|
||||
|
||||
@ -425,6 +437,19 @@ toolbar[iconsize="small"] #button-mark[disabled] {
|
||||
-moz-image-region: rect(32px 224px 48px 208px) !important;
|
||||
}
|
||||
|
||||
/* temporary tag button, re-use the mark button */
|
||||
toolbar[iconsize="small"] #button-tag {
|
||||
-moz-image-region: rect(0px 224px 16px 208px);
|
||||
}
|
||||
|
||||
toolbar[iconsize="small"] #button-tag:hover {
|
||||
-moz-image-region: rect(16px 224px 32px 208px);
|
||||
}
|
||||
|
||||
toolbar[iconsize="small"] #button-tag[disabled] {
|
||||
-moz-image-region: rect(32px 224px 48px 208px) !important;
|
||||
}
|
||||
|
||||
/* ::::: end small primary toolbar buttons ::::: */
|
||||
|
||||
/* ::::: message notification bar style rules ::::: */
|
||||
|
@ -608,7 +608,7 @@
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<property name="headerValue" onset="return document.getAnonymousElementByAttribute(this, 'anonid', 'headerValue').value = val;"/>
|
||||
<property name="headerValue" onset="return document.getAnonymousElementByAttribute(this, 'anonid', 'headerValue').value = val;"/>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
@ -957,6 +957,55 @@
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<!-- Header field for showing the tags associated with a message -->
|
||||
<binding id="mail-headerfield-tags">
|
||||
<content>
|
||||
<xul:hbox class="headerNameBox" align="start">
|
||||
<xul:label class="headerName" xbl:inherits="value=label" flex="1"/>
|
||||
</xul:hbox>
|
||||
<xul:label class="headerValue plain" anonid="headerValue" flex="1"/>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<property name="headerValue" onset="return this.buildTags(val);"/>
|
||||
<method name="buildTags">
|
||||
<parameter name="aTags"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
// aTags contains a list of actual tag names (not the keys), delimited by spaces
|
||||
// each tag name is encoded.
|
||||
|
||||
// remove any existing tag items we've appended to the list
|
||||
var headerValueNode = document.getAnonymousElementByAttribute(this, 'anonid', 'headerValue');
|
||||
for (var i = headerValueNode.childNodes.length - 1; i >= 0; --i)
|
||||
headerValueNode.removeChild(headerValueNode.childNodes[i]);
|
||||
|
||||
var tagService = Components.classes["@mozilla.org/messenger/tagservice;1"]
|
||||
.getService(Components.interfaces.nsIMsgTagService);
|
||||
// tokenize the keywords based on ' '
|
||||
var tagsArray = aTags.split(' ');
|
||||
var decodedTagName;
|
||||
for (var index = 0; index < tagsArray.length; index++)
|
||||
{
|
||||
// for each tag, create a label, give it the font color that corresponds to the
|
||||
// color of the tag and append it.
|
||||
decodedTagName = decodeURIComponent(tagsArray[index]);
|
||||
var tagKey = tagService.getKeyForTag(decodedTagName);
|
||||
var color = tagService.getColorForKey(tagKey);
|
||||
|
||||
// now create a label for the tag name, and set the color
|
||||
var label = document.createElement("label");
|
||||
label.setAttribute('value', decodedTagName);
|
||||
label.style.color = color;
|
||||
label.className = "tagvalue";
|
||||
headerValueNode.appendChild(label);
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="search-menulist-abstract" name="searchMenulistAbstract" extends="xul:box">
|
||||
<content>
|
||||
<xul:menulist class="search-menulist" xbl:inherits="flex" oncommand="this.parentNode.onSelect(event)">
|
||||
|
@ -62,7 +62,7 @@ function onOK()
|
||||
{
|
||||
var name = dialog.nameField.value;
|
||||
|
||||
var tagService = Components.classes["@mozilla.org/messenger/tagservice;1"].getService(Components.interfaces.nsIMsgTagService);
|
||||
var tagService = Components.classes["@mozilla.org/messenger/tagservice;1"].getService(Components.interfaces.nsIMsgTagService);
|
||||
// do name validity check? Has to be non-empty, and not existing already
|
||||
try
|
||||
{
|
||||
@ -70,7 +70,7 @@ function onOK()
|
||||
// above will throw an error if tag doesn't exist. So if it doesn't throw an error,
|
||||
// the tag exists, so alert the user and return false.
|
||||
}
|
||||
catch (ex) {return dialog.okCallback(name, "")}
|
||||
catch (ex) {return dialog.okCallback(name, document.getElementById("tagColorPicker").color)}
|
||||
|
||||
var messengerBundle = document.getElementById("bundle_messenger");
|
||||
var alertText = messengerBundle.getString("tagExists");
|
||||
|
@ -49,10 +49,10 @@
|
||||
</stringbundleset>
|
||||
|
||||
<script type="application/x-javascript" src="chrome://messenger/content/newTagDialog.js"/>
|
||||
|
||||
<label value="&name.label;" accesskey="&name.accesskey;" control="name"/>
|
||||
<label value="&name.label;" accesskey="&name.accesskey;" control="name"/>
|
||||
<hbox>
|
||||
<textbox id="name" oninput="doEnabling();"/>
|
||||
|
||||
<separator/>
|
||||
|
||||
<colorpicker class="small-margin" type="button" id="tagColorPicker" palettename="standard"/>
|
||||
</hbox>
|
||||
<separator/>
|
||||
</dialog>
|
||||
|
Loading…
Reference in New Issue
Block a user