Bug #342878 --> hide the tags separator in the message pane context menu when appropriate. Remove some dead code from nsContextMenu.js. sr=bienvenu

git-svn-id: svn://10.0.0.236/trunk@201091 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
scott%scott-macgregor.org 2006-06-28 15:04:12 +00:00
parent b8a8508d75
commit cb121bae66
5 changed files with 17 additions and 99 deletions

View File

@ -220,6 +220,12 @@ function SetupLabelsMenuItem(menuID, numSelected, forceHide)
EnableMenuItem(menuID, (numSelected == 1));
}
function SetupTagMenuItem(menuID, numSelected, forceHide)
{
ShowMenuItem(menuID, (numSelected <= 1) && !forceHide);
EnableMenuItem(menuID, (numSelected == 1));
}
function SetupMarkMenuItem(menuID, numSelected, forceHide)
{
ShowMenuItem(menuID, (numSelected <= 1) && !forceHide);
@ -448,6 +454,7 @@ function fillMessagePaneContextMenu()
SetupMoveMenuItem("messagePaneContext-moveMenu", numSelected, isNewsgroup, (numSelected == 0 || hideMailItems));
SetupLabelsMenuItem("messagePaneContext-labels", numSelected, (numSelected == 0 || hideMailItems));
SetupMarkMenuItem("messagePaneContext-mark", numSelected, (numSelected == 0 || hideMailItems));
SetupTagMenuItem("messagePaneContext-tags", numSelected, (numSelected == 0 || hideMailItems));
SetupSaveAsMenuItem("messagePaneContext-saveAs", numSelected, (numSelected == 0 || hideMailItems));
#ifdef XP_MACOSX
SetupPrintPreviewMenuItem("messagePaneContext-printpreview", numSelected, true);
@ -476,8 +483,8 @@ function fillMessagePaneContextMenu()
ShowMenuItem("messagePaneContext-sep-link", shouldShowSeparator("messagePaneContext-sep-link"));
ShowMenuItem("messagePaneContext-sep-open", shouldShowSeparator("messagePaneContext-sep-open"));
ShowMenuItem("messagePaneContext-sep-reply", shouldShowSeparator("messagePaneContext-sep-reply"));
ShowMenuItem("messagePaneContext-sep-labels-1", shouldShowSeparator("messagePaneContext-sep-labels-1"));
ShowMenuItem("messagePaneContext-sep-labels-2", shouldShowSeparator("messagePaneContext-sep-labels-2"));
ShowMenuItem("messagePaneContext-sep-tags-1", shouldShowSeparator("messagePaneContext-sep-tags-1"));
ShowMenuItem("messagePaneContext-sep-saveAs", shouldShowSeparator("messagePaneContext-sep-saveAs"));
ShowMenuItem("messagePaneContext-sep-edit", shouldShowSeparator("messagePaneContext-sep-edit"));
ShowMenuItem("messagePaneContext-sep-copy", shouldShowSeparator("messagePaneContext-sep-copy"));
}

View File

@ -549,7 +549,6 @@ function IsImapMessage(messageUri)
function SetMenuItemLabel(menuItemId, customLabel)
{
var menuItem = document.getElementById(menuItemId);
if(menuItem)
menuItem.setAttribute('label', customLabel);
}

View File

@ -957,7 +957,7 @@
</menupopup>
</menu>
<menuseparator id="messagePaneContext-sep-labels-2"/>
<menuseparator id="messagePaneContext-sep-saveAs"/>
<menuitem id="messagePaneContext-saveAs"
label="&contextSaveAs.label;"
accesskey="&contextSaveAs.accesskey;"

View File

@ -521,8 +521,13 @@ var messageHeaderSink = {
// 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;
// it would be nice if we passed in the msg hdr from the back end
var msgHdr;
try {
msgHdr = gDBView.hdrForFirstSelectedMessage;
}
catch (ex) { return; } // no msgHdr to add our tags to.
var tagsString = "";
// extract the tags from the msg hdr

View File

@ -599,31 +599,6 @@ nsContextMenu.prototype = {
Components.interfaces.nsIClipboardHelper );
clipboard.copyString(addresses);
},
addBookmark : function() {
var docshell = document.getElementById( "content" ).webNavigation;
BookmarksUtils.addBookmark( docshell.currentURI.spec,
docshell.document.title,
docshell.document.characterSet,
false );
},
addBookmarkForFrame : function() {
var doc = this.target.ownerDocument;
var uri = doc.location.href;
var title = doc.title;
if ( !title )
title = uri;
BookmarksUtils.addBookmark( uri,
title,
doc.characterSet,
false );
},
// Open Metadata window for node
showMetadata : function () {
window.openDialog( "chrome://navigator/content/metadata.xul",
"_blank",
"scrollbars,resizable,chrome,dialog=no",
this.target);
},
///////////////
// Utilities //
@ -796,71 +771,3 @@ nsContextMenu.prototype = {
return false;
}
};
/*************************************************************************
*
* nsDefaultEngine : nsIObserver
*
*************************************************************************/
function nsDefaultEngine()
{
try
{
var pb = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefBranch);
var pbi = pb.QueryInterface(
Components.interfaces.nsIPrefBranch2);
pbi.addObserver(this.domain, this, false);
// reuse code by explicitly invoking initial |observe| call
// to initialize the |icon| and |name| member variables
this.observe(pb, "", this.domain);
}
catch (ex)
{
}
}
nsDefaultEngine.prototype =
{
name: "",
icon: "",
domain: "browser.search.defaultengine",
// nsIObserver implementation
observe: function(aPrefBranch, aTopic, aPrefName)
{
try
{
var rdf = Components.
classes["@mozilla.org/rdf/rdf-service;1"].
getService(Components.interfaces.nsIRDFService);
var ds = rdf.GetDataSource("rdf:internetsearch");
var defaultEngine = aPrefBranch.getCharPref(aPrefName);
var res = rdf.GetResource(defaultEngine);
// get engine ``pretty'' name
const kNC_Name = rdf.GetResource(
"http://home.netscape.com/NC-rdf#Name");
var engineName = ds.GetTarget(res, kNC_Name, true);
if (engineName)
{
this.name = engineName.QueryInterface(
Components.interfaces.nsIRDFLiteral).Value;
}
// get URL to engine vendor icon
const kNC_Icon = rdf.GetResource(
"http://home.netscape.com/NC-rdf#Icon");
var iconURL = ds.GetTarget(res, kNC_Icon, true);
if (iconURL)
{
this.icon = iconURL.QueryInterface(
Components.interfaces.nsIRDFLiteral).Value;
}
}
catch (ex)
{
}
}
}