<?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 [
    <!ENTITY % generalDTD SYSTEM "chrome://calendar/locale/preferences/general.dtd">
    <!ENTITY % globalDTD SYSTEM "chrome://calendar/locale/global.dtd">
    <!ENTITY % eventDTD SYSTEM "chrome://calendar/locale/calendar-event-dialog.dtd">
    %generalDTD;
    %globalDTD;
    %eventDTD;
]>

<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"
                        type="string"/>
            <preference id="calendar.task.defaultdue"
                        name="calendar.task.defaultdue"
                        type="string"/>
            <preference id="calendar.task.defaultdueoffset"
                        name="calendar.task.defaultdueoffset"
                        type="int"/>
            <preference id="calendar.task.defaultdueoffsetunits"
                        name="calendar.task.defaultdueoffsetunits"
                        type="string"/>
            <preference id="calendar.view.useSystemColors"
                        name="calendar.view.useSystemColors"
                        type="bool"/>
            <preference id="calendar.agendaListbox.soondays"
                        name="calendar.agendaListbox.soondays"
                        type="int"/>
        </preferences>

        <groupbox>
            <caption label="&pref.mainbox.label;"/>
            <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>
        </groupbox>

        <groupbox>
            <caption label="&pref.timezones.caption;"/>
            <hbox align="center">
                <label value="&pref.timezones.label;"
                       accesskey="&pref.timezones.accesskey;"
                       control="calendar-timezone-menulist"/>
                <menulist id="calendar-timezone-menulist"
                          preference="calendar-timezone-local">
                    <menupopup id="calendar-timezone-menupopup"/>
                </menulist>
            </hbox>
        </groupbox>

        <groupbox id="defaults-itemtype-groupbox">
            <caption id="defaults-itemtype-caption" label="&pref.defaults.label;"/>
            <hbox id="defaults-itemtype-box" align="top">
                <menulist id="defaults-itemtype-menulist"
                          flex="1"
                          oncommand="gCalendarGeneralPane.updateItemtypeDeck()">
                    <menupopup id="defaults-itemtype-menupopup">
                        <menuitem id="defaults-itemtype-event"
                                  label="&pref.events.label;"
                                  value="defaults-event-grid"/>
                        <menuitem id="defaults-itemtype-task"
                                  label="&pref.tasks.label;"
                                  value="defaults-task-grid"/>
                    </menupopup>
                </menulist>
                <spacer id="defaults-itemtype-spacer" flex="1"/>
                <deck id="defaults-itemtype-deck" flex="1">
                    <grid id="defaults-event-grid">
                        <columns id="defaults-event-grid-columns">
                            <column id="defaults-event-grid-column"/>
                        </columns>
                        <rows id="defaults-event-grid-rows">
                            <row id="defaults-event-grid-row" align="center">
                                <label id="default-event-length-label"
                                       value="&pref.default_event_length.label;"
                                       accesskey="&pref.default_event_length.accesskey;"
                                       control="defaultlength"/>
                                <textbox id="defaultlength"
                                         preference="calendar.event.defaultlength"
                                         type="number"
                                         min="0"
                                         maxlength="3"
                                         size="3"
                                         onselect="updateUnitLabelPlural('defaultlength','defaultlengthunit','minutes')"
                                         oninput="updateUnitLabelPlural('defaultlength','defaultlengthunit','minutes')"/>
                                <label id="defaultlengthunit"/>
                            </row>
                        </rows>
                    </grid>
                    <grid id="defaults-task-grid">
                        <columns id="defaults-task-grid-columns">
                            <column id="defaults-task-grid-label-column"/>
                            <column id="defaults-task-grid-value-column"/>
                            <column id="defaults-task-grid-offset-column"/>
                        </columns>
                        <rows id="defaults-task-grid-rows">
                            <row id="defaults-task-start-row" align="center">
                                <label id="default-task-start-label"
                                       value="&read.only.task.start.label;"
                                       control="default_task_start"/>
                                <menulist id="default_task_start"
                                          crop="none"
                                          oncommand="gCalendarGeneralPane.updateDefaultTodoDates()"
                                          preference="calendar.task.defaultstart">
                                    <menupopup id="default_task_start_popup">
                                        <menuitem id="default_task_start_none"
                                                  label="&pref.default_task_none.label;"
                                                  value="none"
                                                  selected="true"/>
                                        <menuitem id="default_task_start_start_of_day"
                                                  label="&pref.default_task_start_of_day.label;"
                                                  value="startofday"/>
                                        <menuitem id="default_task_start_tomorrow"
                                                  label="&pref.default_task_tomorrow.label;"
                                                  value="tomorrow"/>
                                        <menuitem id="default_task_start_next_week"
                                                  label="&pref.default_task_next_week.label;"
                                                  value="nextweek"/>
                                        <menuitem id="default_task_start_offset_current"
                                                  label="&pref.default_task_offset_current.label;"
                                                  value="offsetcurrent"/>
                                        <menuitem id="default_task_start_offset_next_hour"
                                                  label="&pref.default_task_offset_next_hour.label;"
                                                  value="offsetnexthour"/>
                                    </menupopup>
                                </menulist>
                                <hbox id="default_task_start_offset" align="center">
                                    <textbox id="default_task_start_offset_text"
                                             preference="calendar.task.defaultstartoffset"
                                             type="number"
                                             min="0"
                                             maxlength="3"
                                             size="3"
                                             onselect="updateMenuLabelsPlural('default_task_start_offset_text', 'default_task_start_offset_units')"
                                             oninput="updateMenuLabelsPlural('default_task_start_offset_text', 'default_task_start_offset_units')"/>
                                    <menulist id="default_task_start_offset_units"
                                              crop="none"
                                              preference="calendar.task.defaultstartoffsetunits">
                                        <menupopup id="default_task_start_offset_units_popup">
                                            <menuitem id="default_task_start_offset_units_minutes"
                                                      value="minutes"
                                                      selected="true"/>
                                            <menuitem id="default_task_start_offset_units_hours"
                                                      value="hours"/>
                                            <menuitem id="default_task_start_offset_units_days"
                                                      value="days"/>
                                        </menupopup>
                                    </menulist>
                                </hbox>
                            </row>
                            <row id="defaults-task-due-row" align="center">
                                <label id="default-task-due-label"
                                       value="&read.only.task.due.label;"
                                       control="default_task_due"/>
                                <menulist id="default_task_due"
                                          crop="none"
                                          oncommand="gCalendarGeneralPane.updateDefaultTodoDates()"
                                          preference="calendar.task.defaultdue">
                                    <menupopup id="default_task_due_popup">
                                        <menuitem id="default_task_due_none"
                                                  label="&pref.default_task_none.label;"
                                                  value="none"
                                                  selected="true"/>
                                        <menuitem id="default_task_due_end_of_day"
                                                  label="&pref.default_task_end_of_day.label;"
                                                  value="endofday"/>
                                        <menuitem id="default_task_due_tomorrow"
                                                  label="&pref.default_task_tomorrow.label;"
                                                  value="tomorrow"/>
                                        <menuitem id="default_task_due_next_week"
                                                  label="&pref.default_task_next_week.label;"
                                                  value="nextweek"/>
                                        <menuitem id="default_task_due_offset_current"
                                                  label="&pref.default_task_offset_start.label;"
                                                  value="offsetcurrent"/>
                                        <menuitem id="default_task_due_offset_next_hour"
                                                  label="&pref.default_task_offset_next_hour.label;"
                                                  value="offsetnexthour"/>
                                    </menupopup>
                                </menulist>
                                <hbox id="default_task_due_offset" align="center">
                                    <textbox id="default_task_due_offset_text"
                                             preference="calendar.task.defaultdueoffset"
                                             type="number"
                                             min="0"
                                             maxlength="3"
                                             size="3"
                                             onselect="updateMenuLabelsPlural('default_task_due_offset_text', 'default_task_due_offset_units')"
                                             oninput="updateMenuLabelsPlural('default_task_due_offset_text', 'default_task_due_offset_units')"/>
                                    <menulist id="default_task_due_offset_units"
                                              crop="none"
                                              preference="calendar.task.defaultdueoffsetunits">
                                        <menupopup id="default_task_due_offset_units_popup">
                                            <menuitem id="default_task_due_offset_units_minutes"
                                                      value="minutes"
                                                      selected="true"/>
                                            <menuitem id="default_task_due_offset_units_hours"
                                                      value="hours"/>
                                            <menuitem id="default_task_due_offset_units_days"
                                                      value="days"/>
                                        </menupopup>
                                    </menulist>
                                </hbox>
                            </row>
                        </rows>
                    </grid>
                </deck>
            </hbox>
        </groupbox>

        <groupbox>
            <caption label="&pref.calendar.todaypane.agenda.caption;"/>
            <hbox align="center">
                <label value="&pref.soondays.label;"
                       accesskey="&pref.soondays.accesskey;"
                       control="soondays-menulist"/>
                <menulist id="soondays-menulist"
                          preference="calendar.agendaListbox.soondays"
                          oncommand="gCalendarGeneralPane.updateTodaypaneMenu()">
                    <menupopup id="soondaysdurationpopup">
                        <menuitem value="1"/>
                        <menuitem value="2"/>
                        <menuitem value="3"/>
                        <menuitem value="4"/>
                        <menuitem value="5"/>
                        <menuitem value="6"/>
                        <menuitem value="7"/>
                        <menuitem value="14"/>
                        <menuitem value="21"/>
                        <menuitem value="28"/>
                    </menupopup>
                </menulist>
            </hbox>
        </groupbox>

    </vbox>
</overlay>
