Bug 560193 - Allow deleting a saved search under news account. r=jcranmer, r=mkmelin

This commit is contained in:
aceman 2014-02-05 16:28:27 -05:00
Родитель bccda484e9
Коммит 605c793b41
4 изменённых файлов: 20 добавлений и 8 удалений

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

@ -2073,7 +2073,7 @@ let gFolderTreeController = {
let folder = folders[0];
// For newsgroups, "delete" means "unsubscribe".
if (folder.server.type == "nntp") {
if (folder.server.type == "nntp" && !folder.getFlag(nsMsgFolderFlags.Virtual)) {
MsgUnsubscribe(folders);
return;
}

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

@ -97,7 +97,10 @@ function UpdateDeleteLabelsFromFolderCommand(folder, command)
if (command != "cmd_delete")
return;
if (folder.server.type == "nntp") {
if (folder.getFlag(nsMsgFolderFlags.Virtual)) {
goSetMenuValue(command, "valueFolder");
}
else if (folder.server.type == "nntp") {
goSetMenuValue(command, "valueNewsgroup");
goSetAccessKey(command, "valueNewsgroupAccessKey");
}
@ -274,11 +277,12 @@ var DefaultController =
case "cmd_deleteFolder":
var folders = gFolderTreeView.getSelectedFolders();
if (folders.length == 1) {
var folder = folders[0];
if (folder.server.type == "nntp")
return false; // Just disable the command for news.
else
return CanDeleteFolder(folder);
let folder = folders[0];
if (folder.server.type == "nntp") {
// Just disable the command for news unless it is a Saved search folder.
return folder.getFlag(nsMsgFolderFlags.Virtual);
}
return CanDeleteFolder(folder);
}
return false;
case "button_junk":
@ -1154,6 +1158,8 @@ function IsPropertiesEnabled(command)
// when servers are selected it should be "Edit | Properties..."
if (folder.isServer)
goSetMenuValue(command, "valueGeneric");
else if (folder.getFlag(nsMsgFolderFlags.Virtual))
goSetMenuValue(command, "valueFolder");
else
goSetMenuValue(command, isNewsURI(folder.URI) ? "valueNewsgroup" : "valueFolder");

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

@ -324,7 +324,8 @@ function fillFolderPaneContextMenu()
var haveOnlySubscribableFolders = folders.every(checkCanSubscribeToFolder);
function checkIsNewsgroup(folder) {
return !folder.isServer && folder.server.type == "nntp";
return !folder.isServer && folder.server.type == "nntp" &&
!folder.getFlag(nsMsgFolderFlags.Virtual);
}
var haveOnlyNewsgroups = folders.every(checkIsNewsgroup);

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

@ -793,7 +793,12 @@ NS_IMETHODIMP nsMsgNewsFolder::GetExpungedBytesCount(uint32_t *count)
NS_IMETHODIMP nsMsgNewsFolder::GetDeletable(bool *deletable)
{
NS_ENSURE_ARG_POINTER(deletable);
*deletable = false;
// For legacy reasons, there can be Saved search folders under news accounts.
// Allow deleting those.
GetFlag(nsMsgFolderFlags::Virtual, deletable);
return NS_OK;
}