Bug 1581200 - remove <observes> from calendar/. r=philipp
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Fri, 13 Sep 2019 22:30:55 +0300
changeset 36890 b4cd90465304c1255669d738be976b6145c737f3
parent 36889 5156145ef2bc381ee7fb019a78a4043c509f5756
child 36891 90a977469503284f3c7293b8fe0bb780442bf5b7
push id395
push userclokep@gmail.com
push dateMon, 02 Dec 2019 19:38:57 +0000
reviewersphilipp
bugs1581200
Bug 1581200 - remove <observes> from calendar/. r=philipp
calendar/base/content/agenda-listbox-utils.js
calendar/base/content/calendar-common-sets.js
calendar/base/content/calendar-common-sets.xul
calendar/base/content/today-pane.xul
--- a/calendar/base/content/agenda-listbox-utils.js
+++ b/calendar/base/content/agenda-listbox-utils.js
@@ -567,17 +567,17 @@ agendaListbox.deleteSelectedItem = funct
 
 /**
  * If a Period item is targeted by the passed DOM event, opens the event dialog
  * with the period's start date prefilled.
  *
  * @param aEvent            The DOM event that targets the period.
  */
 agendaListbox.createNewEvent = function(aEvent) {
-  if (!this.isEventListItem(aEvent.target)) {
+  if (!this.isEventListItem(aEvent.explicitOriginalTarget)) {
     // Create new event for the date currently displayed in the agenda. Setting
     // isDate = true automatically makes the start time be the next full hour.
     let eventStart = agendaListbox.today.start.clone();
     eventStart.isDate = true;
     if (calendarController.isCommandEnabled("calendar_new_event_command")) {
       createEventWithDialog(getSelectedCalendar(), eventStart);
     }
   }
--- a/calendar/base/content/calendar-common-sets.js
+++ b/calendar/base/content/calendar-common-sets.js
@@ -125,16 +125,17 @@ var calendarController = {
     }
     return false;
   },
 
   isCommandEnabled: function(aCommand) {
     switch (aCommand) {
       case "calendar_new_event_command":
       case "calendar_new_event_context_command":
+      case "calendar_new_event_todaypane_command":
         return CalendarNewEventsCommandEnabled;
       case "calendar_modify_focused_item_command":
         return this.item_selected;
       case "calendar_modify_event_command":
         return this.item_selected;
       case "calendar_delete_focused_item_command":
         return CalendarDeleteCommandEnabled && this.selected_items_writable;
       case "calendar_delete_event_command":
--- a/calendar/base/content/calendar-common-sets.xul
+++ b/calendar/base/content/calendar-common-sets.xul
@@ -13,16 +13,17 @@
          xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml">
   <script src="chrome://calendar/content/calendar-common-sets.js"/>
 
   <commandset id="calendar_commands"
               commandupdater="true"
               events="calendar_commands"
               oncommandupdate="calendarController.updateCommands()">
     <command id="calendar_new_event_command" oncommand="goDoCommand('calendar_new_event_command')"/>
+    <command id="calendar_new_event_todaypane_command" oncommand="agendaListbox.createNewEvent(event)"/>
     <command id="calendar_new_event_context_command" oncommand="goDoCommand('calendar_new_event_context_command')"/>
     <command id="calendar_modify_event_command" oncommand="goDoCommand('calendar_modify_event_command')"/>
     <command id="calendar_delete_event_command" oncommand="goDoCommand('calendar_delete_event_command')"/>
 
     <command id="calendar_new_todo_command" oncommand="goDoCommand('calendar_new_todo_command')"/>
     <command id="calendar_new_todo_context_command" oncommand="goDoCommand('calendar_new_todo_context_command')"/>
     <command id="calendar_new_todo_todaypane_command" oncommand="goDoCommand('calendar_new_todo_todaypane_command')"/>
     <command id="calendar_modify_todo_command" oncommand="goDoCommand('calendar_modify_todo_command')"/>
--- a/calendar/base/content/today-pane.xul
+++ b/calendar/base/content/today-pane.xul
@@ -152,19 +152,17 @@
         <vbox flex="1">
           <hbox id="agenda-toolbar" iconsize="small">
             <toolbarbutton id="todaypane-new-event-button"
                            mode="mail"
                            iconsize="small"
                            orient="horizontal"
                            label="&calendar.newevent.button.label;"
                            tooltiptext="&calendar.newevent.button.tooltip;"
-                           oncommand="agendaListbox.createNewEvent(event)">
-              <observes element="calendar_new_event_command" attribute="disabled"/>
-            </toolbarbutton>
+                           command="calendar_new_event_todaypane_command"/>
           </hbox>
           <richlistbox id="agenda-listbox" flex="1" context="_child"
                        onblur="agendaListbox.onBlur();"
                        onfocus="agendaListbox.onFocus();"
                        onkeypress="agendaListbox.onKeyPress(event);"
                        ondblclick="agendaListbox.createNewEvent(event);"
                        ondragstart="nsDragAndDrop.startDrag(event, calendarCalendarButtonDNDObserver);"
                        ondragover="nsDragAndDrop.dragOver(event, calendarCalendarButtonDNDObserver);"