Bug 73801. Disable the delete menu item, context menu item and button when either a Collected or Personal address book is selected. r=neil, sr=bienvenu

This commit is contained in:
technutz%netscape.net 2003-11-11 02:56:36 +00:00
Родитель 294415c97e
Коммит 8329de6c2e
4 изменённых файлов: 48 добавлений и 66 удалений

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

@ -168,6 +168,8 @@ var DirPaneController =
if (command == "cmd_delete")
goSetMenuValue(command, "valueAddressBook");
selectedDir = GetSelectedDirectory();
if (selectedDir == kPersonalAddressbookURI || selectedDir == kCollectedAddressbookURI)
return false;
if (selectedDir) {
// If the selected directory is an ldap directory
// and if the prefs for this directory are locked

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

@ -239,6 +239,7 @@ function SetNameColumn(cmd)
function CommandUpdate_AddressBook()
{
goUpdateCommand('cmd_delete');
goUpdateCommand('button_delete');
}
@ -419,7 +420,8 @@ function AbPrintCardInternal(doPrintPreview, msgType)
}
}
if (!gPrintSettings) {
if (!gPrintSettings)
{
gPrintSettings = GetPrintSettings();
}
@ -525,43 +527,22 @@ function AbExport()
function AbDeleteDirectory()
{
var selectedABURI = GetSelectedDirectory();
if (!selectedABURI) return;
if (!selectedABURI)
return;
var isPersonalOrCollectedAbsSelectedForDeletion = false;
var parentArray = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
if (!parentArray)
return;
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
// check to see if personal or collected address books is selected for deletion.
// if yes, prompt the user an appropriate message saying these cannot be deleted
if ((selectedABURI != kCollectedAddressbookURI) &&
(selectedABURI != kPersonalAddressbookURI)) {
var parentRow = GetParentRow(dirTree, dirTree.currentIndex);
var parentId;
if (parentRow == -1)
parentId = "moz-abdirectory://";
else
parentId = dirTree.builderView.getResourceAtIndex(parentRow).Value;
var parentId = (parentRow == -1) ? "moz-abdirectory://" : dirTree.builderView.getResourceAtIndex(parentRow).Value;
var parentDir = GetDirectoryFromURI(parentId);
parentArray.AppendElement(parentDir);
}
else {
promptService.alert(window,
gAddressBookBundle.getString("cannotDeleteTitle"),
gAddressBookBundle.getString("cannotDeleteMessage"));
return;
}
var confirmDeleteMessage;
var directory = GetDirectoryFromURI(selectedABURI);
if (directory.isMailList)
confirmDeleteMessage = gAddressBookBundle.getString("confirmDeleteMailingList");
else
confirmDeleteMessage = gAddressBookBundle.getString("confirmDeleteAddressbook");
var confirmDeleteMessage = gAddressBookBundle.getString(directory.isMailList ? "confirmDeleteMailingList" : "confirmDeleteAddressbook");
if (!promptService.confirm(window, null, confirmDeleteMessage))
return;

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

@ -215,7 +215,7 @@ Contributor(s):
<menuitem id="menu_cut"/>
<menuitem id="menu_copy"/>
<menuitem id="menu_paste"/>
<menuitem id="menu_delete" observes="button_delete"/>
<menuitem id="menu_delete"/>
<menuseparator/>
<menuitem id="menu_selectAll"/>
<menuseparator/>

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

@ -46,7 +46,6 @@ mailListNameExistsMessage=A Mailing List with that name already exists. Please c
# used in the addressbook
cannotDeleteTitle=Delete Failed
cannotDeleteMessage=You are not allowed to delete the Personal or Collected Addresses address books.
confirmDeleteAddressbook=Are you sure you want to delete the selected address book?
confirmDeleteMailingList=Are you sure you want to delete the selected mailing list?
confirmDeleteListsAndCards=Are you sure you want to delete the selected cards and mailing lists?