Bug 321434 - Location does not appear in multiday view event box. r/a=philipp
authorClemens <clemens@gorilla-computing.de>
Mon, 12 Mar 2018 17:44:46 +0100
changeset 30466 9b22a733b765b9a50133661fdccba4e01c3d91de
parent 30465 31f99e02f7b02c927c38157835d74dc0853fc02b
child 30467 ea8dbf162c4b143ddf51a0fc81e972d81c66e594
child 30469 9e830030585ab39e8b63e4f17ee580984c58e71d
push idunknown
push userunknown
push dateunknown
bugs321434
Bug 321434 - Location does not appear in multiday view event box. r/a=philipp MozReview-Commit-ID: 4BbeOscF0ec
calendar/base/content/calendar-base-view.xml
calendar/base/content/calendar-multiday-view.xml
calendar/base/content/calendar-view-core.xml
calendar/base/content/preferences/general.xul
calendar/base/content/preferences/views.xul
calendar/base/themes/common/calendar-views.css
calendar/locales/en-US/chrome/calendar/preferences/views.dtd
--- a/calendar/base/content/calendar-base-view.xml
+++ b/calendar/base/content/calendar-base-view.xml
@@ -638,16 +638,17 @@
                     break;
                 case "calendar.alarms.indicator.show":
                     // Break here to ensure the view is refreshed
                     break;
                 case "calendar.week.start":
                     this.weekStartOffset = aSubject.getIntPref(aPreference);
                     break;
                 case "calendar.date.format":
+                case "calendar.view.showLocation":
                     this.refreshView();
                     break;
                 default:
                     return;
             }
             this.refreshView();
         ]]></body>
       </method>
--- a/calendar/base/content/calendar-multiday-view.xml
+++ b/calendar/base/content/calendar-multiday-view.xml
@@ -2256,22 +2256,24 @@
                        flex="1"
                        xbl:inherits="context,parentorient=orient,readonly,flashing,alarm,allday,priority,progress,status,calendar,categories">
               <xul:hbox class="calendar-event-details"
                         anonid="calendar-event-details"
                         align="start">
                 <xul:image anonid="item-icon"
                            class="calendar-item-image"
                            xbl:inherits="progress,allday,itemType,todoType"/>
-                <xul:description anonid="event-name" class="calendar-event-details-core" flex="1"/>
-                <xul:textbox anonid="event-name-textbox"
-                             class="plain calendar-event-details-core calendar-event-name-textbox"
-                             flex="1"
-                             hidden="true"
-                             wrap="true"/>
+                <xul:vbox flex="1">
+                  <xul:label anonid="event-name" class="calendar-event-details-core title-desc" crop="end"/>
+                  <xul:textbox anonid="event-name-textbox"
+                               class="plain calendar-event-details-core calendar-event-name-textbox"
+                               hidden="true"
+                               wrap="true"/>
+                  <xul:label anonid="event-location" class="calendar-event-details-core location-desc" crop="end"/>
+                </xul:vbox>
               </xul:hbox>
               <xul:stack mousethrough="always">
                 <xul:calendar-category-box anonid="category-box" xbl:inherits="categories" pack="end" />
                 <xul:hbox align="right">
                   <xul:hbox anonid="alarm-icons-box"
                             class="alarm-icons-box"
                             pack="end"
                             align="top"
--- a/calendar/base/content/calendar-view-core.xml
+++ b/calendar/base/content/calendar-view-core.xml
@@ -20,29 +20,26 @@
                    xbl:inherits="calendar-uri,calendar-id"
                    flex="1">
             <xul:box class="calendar-event-selection" orient="horizontal" flex="1">
               <xul:stack anonid="eventbox"
                          class="calendar-event-box-container"
                          flex="1"
                          xbl:inherits="readonly,flashing,alarm,allday,priority,progress,status,calendar,categories">
                 <xul:hbox class="calendar-event-details">
