Bug 1322838 - Check for selected directory better. r=aceman a=jorgk

This commit is contained in:
Jorg K 2016-12-15 01:29:02 +01:00
Родитель 09ddae5fd8
Коммит d38faf21cc
2 изменённых файлов: 13 добавлений и 13 удалений

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

@ -66,23 +66,23 @@ var DirPaneController =
case "cmd_delete": case "cmd_delete":
case "button_delete": { case "button_delete": {
let selectedDir = getSelectedDirectory(); let selectedDir = getSelectedDirectory();
if (!selectedDir)
return false;
let selectedDirURI = selectedDir.URI; let selectedDirURI = selectedDir.URI;
// Context-sensitive labels for Edit > Delete menuitem. // Context-sensitive labels for Edit > Delete menuitem.
// We only have ABs or Mailing Lists in the directory pane. // We only have ABs or Mailing Lists in the directory pane.
// For contacts and mixed selections, the label is set in // For contacts and mixed selections, the label is set in
// ResultsPaneController in abResultsPane.js. // ResultsPaneController in abResultsPane.js.
if (command == "cmd_delete" && selectedDir) { if (command == "cmd_delete") {
goSetMenuValue(command, selectedDir.isMailList ? goSetMenuValue(command, selectedDir.isMailList ?
"valueList" : "valueAddressBook"); "valueList" : "valueAddressBook");
} }
// If there's no directory selected, or if it's one of these special ABs, // If it's one of these special ABs, return false to disable deletion.
// return false to disable deletion. if (selectedDirURI == kPersonalAddressbookURI ||
if (!selectedDir || selectedDirURI == kCollectedAddressbookURI ||
(selectedDirURI == kPersonalAddressbookURI) || selectedDirURI == (kAllDirectoryRoot + "?"))
(selectedDirURI == kCollectedAddressbookURI) ||
(selectedDirURI == (kAllDirectoryRoot + "?")))
return false; return false;
// If the directory is a mailing list, and it is read-only, // If the directory is a mailing list, and it is read-only,

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

@ -55,19 +55,19 @@ var DirPaneController =
case "cmd_delete": case "cmd_delete":
case "button_delete": { case "button_delete": {
let selectedDir = getSelectedDirectory(); let selectedDir = getSelectedDirectory();
if (!selectedDir)
return false;
let selectedDirURI = selectedDir.URI; let selectedDirURI = selectedDir.URI;
// Context-sensitive labels for Edit > Delete menuitem. // Context-sensitive labels for Edit > Delete menuitem.
if (command == "cmd_delete" && selectedDir) { if (command == "cmd_delete") {
goSetMenuValue(command, selectedDir.isMailList ? goSetMenuValue(command, selectedDir.isMailList ?
"valueList" : "valueAddressBook"); "valueList" : "valueAddressBook");
} }
// If there's no directory selected, or if it's one of these special ABs, // If it's one of these special ABs, return false to disable deletion.
// return false to disable deletion. if (selectedDirURI == kPersonalAddressbookURI ||
if (!selectedDir || selectedDirURI == kCollectedAddressbookURI)
(selectedDirURI == kPersonalAddressbookURI) ||
(selectedDirURI == kCollectedAddressbookURI))
return false; return false;
// If the directory is a mailing list, and it is read-only, // If the directory is a mailing list, and it is read-only,