Bug 519192 - "Fix up context menu for gloda search results list tab - can't move, copy, tag, mark messages etc" [r=bienvenu]
This commit is contained in:
Родитель
ef94f1a2ce
Коммит
af0c070e9d
|
@ -1912,6 +1912,24 @@ FolderDisplayWidget.prototype = {
|
|||
return messageArray.length ? messageArray : null;
|
||||
},
|
||||
|
||||
/**
|
||||
* @return true if all the selected messages can be deleted from their
|
||||
* folders, false otherwise.
|
||||
*/
|
||||
get canDeleteSelectedMessages FolderDisplayWidget_get_canDeleteSelectedMessages() {
|
||||
if (!this.view.dbView)
|
||||
return false;
|
||||
|
||||
let selectedMessages = this.selectedMessages;
|
||||
for (let i = 0; i < selectedMessages.length; ++i) {
|
||||
if (selectedMessages[i].folder &&
|
||||
!selectedMessages[i].folder.canDeleteMessages) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Clear the tree selection, making sure the message pane is cleared and
|
||||
* the context display (toolbars, etc.) are updated.
|
||||
|
|
|
@ -292,9 +292,11 @@ var DefaultController =
|
|||
return gFolderDisplay.getCommandStatus(nsMsgViewCommandType.toggleThreadWatched);
|
||||
case "cmd_createFilterFromPopup":
|
||||
case "cmd_createFilterFromMenu":
|
||||
if (!(gFolderDisplay.displayedFolder &&
|
||||
gFolderDisplay.displayedFolder.server.canHaveFilters))
|
||||
return false; // else fall thru
|
||||
{
|
||||
let selectedMessages = gFolderDisplay.selectedMessages;
|
||||
return selectedMessages.length == 1 && selectedMessages[0].folder &&
|
||||
selectedMessages[0].folder.server.canHaveFilters;
|
||||
}
|
||||
case "cmd_saveAsFile":
|
||||
case "cmd_saveAsTemplate":
|
||||
if (GetNumSelectedMessages() > 1)
|
||||
|
|
|
@ -351,14 +351,17 @@ function InitMessageMenu()
|
|||
document.getElementById("killSubthread").hidden = !isNews;
|
||||
document.getElementById("watchThread").hidden = !isNews;
|
||||
|
||||
// Disable the move and copy menus if there are no messages selected.
|
||||
|
||||
// Disable the move and copy menus if there are no messages selected or if
|
||||
// the message is a dummy - e.g. opening a message in the standalone window.
|
||||
let messageStoredInternally = selectedMsg && !gMessageDisplay.isDummy;
|
||||
// Disable the move menu if we can't delete msgs from the folder.
|
||||
var msgFolder = gFolderDisplay.displayedFolder;
|
||||
var enableMenuItem = selectedMsg && msgFolder && msgFolder.canDeleteMessages;
|
||||
document.getElementById("moveMenu").disabled = !enableMenuItem;
|
||||
let canMove = messageStoredInternally &&
|
||||
gFolderDisplay.canDeleteSelectedMessages;
|
||||
document.getElementById("moveMenu").disabled = !canMove;
|
||||
|
||||
// Also disable copy when no folder is loaded (like for .eml files).
|
||||
document.getElementById("copyMenu").disabled = !(selectedMsg && msgFolder);
|
||||
document.getElementById("copyMenu").disabled = !messageStoredInternally;
|
||||
|
||||
initMoveToFolderAgainMenu(document.getElementById("moveToFolderAgain"));
|
||||
|
||||
|
@ -367,7 +370,7 @@ function InitMessageMenu()
|
|||
|
||||
// Disable the Tag menu item if no message is selected or when we're
|
||||
// not in a folder.
|
||||
document.getElementById("tagMenu").disabled = !(selectedMsg && msgFolder);
|
||||
document.getElementById("tagMenu").disabled = !messageStoredInternally;
|
||||
|
||||
// Initialize the Open Message menuitem
|
||||
var winType = document.documentElement.getAttribute('windowtype');
|
||||
|
@ -384,7 +387,7 @@ function InitMessageMenu()
|
|||
openRssMenu.hidden = true;
|
||||
|
||||
// Disable mark menu when we're not in a folder.
|
||||
document.getElementById("markMenu").disabled = !msgFolder;
|
||||
document.getElementById("markMenu").disabled = !messageStoredInternally;
|
||||
|
||||
document.commandDispatcher.updateCommands('create-menu-message');
|
||||
}
|
||||
|
@ -1196,7 +1199,11 @@ function MsgCopyMessage(aDestFolder)
|
|||
function MsgMoveMessage(aDestFolder)
|
||||
{
|
||||
// We don't move news messages, we copy them.
|
||||
if (isNewsURI(gDBView.msgFolder.URI))
|
||||
// XXX this check is incorrect in two ways. For saved searches we could have
|
||||
// cross folder/newsgroup messages, so this check would do the wrong thing.
|
||||
// For global search views, we don't have a msgFolder - however as we don't
|
||||
// index newsgroup messages, we can at least temporarily get away with this.
|
||||
if (gDBView.msgFolder && isNewsURI(gDBView.msgFolder.URI))
|
||||
gDBView.doCommandWithFolder(nsMsgViewCommandType.copyMessages, aDestFolder);
|
||||
else
|
||||
{
|
||||
|
@ -1318,7 +1325,7 @@ BatchMessageMover.prototype = {
|
|||
}
|
||||
let archiveFolder = GetMsgFolderFromUri(archiveFolderUri, false);
|
||||
let granularity = archiveFolder.server.archiveGranularity;
|
||||
|
||||
|
||||
let copyBatchKey = msgHdr.folder.URI + '\000';
|
||||
if (granularity >= Components.interfaces.nsIMsgIncomingServer
|
||||
.perMonthArchiveFolders)
|
||||
|
|
|
@ -68,7 +68,6 @@ function nsContextMenu(aXulMenu) {
|
|||
this.inMessageArea = false;
|
||||
this.inThreadPane = false;
|
||||
this.numSelectedMessages = 0;
|
||||
this.selectedMessage = null;
|
||||
this.isNewsgroup = false;
|
||||
this.hideMailItems = false;
|
||||
|
||||
|
@ -198,8 +197,7 @@ nsContextMenu.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
let msgFolder = gFolderDisplay.displayedFolder;
|
||||
var canMove = msgFolder && msgFolder.canDeleteMessages;
|
||||
let canMove = gFolderDisplay.canDeleteSelectedMessages;
|
||||
|
||||
// Show the Open in New Window and New Tab options if there is exactly one
|
||||
// message selected.
|
||||
|
@ -222,7 +220,8 @@ nsContextMenu.prototype = {
|
|||
this.setSingleSelection("mailContext-copyMessageUrl", this.isNewsgroup);
|
||||
|
||||
let msgModifyItems = this.numSelectedMessages > 0 && !this.hideMailItems &&
|
||||
msgFolder && !this.onPlayableMedia;
|
||||
!this.onPlayableMedia &&
|
||||
!(this.numSelectedMessages == 1 && gMessageDisplay.isDummy);
|
||||
|
||||
this.showItem("mailContext-archive", canMove && msgModifyItems);
|
||||
|
||||
|
@ -450,7 +449,6 @@ nsContextMenu.prototype = {
|
|||
if (!this.inMessageArea) {
|
||||
this.inThreadPane = false;
|
||||
this.numSelectedMessages = 0;
|
||||
this.selectedMessage = null;
|
||||
this.isNewsgroup = false;
|
||||
this.hideMailItems = true;
|
||||
return;
|
||||
|
@ -458,7 +456,6 @@ nsContextMenu.prototype = {
|
|||
|
||||
this.inThreadPane = this.popupNodeIsInThreadPane(aNode);
|
||||
this.numSelectedMessages = GetNumSelectedMessages();
|
||||
this.selectedMessage = gFolderDisplay.selectedMessage;
|
||||
this.isNewsgroup = gFolderDisplay.selectedMessageIsNews;
|
||||
// Don't show mail items for links/images, just show related items.
|
||||
this.hideMailItems = !this.inThreadPane &&
|
||||
|
|
Загрузка…
Ссылка в новой задаче