-                  <xul:vbox align="left"
-                            flex="1"
-                            xbl:inherits="context">
-                    <xul:label anonid="event-name"
-                               crop="end"
-                               flex="1"
-                               style="margin: 0;"/>
+                  <xul:vbox align="left" flex="1" xbl:inherits="context">
+                    <xul:label anonid="event-name" crop="end" style="margin: 0;"/>
                     <xul:textbox anonid="event-name-textbox"
-                                 class="plain"
-                                 crop="end"
+                                 class="calendar-event-details-core title-desc"
                                  hidden="true"
                                  style="background: transparent !important;"
                                  wrap="true"/>
+                    <xul:label anonid="event-location"
+                               crop="end"
+                               class="calendar-event-details-core location-desc"/>
                     <xul:spacer flex="1"/>
                   </xul:vbox>
                   <xul:stack>
                     <xul:calendar-category-box anonid="category-box"
                                                xbl:inherits="categories"
                                                pack="end"/>
                     <xul:hbox align="center">
                       <xul:hbox anonid="alarm-icons-box"
@@ -129,16 +126,17 @@
 
       <property name="occurrence">
         <getter><![CDATA[
             return this.mOccurrence;
         ]]></getter>
         <setter><![CDATA[
             this.mOccurrence = val;
             this.setEditableLabel();
+            this.setLocationLabel();
             this.setCSSClasses();
             return val;
         ]]></setter>
       </property>
 
       <property name="eventNameLabel" readonly="true"
         onget="return document.getAnonymousElementByAttribute(this, 'anonid', 'event-name');"/>
       <property name="eventNameTextbox" readonly="true"
@@ -148,16 +146,27 @@
         <body><![CDATA[
             let evl = this.eventNameLabel;
             let item = this.mOccurrence;
             evl.value = (item.title ? item.title.replace(/\n/g, " ")
                                     : cal.calGetString("calendar", "eventUntitled"));
         ]]></body>
       </method>
 
