Bug 432675 - Move the timezone prefs to General. r=philipp, a=Paenglab
authorRichard Marti <richard.marti@gmail.com>
Sun, 14 Dec 2014 19:35:19 +0100
changeset 21548 d9842ddc938bb841ce24eb4c3d8fa1b069eb962b
parent 21547 9e3301977f89908a296346d3edc602821126ae28
child 21549 46a69933fed73b0f60c1b88acc090671124eedb5
push id1305
push usermbanner@mozilla.com
push dateMon, 23 Feb 2015 19:48:12 +0000
treeherdercomm-beta@3ae4f13858fd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersphilipp, Paenglab
bugs432675
Bug 432675 - Move the timezone prefs to General. r=philipp, a=Paenglab
calendar/base/content/preferences/general.js
calendar/base/content/preferences/general.xul
calendar/base/content/preferences/timezones.js
calendar/base/content/preferences/timezones.xul
calendar/base/jar.mn
calendar/lightning/content/messenger-overlay-preferences.xul
calendar/lightning/content/suite-overlay-preferences.xul
calendar/lightning/jar.mn
calendar/locales/en-US/chrome/calendar/preferences/general.dtd
calendar/locales/en-US/chrome/calendar/preferences/preferences.dtd
calendar/locales/en-US/chrome/calendar/preferences/timezones.dtd
calendar/locales/jar.mn
--- a/calendar/base/content/preferences/general.js
+++ b/calendar/base/content/preferences/general.js
@@ -1,14 +1,16 @@
 /**
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+Components.utils.import("resource://calendar/modules/calUtils.jsm");
+
 /**
  * Global Object to hold methods for the general pref pane
  */
 var gCalendarGeneralPane = {
     /**
      * Initialize the general pref pane. Sets up dialog controls to match the
      * values set in prefs.
      */
@@ -24,16 +26,44 @@ var gCalendarGeneralPane = {
                 .setAttribute("label", labelLong + ": " + dateFormattedLong);
         document.getElementById("dateformat-short-menuitem")
                 .setAttribute("label", labelShort + ": " + dateFormattedShort);
 
         // deselect and reselect to update visible item title
         updateSelectedLabel("dateformat");
         updateUnitLabelPlural("defaultlength", "defaultlengthunit", "minutes");
         this.updateDefaultTodoDates();
+
+        let tzMenuList = document.getElementById("calendar-timezone-menulist");
+        let tzMenuPopup = document.getElementById("calendar-timezone-menupopup");
+
+        let tzService = cal.getTimezoneService();
+        let enumerator = tzService.timezoneIds;
+        let tzids = {};
+        let displayNames = [];
+        // don't rely on what order the timezone-service gives you
+        while (enumerator.hasMore()) {
+            let tz = tzService.getTimezone(enumerator.getNext());
+            if (tz && !tz.isFloating && !tz.isUTC) {
+                let displayName = tz.displayName;
+                displayNames.push(displayName);
+                tzids[displayName] = tz.tzid;
+            }
+        }
+        // the display names need to be sorted
+        displayNames.sort(String.localeCompare);
+        for (let displayName of displayNames) {
+            addMenuItem(tzMenuPopup, displayName, tzids[displayName]);
+        }
+
+        let prefValue = document.getElementById("calendar-timezone-local").value;
+        if (!prefValue) {
+            prefValue = calendarDefaultTimezone().tzid;
+        }
+        tzMenuList.value = prefValue;
     },
 
     updateDefaultTodoDates: function gCGP_updateDefaultTodoDates() {
         let defaultDue = document.getElementById("default_task_due").value;
         let defaultStart = document.getElementById("default_task_start").value;
         let offsetValues = ["offsetcurrent", "offsetnexthour"];
 
         document.getElementById("default_task_due_offset")
@@ -46,9 +76,8 @@ var gCalendarGeneralPane = {
     },
 
     updateItemtypeDeck: function() {
         let panelId = document.getElementById("defaults-itemtype-menulist").value;
         let panel = document.getElementById(panelId);
         document.getElementById("defaults-itemtype-deck").selectedPanel = panel;
     }
 };
-
--- a/calendar/base/content/preferences/general.xul
+++ b/calendar/base/content/preferences/general.xul
@@ -14,31 +14,38 @@
 
 <overlay id="CalendarGeneralPaneOverlay"
          xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
     <vbox id="calPreferencesBoxGeneral">
         <script type="application/javascript"
                 src="chrome://calendar/content/preferences/general.js"/>
         <script type="application/javascript"
+                src="chrome://calendar/content/preferences/timezones.js"/>
+        <script type="application/javascript"
                 src="chrome://calendar/content/calendar-ui-utils.js"/>
+        <script type="application/javascript"
+                src="chrome://calendar/content/calUtils.js"/>
 
         <!-- Get the localized text for use in the .js -->
         <script type="application/javascript">
             var labelLong  = "&pref.dateformat.long;";
             var labelShort = "&pref.dateformat.short;";
         </script>
 
         <preferences>
             <preference id="calendar.date.format"
                         name="calendar.date.format"
                         type="int"/>
             <preference id="calendar.event.defaultlength"
                         name="calendar.event.defaultlength"
                         type="int"/>
+            <preference id="calendar-timezone-local"
+                        name="calendar.timezone.local"
+                        type="string"/>
             <preference id="calendar.task.defaultstart"
                         name="calendar.task.defaultstart"
                         type="string"/>
             <preference id="calendar.task.defaultstartoffset"
                         name="calendar.task.defaultstartoffset"
                         type="int"/>
             <preference id="calendar.task.defaultstartoffsetunits"
                         name="calendar.task.defaultstartoffsetunits"
@@ -72,27 +79,29 @@
                         <menuitem id="dateformat-short-menuitem"
                                   label="&pref.dateformat.short;"
                                   value="1"/>
                     </menupopup>
                 </menulist>
             </hbox>
         </groupbox>
 
-#ifndef XP_MACOSX
         <groupbox>
-            <caption label="&pref.accessibility.label;"/>
+            <caption label="&pref.timezones.caption;"/>
             <hbox align="center">
-                <checkbox id="systemColors" pack="end"
-                          label="&pref.systemcolors.label;"
-                          accesskey="&pref.systemcolors.accesskey;"
-                          preference="calendar.view.useSystemColors"/>
+                <label value="&pref.timezones.label;"
+                       accesskey="&pref.timezones.accesskey;"
+                       control="calendar-timezone-menulist"/>
+                <menulist id="calendar-timezone-menulist"
+                          flex="1"
+                          preference="calendar-timezone-local">
+                    <menupopup id="calendar-timezone-menupopup"/>
+                </menulist>
             </hbox>
         </groupbox>
-#endif
 
         <groupbox id="defaults-itemtype-groupbox">
             <caption id="defaults-itemtype-caption" label="&pref.defaults.label;"/>
             <menulist id="defaults-itemtype-menulist" oncommand="gCalendarGeneralPane.updateItemtypeDeck()">
                 <menupopup id="defaults-itemtype-menupopup">
                     <menuitem id="defaults-itemtype-event"
                               label="&pref.events.label;"
                               value="defaults-event-grid"/>
@@ -236,10 +245,22 @@
                                     </menupopup>
                                 </menulist>
                             </hbox>
                         </row>
                     </rows>
                 </grid>
             </deck>
         </groupbox>
+
+#ifndef XP_MACOSX
+        <groupbox>
+            <caption label="&pref.accessibility.label;"/>
+            <hbox align="center">
+                <checkbox id="systemColors" pack="end"
+                          label="&pref.systemcolors.label;"
+                          accesskey="&pref.systemcolors.accesskey;"
+                          preference="calendar.view.useSystemColors"/>
+            </hbox>
+        </groupbox>
+#endif
     </vbox>
 </overlay>
deleted file mode 100644
--- a/calendar/base/content/preferences/timezones.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-Components.utils.import("resource://calendar/modules/calUtils.jsm");
-
-/**
- * Global Object to hold methods for the timezones dialog.
- */
-var gTimezonesPane = {
-    /**
-     * Initialize the timezones pref pane. Sets up dialog controls to match the
-     * values set in prefs.
-     */
-    init: function gTP_init() {
-        var tzMenuList = document.getElementById("calendar-timezone-menulist");
-        var tzMenuPopup = document.getElementById("calendar-timezone-menupopup");
-
-        var tzService = cal.getTimezoneService();
-        var enumerator = tzService.timezoneIds;
-        var tzids = {};
-        var displayNames = [];
-        // don't rely on what order the timezone-service gives you
-        while (enumerator.hasMore()) {
-            var tz = tzService.getTimezone(enumerator.getNext());
-            if (tz && !tz.isFloating && !tz.isUTC) {
-                var displayName = tz.displayName;
-                displayNames.push(displayName);
-                tzids[displayName] = tz.tzid;
-            }
-        }
-        // the display names need to be sorted
-        displayNames.sort(String.localeCompare);
-        for (var i = 0; i < displayNames.length; ++i) {
-            var displayName = displayNames[i];
-            addMenuItem(tzMenuPopup, displayName, tzids[displayName]);
-        }
-
-        var prefValue = document.getElementById("calendar-timezone-local").value;
-        if (!prefValue) {
-            prefValue = calendarDefaultTimezone().tzid;
-        }
-        tzMenuList.value = prefValue;
-    }
-};
deleted file mode 100644
--- a/calendar/base/content/preferences/timezones.xul
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
-   - License, v. 2.0. If a copy of the MPL was not distributed with this
-   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-<!DOCTYPE overlay SYSTEM "chrome://calendar/locale/preferences/timezones.dtd">
-
-<overlay id="TimezonesPaneOverlay"
-         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
-    <vbox id="calPreferencesBoxTimezones">
-        <script type="application/javascript"
-                src="chrome://calendar/content/preferences/timezones.js"/>
-        <script type="application/javascript"
-                src="chrome://calendar/content/calendar-ui-utils.js"/>
-        <script type="application/javascript"
-                src="chrome://calendar/content/calUtils.js"/>
-
-        <preferences>
-            <preference id="calendar-timezone-local"
-                        name="calendar.timezone.local"
-                        type="string"/>
-        </preferences>
-
-        <groupbox>
-            <caption label="&pref.calendar.timezones.list.caption;"/>
-
-            <menulist id="calendar-timezone-menulist"
-                      preference="calendar-timezone-local">
-                <menupopup id="calendar-timezone-menupopup"/>
-            </menulist>
-        </groupbox>
-
-    </vbox>
-</overlay>
--- a/calendar/base/jar.mn
+++ b/calendar/base/jar.mn
@@ -86,18 +86,16 @@ calendar.jar:
     content/calendar/preferences/alarms.xul                (content/preferences/alarms.xul)
     content/calendar/preferences/alarms.js                 (content/preferences/alarms.js)
     content/calendar/preferences/categories.xul            (content/preferences/categories.xul)
     content/calendar/preferences/categories.js             (content/preferences/categories.js)
     content/calendar/preferences/editCategory.xul          (content/preferences/editCategory.xul)
     content/calendar/preferences/editCategory.js           (content/preferences/editCategory.js)
     content/calendar/preferences/general.js                (content/preferences/general.js)
 *   content/calendar/preferences/general.xul               (content/preferences/general.xul)
-    content/calendar/preferences/timezones.js              (content/preferences/timezones.js)
-    content/calendar/preferences/timezones.xul             (content/preferences/timezones.xul)
     content/calendar/preferences/views.js                  (content/preferences/views.js)
     content/calendar/preferences/views.xul                 (content/preferences/views.xul)
     content/calendar/widgets/minimonth.xml                 (content/widgets/minimonth.xml)
     content/calendar/widgets/calendar-alarm-widget.xml     (content/widgets/calendar-alarm-widget.xml)
     content/calendar/widgets/calendar-widgets.xml          (content/widgets/calendar-widgets.xml)
     content/calendar/widgets/calendar-list-tree.xml        (content/widgets/calendar-list-tree.xml)
     content/calendar/calendar-subscriptions-list.xml       (content/widgets/calendar-subscriptions-list.xml)
     content/calendar/widgets/calendar-widget-bindings.css  (content/widgets/calendar-widget-bindings.css)
--- a/calendar/lightning/content/messenger-overlay-preferences.xul
+++ b/calendar/lightning/content/messenger-overlay-preferences.xul
@@ -11,57 +11,52 @@
     %preferencesDTD;
 ]>
 
 <?xml-stylesheet href="chrome://lightning/skin/lightning.css"?>
 
 <overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
     <prefwindow id="MailPreferences">
