Bug 432675 - Move the timezone prefs to General. r=philipp, neil, a=Paenglab

This commit is contained in:
Richard Marti 2014-12-14 19:35:19 +01:00
Родитель 9bc102d79b
Коммит 4b598314a3
13 изменённых файлов: 76 добавлений и 111 удалений

Просмотреть файл

@ -4,6 +4,8 @@
* 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
*/
@ -29,6 +31,33 @@ var gCalendarGeneralPane = {
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 tzids = {};
let displayNames = [];
// don't rely on what order the timezone-service gives you
for (let tzid in fixIterator(tzService.timezoneIds)) {
let tz = tzService.getTimezone(tzid);
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() {
@ -51,4 +80,3 @@ var gCalendarGeneralPane = {
document.getElementById("defaults-itemtype-deck").selectedPanel = panel;
}
};

Просмотреть файл

@ -18,8 +18,12 @@
<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">
@ -34,6 +38,9 @@
<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"/>
@ -77,17 +84,19 @@
</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;"/>
@ -241,5 +250,17 @@
</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>

Просмотреть файл

@ -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;
}
};

Просмотреть файл

@ -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>

Просмотреть файл

@ -91,8 +91,6 @@ calendar.jar:
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)

Просмотреть файл

@ -16,18 +16,18 @@
<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"
@ -38,8 +38,6 @@
label="&paneCategories.title;"/>
<tab id="calPreferencesTabViews"
label="&paneViews.title;"/>
<tab id="calPreferencesTabTimezones"
label="&paneTimezones.title;"/>
</tabs>
<tabpanels flex="1">
<tabpanel orient="vertical">
@ -54,9 +52,6 @@
<tabpanel orient="vertical">
<vbox id="calPreferencesBoxViews"/>
</tabpanel>
<tabpanel orient="vertical">
<vbox id="calPreferencesBoxTimezones"/>
</tabpanel>
</tabpanels>
</tabbox>
</prefpane>

Просмотреть файл

@ -7,7 +7,6 @@
<?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"?>
@ -44,9 +43,8 @@
<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;"

Просмотреть файл

@ -19,7 +19,6 @@ lightning.jar:
% 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

Просмотреть файл

@ -13,6 +13,10 @@
<!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">

Просмотреть файл

@ -6,4 +6,3 @@
<!ENTITY paneAlarms.title "Reminders">
<!ENTITY paneCategories.title "Categories">
<!ENTITY paneViews.title "Views">
<!ENTITY paneTimezones.title "Timezone">

Просмотреть файл

@ -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:">

Просмотреть файл

@ -30,7 +30,6 @@ calendar-@AB_CD@.jar:
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)

Просмотреть файл

@ -109,6 +109,15 @@ function fixIterator(aEnum, aIface) {
return { __iterator__: iter };
}
// How about nsIStringEnumerator or nsIUTF8StringEnumerator?
if (aEnum instanceof Ci.nsIStringEnumerator || aEnum instanceof Ci.nsIUTF8StringEnumerator) {
let iter = function() {
while (aEnum.hasMore())
yield aEnum.getNext();
};
return { __iterator__: iter };
}
// How about nsISimpleEnumerator? This one is nice and simple.
if (aEnum instanceof Ci.nsISimpleEnumerator) {
let iter = function () {