+      <method name="setLocationLabel">
+        <body><![CDATA[
+            let locationLabel = document.getAnonymousElementByAttribute(this, "anonid", "event-location");
+            let location = this.mOccurrence.getProperty("LOCATION");
+            let showLocation = Preferences.get("calendar.view.showLocation", false);
+
+            locationLabel.value = showLocation && location ? location : "";
+            setBooleanAttribute(locationLabel, "hidden", !showLocation || !location);
+        ]]></body>
+      </method>
+
       <method name="setCSSClasses">
         <body><![CDATA[
             let item = this.mOccurrence;
             this.setAttribute("calendar-uri", item.calendar.uri.spec);
             this.setAttribute("calendar-id", item.calendar.id);
             let categoriesArray = item.getCategories({});
             if (categoriesArray.length > 0) {
                 let cssClassesArray = categoriesArray.map(cal.view.formatStringForCSSRule);
--- a/calendar/base/content/preferences/general.xul
+++ b/calendar/base/content/preferences/general.xul
@@ -63,32 +63,34 @@
                         type="int"/>
             <preference id="calendar.item.editInTab"
                         name="calendar.item.editInTab"
                         type="bool"/>
         </preferences>
 
         <groupbox>
             <caption label="&pref.mainbox.label;"/>
-            <hbox align="center">
+            <vbox align="left">
+              <hbox align="center">
                 <label value="&pref.dateformat.label;"
                        accesskey="&pref.dateformat.accesskey;"
                        control="dateformat"/>
                 <menulist id="dateformat" crop="none"
                           preference="calendar.date.format">
                     <menupopup id="dateformatpopup">
                         <menuitem id="dateformat-long-menuitem"
                                   label="&pref.dateformat.long;"
                                   value="0"/>
                         <menuitem id="dateformat-short-menuitem"
                                   label="&pref.dateformat.short;"
                                   value="1"/>
                     </menupopup>
                 </menulist>
-            </hbox>
+              </hbox>
+            </vbox>
         </groupbox>
 
         <groupbox>
             <caption label="&pref.timezones.caption;"/>
             <hbox align="center">
                 <label value="&pref.timezones.label;"
                        accesskey="&pref.timezones.accesskey;"
                        control="calendar-timezone-menulist"/>
--- a/calendar/base/content/preferences/views.xul
+++ b/calendar/base/content/preferences/views.xul
@@ -64,16 +64,19 @@
                         name="calendar.view.visiblehours"
                         type="int"/>
             <preference id="calendar.weeks.inview"
                         name="calendar.weeks.inview"
                         type="int"/>
             <preference id="calendar.previousweeks.inview"
                         name="calendar.previousweeks.inview"
                         type="int"/>
+            <preference id="calendar.view.showLocation"
+                        name="calendar.view.showLocation"
+                        type="bool"/>
         </preferences>
 
         <groupbox>
             <caption label="&pref.calendar.view.allview.caption;"/>
             <hbox>
                 <hbox align="center" flex="1">
                     <label value="&pref.weekstarts.label;"
                            accesskey="&pref.weekstarts.accesskey;"
@@ -260,16 +263,22 @@
                                 <menuitem id="timeEnd20"                         value="20"/>
                                 <menuitem id="timeEnd21"                         value="21"/>
                                 <menuitem id="timeEnd22"                         value="22"/>
                                 <menuitem id="timeEnd23"                         value="23"/>
                                 <menuitem id="timeEnd24" label="&time.midnight;" value="24"/>
                             </menupopup>
                         </menulist>
                     </row>
+                    <row align="center">
+                        <checkbox id="showLocation" pack="end"
+                                  label="&pref.showlocation.label;"
+                                  preference="calendar.view.showLocation"/>
+                        <spacer/>
+                    </row>
                 </rows>
             </grid>
         </groupbox>
 
         <groupbox id="viewsMultiweekGroupbox">
             <caption label="&pref.calendar.view.multiweekview.caption;"/>
             <hbox align="center">
                 <label value="&pref.numberofweeks.label;"
--- a/calendar/base/themes/common/calendar-views.css
+++ b/calendar/base/themes/common/calendar-views.css
@@ -496,17 +496,25 @@ calendar-time-bar[orient="horizontal"] {
 .calendar-time-bar-box-even[orient="vertical"] {
     border-bottom: 1px  transparent !important;
     border-right: 1px solid var(--viewBorderColor);
     margin-inline-end: 1px;
     width: 10ex; /* the same as the calendar-time-bar element */
 }
 
 /** End time bar **/
-
+.calendar-event-details-core.title-desc,
+.calendar-event-details-core.location-desc {
+    font-weight: normal;
+}
+.calendar-event-details-core.location-desc {
+    opacity: 0.5;
+    margin: 0;
+    white-space: pre;
+}
 calendar-multiday-view {
     background-color: var(--viewBackground);
     padding: 0px;
 }
 
 calendar-multiday-view[hidden="true"] {
     display: none;
 }
--- a/calendar/locales/en-US/chrome/calendar/preferences/views.dtd
+++ b/calendar/locales/en-US/chrome/calendar/preferences/views.dtd
@@ -32,8 +32,10 @@
 <!ENTITY pref.numberofpreviousweeks.accesskey "P">
 <!ENTITY pref.numberofweeks.0 "none">
 <!ENTITY pref.numberofweeks.1 "1 week">
 <!ENTITY pref.numberofweeks.2 "2 weeks">
 <!ENTITY pref.numberofweeks.3 "3 weeks">
 <!ENTITY pref.numberofweeks.4 "4 weeks">
 <!ENTITY pref.numberofweeks.5 "5 weeks">
 <!ENTITY pref.numberofweeks.6 "6 weeks">
+<!ENTITY pref.showlocation.label "Show location">
+<!ENTITY pref.showlocation.accesskey "L">