File | New | Folder menu needs to be disabled while offline

Bug 102284 r=ssu sr=bienvenu patch=calvin.liu@sun.com
This commit is contained in:
antonio.xu%sun.com 2002-08-14 06:33:06 +00:00
Родитель d5bcedda4f
Коммит 6b12b45b58
3 изменённых файлов: 47 добавлений и 2 удалений

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

@ -351,9 +351,15 @@ function SetupNewMenuItem(folderResource, numSelected, isServer, serverType, spe
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", true);
EnableMenuItem("folderPaneContext-new", !isIMAPFolder || !ioService.offline);
if(showNew)
{
if(isServer || isInbox)

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

@ -59,6 +59,9 @@ var disallow_classes_no_html = 1; /* the user preference,
// dialog.
function menu_new_init()
{
if (!gMessengerBundle)
gMessengerBundle = document.getElementById("bundle_messenger");
if (!nsPrefBranch) {
var prefService = Components.classes["@mozilla.org/preferences-service;1"];
prefService = prefService.getService();
@ -68,6 +71,42 @@ function menu_new_init()
var newAccountItem = document.getElementById('newAccountMenuItem');
if (nsPrefBranch.prefIsLocked("mail.disable_new_account_addition"))
newAccountItem.setAttribute("disabled","true");
// Change "New Folder..." menu according to the context
var startIndex = {};
var endIndex = {};
var folderTree = GetFolderTree();
folderTree.treeBoxObject.selection.getRangeAt(0, startIndex, endIndex);
if (startIndex.value < 0)
return false;
var numSelected = endIndex.value - startIndex.value + 1;
var folderResource = GetFolderResource(folderTree, startIndex.value);
var specialFolder = GetFolderAttribute(folderTree, folderResource,
"SpecialFolder");
var isServer = GetFolderAttribute(folderTree, folderResource,
"IsServer") == 'true';
var serverType = GetFolderAttribute(folderTree, folderResource,
"ServerType");
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("menu_newFolder", showNew);
EnableMenuItem("menu_newFolder", !isIMAPFolder || !ioService.offline);
if (showNew)
{
if (isServer || isInbox)
SetMenuItemLabel("menu_NewFolder",
gMessengerBundle.getString("newFolder"));
else
SetMenuItemLabel("menu_NewFolder",
gMessengerBundle.getString("newSubfolder"));
}
}
function goUpdateMailMenuItems(commandset)

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

@ -903,7 +903,7 @@ Rights Reserved.
accesskey="&newNewMsgCmd.accesskey;"
key="key_newMessage"
oncommand="MsgNewMessage(null);"/>
<menuitem label="&newFolderCmd.label;"
<menuitem id="menu_newFolder" label="&newFolderCmd.label;"
oncommand="MsgNewFolder(NewFolder);"
accesskey="&newFolderCmd.accesskey;"/>
<menuitem id="newAccountMenuItem" label="&newAccountCmd.label;"