-        <prefpane id="paneLightning" 
+        <prefpane id="paneLightning"
                   label="&lightning.preferencesLabel;"
-                  onpaneload="gCalendarGeneralPane.init(); gAlarmsPane.init(); 
+                  onpaneload="gCalendarGeneralPane.init(); gAlarmsPane.init();
                               gCategoriesPane.init(); gViewsPane.init();
-                              gTimezonesPane.init(); gLightningPane.init();">
+                              gLightningPane.init();">
             <preferences>
                 <preference id="calendar.preferences.lightning.selectedTabIndex"
                             name="calendar.preferences.lightning.selectedTabIndex"
                             type="int"/>
             </preferences>
-            <tabbox id="calPreferencesTabbox" 
-                    flex="1" 
+            <tabbox id="calPreferencesTabbox"
+                    flex="1"
                     onselect="gLightningPane.tabSelectionChanged();">
                 <tabs>
                     <tab id="calPreferencesTabGeneral"
                          label="&paneGeneral.title;"/>
                     <tab id="calPreferencesTabAlarms"
                          label="&paneAlarms.title;"/>
                     <tab id="calPreferencesTabCategories"
                          label="&paneCategories.title;"/>
                     <tab id="calPreferencesTabViews"
                          label="&paneViews.title;"/>
