From 8c91c13670c7f7ea4125ec6c6d6096ce02342136 Mon Sep 17 00:00:00 2001 From: "scott%scott-macgregor.org" Date: Tue, 11 Jul 2006 18:21:51 +0000 Subject: [PATCH] Bug #341490 --> restore the new folder context menu in the folder pane cotnext menu. sr=me. patch by teemu mannermaa --- mail/base/content/mailContextMenus.js | 26 +++++++++++++++++++ mail/base/content/mailWindowOverlay.xul | 4 +++ .../en-US/chrome/messenger/messenger.dtd | 2 ++ 3 files changed, 32 insertions(+) diff --git a/mail/base/content/mailContextMenus.js b/mail/base/content/mailContextMenus.js index 4bafcd33cf2d..b440d28c7c99 100644 --- a/mail/base/content/mailContextMenus.js +++ b/mail/base/content/mailContextMenus.js @@ -304,6 +304,7 @@ function fillFolderPaneContextMenu() EnableMenuItem("folderPaneContext-properties", true); + SetupNewMenuItem(folderResource, numSelected, isServer, serverType, specialFolder); SetupRenameMenuItem(folderResource, numSelected, isServer, serverType, specialFolder); SetupRemoveMenuItem(folderResource, numSelected, isServer, serverType, specialFolder); SetupCompactMenuItem(folderResource, numSelected); @@ -346,6 +347,31 @@ function fillFolderPaneContextMenu() return(true); } +function SetupNewMenuItem(folderResource, numSelected, isServer, serverType,specialFolder) +{ + var folderTree = GetFolderTree(); + var canCreateNew = GetFolderAttribute(folderTree, folderResource, "CanCreateSubfolders") == "true"; + var isInbox = specialFolder == "Inbox"; + var isIMAPFolder = GetFolderAttribute(folderTree, folderResource, + "ServerType") == "imap"; + + var ioService = Components.classes["@mozilla.org/network/io-service;1"] + .getService(Components.interfaces.nsIIOService); + + var showNew = ((numSelected <=1) && (serverType != 'nntp') && canCreateNew) || isInbox; + ShowMenuItem("folderPaneContext-new", showNew); + + EnableMenuItem("folderPaneContext-new", !isIMAPFolder || !ioService.offline); + + if (showNew) + { + if (isServer || isInbox) + SetMenuItemLabel("folderPaneContext-new", gMessengerBundle.getString("newFolder")); + else + SetMenuItemLabel("folderPaneContext-new", gMessengerBundle.getString("newSubfolder")); + } +} + function SetupRenameMenuItem(folderResource, numSelected, isServer, serverType, specialFolder) { var msgFolder = folderResource.QueryInterface(Components.interfaces.nsIMsgFolder); diff --git a/mail/base/content/mailWindowOverlay.xul b/mail/base/content/mailWindowOverlay.xul index a136c173f7e7..853601bffb91 100644 --- a/mail/base/content/mailWindowOverlay.xul +++ b/mail/base/content/mailWindowOverlay.xul @@ -693,6 +693,10 @@ + + +