Fix bug 512436 - Unconditional removal of 'disabled' state in function changeContextMenuForTask. r=philipp
authorDecathlon <bv1578@gmail.com>
Sun, 11 Oct 2009 12:43:45 +0200
changeset 4111 5b06b05381276349c7d3452fd0b48b802054283b
parent 4110 a470766f312b499f8da58c98c31d82d8e52c3dce
child 4112 7468fa89cd4b1087307a3d3566f1893400bd9fff
push id3213
push usermozilla@kewis.ch
push dateSun, 11 Oct 2009 10:43:55 +0000
treeherdercomm-central@5b06b0538127 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersphilipp
bugs512436
Fix bug 512436 - Unconditional removal of 'disabled' state in function changeContextMenuForTask. r=philipp
calendar/base/content/calendar-task-tree.js
--- a/calendar/base/content/calendar-task-tree.js
+++ b/calendar/base/content/calendar-task-tree.js
@@ -103,18 +103,25 @@ function changeContextMenuForTask(aEvent
     document.getElementById("task-context-menu-modify").hidden =
         (idnode == "unifinder-todo-tree" && !sunbird);
     document.getElementById("task-context-menu-new-todaypane").hidden =
         (idnode == "calendar-task-tree" || sunbird);
     document.getElementById("task-context-menu-modify-todaypane").hidden =
         (idnode == "calendar-task-tree" || sunbird);
     let tasksSelected = (getSelectedTasks(aEvent).length > 0);
     applyAttributeToMenuChildren(aEvent.target, "disabled", (!tasksSelected));
-    document.getElementById("calendar_new_todo_command").removeAttribute("disabled");
-    document.getElementById("calendar_new_todo_todaypane_command").removeAttribute("disabled");
+    if (calendarController.isCommandEnabled("calendar_new_todo_command") &&
+        calendarController.isCommandEnabled("calendar_new_todo_todaypane_command")) {
+        document.getElementById("calendar_new_todo_command").removeAttribute("disabled");
+        document.getElementById("calendar_new_todo_todaypane_command").removeAttribute("disabled");
+    } else {
+        document.getElementById("calendar_new_todo_command").setAttribute("disabled", "true");
+        document.getElementById("calendar_new_todo_todaypane_command").setAttribute("disabled", "true");
+    }
+
     changeMenuForTask(aEvent);
 }
 
 /**
  * Change the opening menu for the selected tasks.
  *
  * @param aEvent    The popupshowing event of the opening menu.
  */