-                    <tab id="calPreferencesTabTimezones"
-                         label="&paneTimezones.title;"/>
                 </tabs>
                 <tabpanels flex="1">
                     <tabpanel orient="vertical">
                         <vbox id="calPreferencesBoxGeneral"/>
                     </tabpanel>
                     <tabpanel orient="vertical">
                         <vbox id="calPreferencesBoxAlarms"/>
                     </tabpanel>
                     <tabpanel orient="vertical">
                         <vbox id="calPreferencesBoxCategories"/>
                     </tabpanel>
                     <tabpanel orient="vertical">
                         <vbox id="calPreferencesBoxViews"/>
                     </tabpanel>
-                    <tabpanel orient="vertical">
-                        <vbox id="calPreferencesBoxTimezones"/>
-                    </tabpanel>
                 </tabpanels>
             </tabbox>
         </prefpane>
 
         <script type="application/javascript"
                 src="chrome://calendar/content/calUtils.js"/>
         <script type="application/javascript"
                 src="chrome://lightning/content/messenger-overlay-preferences.js"/>
--- a/calendar/lightning/content/suite-overlay-preferences.xul
+++ b/calendar/lightning/content/suite-overlay-preferences.xul
@@ -2,17 +2,16 @@
 
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <?xml-stylesheet href="chrome://lightning/skin/lightning.css"?>
 
 <?xul-overlay href="chrome://calendar/content/preferences/general.xul"?>
