Bug 1260564 - Event dialog: get rid of code that shows/hides elements according to event or task item. r=philipp
authorDecathlon <bv1578@gmail.com>
Tue, 29 Mar 2016 23:58:59 +0200
changeset 19351 ad2817156f4ed0349f9055b752d693cd6e08c77b
parent 19350 ebe2c6f39739b5a960d5fd4426fa3f844a46ad1d
child 19352 5eca4100e0c96c2f78570f58590fe015a427c02b
push id11900
push usermozilla@jorgk.com
push dateThu, 19 May 2016 09:03:08 +0000
treeherdercomm-central@cf9529c1f245 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersphilipp
bugs1260564
Bug 1260564 - Event dialog: get rid of code that shows/hides elements according to event or task item. r=philipp
calendar/base/content/dialogs/calendar-event-dialog.js
calendar/base/content/dialogs/calendar-event-dialog.xul
--- a/calendar/base/content/dialogs/calendar-event-dialog.js
+++ b/calendar/base/content/dialogs/calendar-event-dialog.js
@@ -553,25 +553,16 @@ function loadDialog(item) {
         undiscloseCheckbox.disabled = (notifyCheckbox.checked == false);
     }
 
     updateAttendees();
     updateRepeat(true);
     updateReminder(true);
 
     gShowTimeAs = item.getProperty("TRANSP");
-    // display transparency controls only for events
-    if (!cal.isEvent(item)) {
-        setBooleanAttribute("options-freebusy-menu", "hidden", true);
-        setBooleanAttribute("options-menuseparator2", "hidden", true);
-        setBooleanAttribute("status-freebusy", "hidden", true);
-        if (document.getElementById("button-freebusy")) {
-            setBooleanAttribute("button-freebusy", "hidden", true);
-        }
-    }
     updateShowTimeAs();
 }
 
 /**
  * Enables/disables undiscloseCheckbox on (un)checking notifyCheckbox
  */
 function changeUndiscloseCheckboxStatus() {
     let notifyCheckbox = document.getElementById("notify-attendees-checkbox");
@@ -1274,32 +1265,16 @@ function updateTitle() {
     } else {
         throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
     }
     document.title = cal.calGetString("calendar", strName) + ": " +
                         getElementValue("item-title");
 }
 
 /**
- * Handler function for showing the options menu
- *
- * XXX This function could go away with more general CSS rules?
- *
- * @param menuPopup   The menupopup node targeted by the event.
- */
-function onPopupShowing(menuPopup) {
-    if (isToDo(window.calendarItem)) {
-        var nodes = menuPopup.parentNode.querySelectorAll("#options-menupopup > .event-only");
-        for (var i = nodes.length - 1; i >= 0; --i) {
-            nodes.item(i).remove();
-        }
-    }
-}
-
-/**
  * Update the disabled status of the accept button. The button is enabled if all
  * parts of the dialog have options selected that make sense.
  * constraining factors like
  */
 function updateAccept() {
     let enableAccept = true;
     let kDefaultTimezone = calendarDefaultTimezone();
     let startDate;
--- a/calendar/base/content/dialogs/calendar-event-dialog.xul
+++ b/calendar/base/content/dialogs/calendar-event-dialog.xul
@@ -426,18 +426,17 @@
                               observes="cmd_toggle_link"/>
                 </menupopup>
             </menu>
 
             <!-- Options menu -->
             <menu id="options-menu"
                   label="&event.menu.options.label;"
                   accesskey="&event.menu.options.accesskey;">
-                <menupopup id="options-menupopup"
-                           onpopupshowing="onPopupShowing(this)">
+                <menupopup id="options-menupopup">
                   <menuitem id="options-attendees-menuitem"
                             label="&event.menu.options.attendees.label;"
                             accesskey="&event.menu.options.attendees.accesskey;"
                             command="cmd_attendees"
                             disable-on-readonly="true"/>
                   <menu id="options-attachments-menu"
                         label="&event.attachments.menubutton.label;"
                         accesskey="&event.attachments.menubutton.accesskey;">
@@ -541,18 +540,19 @@
                       <menuitem id="options-status-canceled-menuitem"
                                 label="&newevent.eventStatus.cancelled.label;"
                                 accesskey="&newevent.eventStatus.cancelled.accesskey;"
                                 type="radio"
                                 command="cmd_status_cancelled"
                                 disable-on-readonly="true"/>
                     </menupopup>
                   </menu>
-                  <menuseparator id="options-menuseparator2"/>
+                  <menuseparator id="options-menuseparator2" class="event-only"/>
                   <menu id="options-freebusy-menu"
+                        class="event-only"
                         label="&event.menu.options.show.time.label;"
                         accesskey="&event.menu.options.show.time.accesskey;"
                         disable-on-readonly="true">
                       <menupopup id="options-freebusy-menupopup">
                           <menuitem id="options-freebusy-busy-menuitem"
                                     label="&event.menu.options.show.time.busy.label;"
                                     accesskey="&event.menu.options.show.time.busy.accesskey;"
                                     type="radio"
@@ -694,17 +694,17 @@
                               name="event-status-group"
                               label="&newevent.eventStatus.cancelled.label;"
                               type="radio"
                               command="cmd_status_cancelled"/>
                 </menupopup>
             </toolbarbutton>
             <toolbarbutton id="button-freebusy"
                            mode="dialog"
-                           class="cal-event-toolbarbutton toolbarbutton-1"
+                           class="cal-event-toolbarbutton toolbarbutton-1 event-only"
                            type="menu-button"
                            disable-on-readonly="true"
                            label="&event.menu.options.show.time.label;"
                            tooltiptext="&event.toolbar.freebusy.tooltip;"
                            oncommand="rotateShowTimeAs()">
                 <menupopup id="event-freebusy-menupopup">
                     <menuitem id="event-freebusy-busy-menuitem"
                               name="event-freebusy-group"
@@ -1300,16 +1300,17 @@
         <label id="status-status-confirmed-label"
                value="&newevent.status.confirmed.label;"
                hidden="true"/>
         <label id="status-status-cancelled-label"
                value="&newevent.eventStatus.cancelled.label;"
                hidden="true"/>
       </statusbarpanel>
       <statusbarpanel id="status-freebusy"
+                      class="event-only"
                       align="center"
                       flex="1"
                       collapsed="true"
                       pack="start">
         <label value="&event.statusbarpanel.freebusy.label;"/>
         <label id="status-freebusy-free-label"
                value="&event.freebusy.legend.free;"
                hidden="true"/>