Bug 1187741 - VTODO only calendar disables "add as task" button. r=philipp
authorMerike Sell <merike.sell@eesti.ee>
Thu, 06 Aug 2015 13:27:00 +0200
changeset 23069 fbc2a9c68d93a89fb49f9611cb9db4f328853f27
parent 23068 84b210b8fa1defa4f2633e02b87e568bfbd65eae
child 23070 ff3e15f182d8a3725503d4df70113a2bcd0ec6fe
push id1474
push usermbanner@mozilla.com
push dateMon, 21 Sep 2015 17:20:48 +0000
treeherdercomm-beta@3094bab4c31f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersphilipp
bugs1187741
Bug 1187741 - VTODO only calendar disables "add as task" button. r=philipp
calendar/base/content/calendar-extract.js
--- a/calendar/base/content/calendar-extract.js
+++ b/calendar/base/content/calendar-extract.js
@@ -226,29 +226,45 @@ let calendarExtract = {
     },
 
     setState: function setState() {
         let eventButton = document.getElementById("extractEventButton");
         let taskButton = document.getElementById("extractTaskButton");
         let hdrEventButton = document.getElementById("hdrExtractEventButton");
         let hdrTaskButton = document.getElementById("hdrExtractTaskButton");
         let contextMenu = document.getElementById("mailContext-calendar-convert-menu");
-        let buttonsDisabled = (gFolderDisplay.selectedCount == 0);
+        let contextMenuEvent = document.getElementById("mailContext-calendar-convert-event-menuitem");
+        let contextMenuTask = document.getElementById("mailContext-calendar-convert-task-menuitem");
+        let eventDisabled = (gFolderDisplay.selectedCount == 0);
+        let taskDisabled = (gFolderDisplay.selectedCount == 0);
         let contextDisabled = false;
+        let contextEventDisabled = false;
+        let contextTaskDisabled = false;
         let newEvent = document.getElementById("calendar_new_event_command");
+        let newTask = document.getElementById("calendar_new_todo_command");
 
         if (newEvent.getAttribute("disabled") == "true") {
-            buttonsDisabled = true;
-            contextDisabled = true;
+            eventDisabled = true;
+            contextEventDisabled = true;
         }
+
+        if (newTask.getAttribute("disabled") == "true") {
+            taskDisabled = true;
+            contextTaskDisabled = true;
+        }
+
         if (eventButton)
-            eventButton.disabled = buttonsDisabled
+            eventButton.disabled = eventDisabled;
         if (taskButton)
-            taskButton.disabled = buttonsDisabled;
+            taskButton.disabled = taskDisabled;
         if (hdrEventButton)
-            hdrEventButton.disabled = buttonsDisabled;
+            hdrEventButton.disabled = eventDisabled;
         if (hdrTaskButton)
-            hdrTaskButton.disabled = buttonsDisabled;
-        contextMenu.disabled = contextDisabled;
+            hdrTaskButton.disabled = taskDisabled;
+
+        contextMenuEvent.disabled = contextEventDisabled;
+        contextMenuTask.disabled = contextTaskDisabled;
+
+        contextMenu.disabled = contextEventDisabled && contextTaskDisabled;
     }
 };
 
 window.addEventListener("load", calendarExtract.addListeners.bind(calendarExtract), false);