-<?xul-overlay href="chrome://calendar/content/preferences/timezones.xul"?>
 <?xul-overlay href="chrome://calendar/content/preferences/alarms.xul"?>
 <?xul-overlay href="chrome://calendar/content/preferences/categories.xul"?>
 <?xul-overlay href="chrome://calendar/content/preferences/views.xul"?>
 
 <!DOCTYPE overlay [
     <!ENTITY % lightningDTD SYSTEM "chrome://lightning/locale/lightning.dtd">
     %lightningDTD;
     <!ENTITY % preferencesDTD SYSTEM "chrome://calendar/locale/preferences/preferences.dtd">
@@ -39,19 +38,18 @@
                           prefpane="paneLightningViews"/>
             </treechildren>
         </treeitem>
     </treechildren>
 
     <prefwindow id="prefDialog">
         <prefpane id="paneLightning"
                   label="&lightning.preferencesLabel;"
-                  onpaneload="gCalendarGeneralPane.init(); gTimezonesPane.init();">
+                  onpaneload="gCalendarGeneralPane.init();">
             <vbox id="calPreferencesBoxGeneral"/>
-            <vbox id="calPreferencesBoxTimezones"/>
         </prefpane>
         <prefpane id="paneLightningAlarms"
                   label="&paneAlarms.title;"
                   onpaneload="gAlarmsPane.init();">
             <vbox id="calPreferencesBoxAlarms"/>
         </prefpane>
         <prefpane id="paneLightningCategories"
                   label="&paneCategories.title;"
--- a/calendar/lightning/jar.mn
+++ b/calendar/lightning/jar.mn
@@ -14,17 +14,16 @@ lightning.jar:
 % overlay chrome://lightning/content/messenger-overlay-sidebar.xul chrome://lightning/content/imip-bar-overlay.xul
 % overlay chrome://communicator/content/pref/preferences.xul chrome://lightning/content/suite-overlay-preferences.xul application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}
 % overlay about:addons chrome://lightning/content/suite-overlay-addons.xul application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}
 % overlay chrome://mozapps/content/extensions/extensions.xul chrome://lightning/content/suite-overlay-addons.xul application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}
 % overlay chrome://messenger/content/preferences/preferences.xul chrome://lightning/content/messenger-overlay-preferences.xul
 % overlay chrome://messenger/content/preferences/preferences.xul chrome://calendar/content/preferences/alarms.xul
 % overlay chrome://messenger/content/preferences/preferences.xul chrome://calendar/content/preferences/categories.xul
 % overlay chrome://messenger/content/preferences/preferences.xul chrome://calendar/content/preferences/general.xul
-% overlay chrome://messenger/content/preferences/preferences.xul chrome://calendar/content/preferences/timezones.xul
 % overlay chrome://messenger/content/preferences/preferences.xul chrome://calendar/content/preferences/views.xul
 % overlay chrome://lightning/content/messenger-overlay-sidebar.xul chrome://calendar/content/calendar-unifinder.xul
 % overlay chrome://lightning/content/messenger-overlay-sidebar.xul chrome://calendar/content/calendar-unifinder-todo.xul
 % overlay chrome://lightning/content/messenger-overlay-sidebar.xul chrome://calendar/content/calendar-task-view.xul
 % overlay chrome://lightning/content/messenger-overlay-sidebar.xul chrome://calendar/content/today-pane.xul
 % overlay chrome://lightning/content/messenger-overlay-sidebar.xul chrome://lightning/content/suite-overlay-sidebar.xul application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}
 % overlay chrome://lightning/content/lightning-standalone.xul chrome://lightning/content/messenger-overlay-sidebar.xul
 % overlay chrome://calendar/content/calendarCreation.xul chrome://lightning/content/lightning-calendar-creation.xul
--- a/calendar/locales/en-US/chrome/calendar/preferences/general.dtd
+++ b/calendar/locales/en-US/chrome/calendar/preferences/general.dtd
@@ -8,16 +8,20 @@
   -->
 
 <!ENTITY pref.mainbox.label "General Settings" >
 <!ENTITY pref.dateformat.label "Date Text Format:" >
 <!ENTITY pref.dateformat.accesskey "D">
 <!ENTITY pref.dateformat.long "Long" >
 <!ENTITY pref.dateformat.short "Short"  >
 
+<!ENTITY pref.timezones.caption "Timezone">
+<!ENTITY pref.timezones.label "Select the closest city in your timezone:">
+<!ENTITY pref.timezones.accesskey "S">
+
 <!ENTITY pref.defaults.label "Default Values for New Items">
 <!ENTITY pref.events.label "Events">
 <!ENTITY pref.tasks.label "Tasks">
 
 <!ENTITY pref.default_event_length.label "Default Length:" >
 <!ENTITY pref.default_event_length.accesskey "E">
 
 <!ENTITY pref.default_task_none.label "None">
--- a/calendar/locales/en-US/chrome/calendar/preferences/preferences.dtd
+++ b/calendar/locales/en-US/chrome/calendar/preferences/preferences.dtd
@@ -1,9 +1,8 @@
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <!ENTITY  paneGeneral.title       "General">
 <!ENTITY  paneAlarms.title        "Reminders">
 <!ENTITY  paneCategories.title    "Categories">
 <!ENTITY  paneViews.title         "Views">
-<!ENTITY  paneTimezones.title     "Timezone">
deleted file mode 100644
--- a/calendar/locales/en-US/chrome/calendar/preferences/timezones.dtd
+++ /dev/null
@@ -1,5 +0,0 @@
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
-   - License, v. 2.0. If a copy of the MPL was not distributed with this
-   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-<!ENTITY pref.calendar.timezones.list.caption "Select the closest city in your timezone:">
--- a/calendar/locales/jar.mn
+++ b/calendar/locales/jar.mn
@@ -25,13 +25,12 @@ calendar-@AB_CD@.jar:
     locale/@AB_CD@/calendar/migration.properties           (%chrome/calendar/migration.properties)
     locale/@AB_CD@/calendar/provider-uninstall.dtd         (%chrome/calendar/provider-uninstall.dtd)
     locale/@AB_CD@/calendar/timezones.properties           (%chrome/calendar/timezones.properties)
     locale/@AB_CD@/calendar/wcap.properties                (%chrome/calendar/providers/wcap/wcap.properties)
     locale/@AB_CD@/calendar/preferences/alarms.dtd         (%chrome/calendar/preferences/alarms.dtd)
     locale/@AB_CD@/calendar/preferences/categories.dtd     (%chrome/calendar/preferences/categories.dtd)
     locale/@AB_CD@/calendar/preferences/general.dtd        (%chrome/calendar/preferences/general.dtd)
     locale/@AB_CD@/calendar/preferences/preferences.dtd    (%chrome/calendar/preferences/preferences.dtd)
-    locale/@AB_CD@/calendar/preferences/timezones.dtd      (%chrome/calendar/preferences/timezones.dtd)
     locale/@AB_CD@/calendar/preferences/views.dtd          (%chrome/calendar/preferences/views.dtd)
     locale/@AB_CD@/calendar/dialogs/calendar-event-dialog-reminder.dtd  (%chrome/calendar/dialogs/calendar-event-dialog-reminder.dtd)
     locale/@AB_CD@/calendar/calendar-event-dialog-attendees.properties  (%chrome/calendar/calendar-event-dialog-attendees.properties)
     locale/@AB_CD@/calendar/calendar-extract.properties  (%chrome/calendar/calendar-extract.properties)