Checked in final changes needed to fix bug 155882 : Tasks (ToDo) need an Alarm (just like Events)

This commit is contained in:
mostafah%oeone.com 2003-09-25 18:59:21 +00:00
Родитель 4446ed912b
Коммит 6a8364bbdc
8 изменённых файлов: 157 добавлений и 38 удалений

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

@ -86,7 +86,7 @@ var gOnOkFunction; // function to be called when user clicks OK
var gTimeDifference = 3600000; //when editing an event, we change the end time if the start time is changing. This is the difference for the event time.
var gDateDifference = 3600000; //this is the difference for the dates, not the times.
var gDefaultAlarmLength = 15; //number of minutes to default the alarm to
const DEFAULT_ALARM_LENGTH = 15; //default number of time units, an alarm goes off before an event
var gMode = ''; //what mode are we in? new or edit...
@ -200,13 +200,11 @@ function loadCalendarEventDialog()
setFieldValue( "private-checkbox", gEvent.privateEvent, "checked" );
if( gEvent.alarm === false && gEvent.alarmLength == 0 )
{
gEvent.alarmLength = gDefaultAlarmLength;
if( "new" == args.mode ) {
gEvent.alarm = opener.getIntPref( opener.gCalendarWindow.calendarPreferences.calendarPref, "alarms.onforevents", 0 );
gEvent.alarmLength = opener.getIntPref( opener.gCalendarWindow.calendarPreferences.calendarPref, "alarms.eventalarmlen", DEFAULT_ALARM_LENGTH );
gEvent.alarmUnits = opener.getCharPref( opener.gCalendarWindow.calendarPreferences.calendarPref, "alarms.eventalarmunit", "minutes" );
}
if( "new" == args.mode )
gEvent.alarm = opener.getIntPref( opener.gCalendarWindow.calendarPreferences.calendarPref, "alarms.onforevents", 0 );
setFieldValue( "alarm-checkbox", gEvent.alarm, "checked" );
setFieldValue( "alarm-length-field", gEvent.alarmLength );
@ -796,7 +794,6 @@ function commandAllDay()
function commandAlarm()
{
document.getElementById( "alarm-email-checkbox" ).removeAttribute( "checked" );
updateAlarmItemEnabled();
}
@ -816,14 +813,15 @@ function updateAlarmItemEnabled()
var alarmEmailCheckbox = "alarm-email-checkbox";
var alarmEmailField = "alarm-email-field";
if( getFieldValue(alarmCheckBox, "checked" ) || getFieldValue( alarmEmailCheckbox, "checked" ) )
// if( getFieldValue(alarmCheckBox, "checked" ) || getFieldValue( alarmEmailCheckbox, "checked" ) )
if( getFieldValue(alarmCheckBox, "checked" ) )
{
// call remove attribute beacuse some widget code checks for the presense of a
// disabled attribute, not the value.
setFieldValue( alarmCheckBox, true, "checked" );
setFieldValue( alarmField, false, "disabled" );
setFieldValue( alarmMenu, false, "disabled" );
setFieldValue( alarmTrigger, false, "disabled" );
setFieldValue( alarmEmailField, false, "disabled" );
setFieldValue( alarmEmailCheckbox, false, "disabled" );
}
else
@ -833,7 +831,6 @@ function updateAlarmItemEnabled()
setFieldValue( alarmTrigger, true, "disabled" );
setFieldValue( alarmEmailField, true, "disabled" );
setFieldValue( alarmEmailCheckbox, true, "disabled" );
setFieldValue( alarmEmailCheckbox, false, "checked" );
}
}

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

@ -0,0 +1,93 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is OEone Calendar Code, released October 31st, 2001.
*
* The Initial Developer of the Original Code is
* OEone Corporation.
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Mostafa Hosseini <mostafah@oeone.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
function initAlarmPrefs()
{
updateMenuPlural( 'eventdefalarmlen', 'eventdefalarmunit' );
updateMenuPlural( 'tododefalarmlen', 'tododefalarmunit' );
}
function updateMenuPlural( lengthFieldId, menuId )
{
var field = document.getElementById( lengthFieldId );
var menu = document.getElementById( menuId );
// figure out whether we should use singular or plural
var length = field.value;
var newLabelNumber;
if( Number( length ) > 1 )
{
newLabelNumber = "labelplural"
}
else
{
newLabelNumber = "labelsingular"
}
// see what we currently show and change it if required
var oldLabelNumber = menu.getAttribute( "labelnumber" );
if( newLabelNumber != oldLabelNumber )
{
// remember what we are showing now
menu.setAttribute( "labelnumber", newLabelNumber );
// update the menu items
var items = menu.getElementsByTagName( "menuitem" );
for( var i = 0; i < items.length; ++i )
{
var menuItem = items[i];
var newLabel = menuItem.getAttribute( newLabelNumber );
menuItem.label = newLabel;
menuItem.setAttribute( "label", newLabel );
}
// force the menu selection to redraw
var saveSelectedIndex = menu.selectedIndex;
menu.selectedIndex = -1;
menu.selectedIndex = saveSelectedIndex;
}
}

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

@ -42,18 +42,21 @@
<!DOCTYPE page
[
<!ENTITY % dtd1 SYSTEM "chrome://calendar/locale/prefs.dtd" > %dtd1;
<!ENTITY % dtd2 SYSTEM "chrome://calendar/locale/calendar.dtd" > %dtd2;
]>
<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="parent.initPanel('chrome://calendar/content/pref/alarmPrefs.xul');"
onload="parent.initPanel('chrome://calendar/content/pref/alarmPrefs.xul');initAlarmPrefs();"
headertitle="&calendarPanel.label;">
<script type="application/x-javascript" src="chrome://calendar/content/pref/alarmPrefs.js"/>
<script type="application/x-javascript" src="chrome://calendar/content/dateUtils.js"/>
<script type="application/x-javascript" src="chrome://global/content/strres.js"/>
<script type="application/x-javascript">
var _elementIDs = [
"alarmplaysound", "alarmshow", "missedalarms", "alarmemailaddress", "eventdefalarm", "tododefalarm"
"alarmplaysound", "alarmshow", "missedalarms", "alarmemailaddress", "eventdefalarm", "tododefalarm",
"eventdefalarmunit", "tododefalarmunit", "eventdefalarmlen", "tododefalarmlen"
];
</script>
@ -85,6 +88,28 @@
</menupopup>
</menulist>
</hbox>
<hbox>
<description>&pref.defalarmlen4events.label;</description>
<textbox id="eventdefalarmlen" preftype="int" prefstring="calendar.alarms.eventalarmlen" flex="1" oninput="updateMenuPlural( 'eventdefalarmlen', 'eventdefalarmunit' )"/>
<menulist id="eventdefalarmunit" crop="none" preftype="string" prefstring="calendar.alarms.eventalarmunit" labelnumber="labelplural">
<menupopup id="eventdefalarmunit">
<menuitem id="eventdefalarmunitday" label="&alarm.units.minutes;" labelplural="&alarm.units.minutes;" labelsingular="&alarm.units.minutes.singular;" value="minutes" selected="true"/>
<menuitem id="eventdefalarmunitmin" label="&alarm.units.hours;" labelplural="&alarm.units.hours;" labelsingular="&alarm.units.hours.singular;" value="hours"/>
<menuitem id="eventdefalarmunitmin" label="&alarm.units.days;" labelplural="&alarm.units.days;" labelsingular="&alarm.units.days.singular;" value="days"/>
</menupopup>
</menulist>
</hbox>
<hbox>
<description>&pref.defalarmlen4todos.label;</description>
<textbox id="tododefalarmlen" preftype="int" prefstring="calendar.alarms.todoalarmlen" flex="1" oninput="updateMenuPlural( 'tododefalarmlen', 'tododefalarmunit' )"/>
<menulist id="tododefalarmunit" crop="none" preftype="string" prefstring="calendar.alarms.todoalarmunit" labelnumber="labelplural">
<menupopup id="tododefalarmunit">
<menuitem id="tododefalarmunitday" label="&alarm.units.minutes;" labelplural="&alarm.units.minutes;" labelsingular="&alarm.units.minutes.singular;" value="minutes" selected="true"/>
<menuitem id="tododefalarmunitmin" label="&alarm.units.hours;" labelplural="&alarm.units.hours;" labelsingular="&alarm.units.hours.singular;" value="hours"/>
<menuitem id="tododefalarmunitmin" label="&alarm.units.days;" labelplural="&alarm.units.days;" labelsingular="&alarm.units.days.singular;" value="days"/>
</menupopup>
</menulist>
</hbox>
<hbox>
<description>&pref.defaultemail.label;</description>
<textbox id="alarmemailaddress" prefstring="calendar.alarms.emailaddress" flex="1"/>

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

@ -103,24 +103,26 @@ function calendarPreferences( CalendarWindow )
this.calendarPref = prefService.getBranch("calendar."); // preferences calendar node
var categoriesStringBundle = srGetStrBundle("chrome://calendar/locale/calendar.properties");
var calendarStringBundle = srGetStrBundle("chrome://calendar/locale/calendar.properties");
//go through all the preferences and set default values?
getBoolPref( this.calendarPref, "servers.reloadonlaunch", categoriesStringBundle.GetStringFromName("reloadServersOnLaunch" ) );
getBoolPref( this.calendarPref, "alarms.show", categoriesStringBundle.GetStringFromName("showAlarms" ) );
getBoolPref( this.calendarPref, "alarms.showmissed", categoriesStringBundle.GetStringFromName("showMissed" ) );
getBoolPref( this.calendarPref, "alarms.playsound", categoriesStringBundle.GetStringFromName("playAlarmSound" ) );
getBoolPref( this.calendarPref, "servers.reloadonlaunch", calendarStringBundle.GetStringFromName("reloadServersOnLaunch" ) );
getBoolPref( this.calendarPref, "alarms.show", calendarStringBundle.GetStringFromName("showAlarms" ) );
getBoolPref( this.calendarPref, "alarms.showmissed", calendarStringBundle.GetStringFromName("showMissed" ) );
getBoolPref( this.calendarPref, "alarms.playsound", calendarStringBundle.GetStringFromName("playAlarmSound" ) );
GetUnicharPref( this.calendarPref, "categories.names", getDefaultCategories() );
getCharPref( this.calendarPref, "timezone.default", categoriesStringBundle.GetStringFromName("defaultzone"));
getIntPref( this.calendarPref, "event.defaultlength", categoriesStringBundle.GetStringFromName("defaultEventLength" ) );
getIntPref( this.calendarPref, "alarms.defaultsnoozelength", categoriesStringBundle.GetStringFromName("defaultSnoozeAlarmLength" ) );
getIntPref( this.calendarPref, "date.format", categoriesStringBundle.GetStringFromName("dateFormat" ) );
getIntPref( this.calendarPref, "event.defaultstarthour", categoriesStringBundle.GetStringFromName("defaultStartHour" ) );
getIntPref( this.calendarPref, "event.defaultendhour", categoriesStringBundle.GetStringFromName("defaultEndHour" ) );
getIntPref( this.calendarPref, "week.start", categoriesStringBundle.GetStringFromName("defaultWeekStart" ) );
getIntPref( this.calendarPref, "weeks.inview", categoriesStringBundle.GetStringFromName("defaultWeeksInView" ) );
getIntPref( this.calendarPref, "previousweeks.inview", categoriesStringBundle.GetStringFromName("defaultPreviousWeeksInView" ) );
getCharPref( this.calendarPref, "timezone.default", calendarStringBundle.GetStringFromName("defaultzone"));
getIntPref( this.calendarPref, "event.defaultlength", calendarStringBundle.GetStringFromName("defaultEventLength" ) );
getIntPref( this.calendarPref, "alarms.defaultsnoozelength", calendarStringBundle.GetStringFromName("defaultSnoozeAlarmLength" ) );
getIntPref( this.calendarPref, "date.format", calendarStringBundle.GetStringFromName("dateFormat" ) );
getIntPref( this.calendarPref, "event.defaultstarthour", calendarStringBundle.GetStringFromName("defaultStartHour" ) );
getIntPref( this.calendarPref, "event.defaultendhour", calendarStringBundle.GetStringFromName("defaultEndHour" ) );
getIntPref( this.calendarPref, "week.start", calendarStringBundle.GetStringFromName("defaultWeekStart" ) );
getIntPref( this.calendarPref, "weeks.inview", calendarStringBundle.GetStringFromName("defaultWeeksInView" ) );
getIntPref( this.calendarPref, "previousweeks.inview", calendarStringBundle.GetStringFromName("defaultPreviousWeeksInView" ) );
getIntPref( this.calendarPref, "alarms.onforevents", 0 );
getIntPref( this.calendarPref, "alarms.onfortodos", 0 );
getCharPref( this.calendarPref, "alarms.eventalarmunit", calendarStringBundle.GetStringFromName("defaulteventalarmunit"));
getCharPref( this.calendarPref, "alarms.todoalarmunit", calendarStringBundle.GetStringFromName("defaulttodoalarmunit"));
}

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

@ -86,7 +86,7 @@ var gOnOkFunction; // function to be called when user clicks OK
var gTimeDifference = 3600000; //when editing an event, we change the due time if the start time is changing. This is the difference for the event time.
var gDateDifference = 3600000; //this is the difference for the dates, not the times.
var gDefaultAlarmLength = 15; //number of minutes to default the alarm to
const DEFAULT_ALARM_LENGTH = 15; //default number of time units, an alarm goes off before an event
var gMode = ''; //what mode are we in? new or edit...
@ -192,13 +192,11 @@ function loadCalendarEventDialog()
setFieldValue( "private-checkbox", gEvent.privateEvent, "checked" );
if( gEvent.alarm === false && gEvent.alarmLength == 0 )
{
gEvent.alarmLength = gDefaultAlarmLength;
if( "new" == args.mode ) {
gEvent.alarm = opener.getIntPref( opener.gCalendarWindow.calendarPreferences.calendarPref, "alarms.onfortodos", 0 );
gEvent.alarmLength = opener.getIntPref( opener.gCalendarWindow.calendarPreferences.calendarPref, "alarms.todoalarmlen", DEFAULT_ALARM_LENGTH );
gEvent.alarmUnits = opener.getCharPref( opener.gCalendarWindow.calendarPreferences.calendarPref, "alarms.todoalarmunit", "minutes" );
}
if( "new" == args.mode )
gEvent.alarm = opener.getIntPref( opener.gCalendarWindow.calendarPreferences.calendarPref, "alarms.onfortodos", 0 );
setFieldValue( "alarm-checkbox", gEvent.alarm, "checked" );
setFieldValue( "alarm-length-field", gEvent.alarmLength );
@ -811,7 +809,6 @@ function commandUntil()
function commandAlarm()
{
document.getElementById( "alarm-email-checkbox" ).removeAttribute( "checked" );
updateAlarmItemEnabled();
}
@ -831,14 +828,15 @@ function updateAlarmItemEnabled()
var alarmEmailCheckbox = "alarm-email-checkbox";
var alarmEmailField = "alarm-email-field";
if( getFieldValue(alarmCheckBox, "checked" ) || getFieldValue( alarmEmailCheckbox, "checked" ) )
// if( getFieldValue(alarmCheckBox, "checked" ) || getFieldValue( alarmEmailCheckbox, "checked" ) )
if( getFieldValue(alarmCheckBox, "checked" ) )
{
// call remove attribute beacuse some widget code checks for the presense of a
// disabled attribute, not the value.
setFieldValue( alarmCheckBox, true, "checked" );
setFieldValue( alarmField, false, "disabled" );
setFieldValue( alarmMenu, false, "disabled" );
setFieldValue( alarmTrigger, false, "disabled" );
setFieldValue( alarmEmailField, false, "disabled" );
setFieldValue( alarmEmailCheckbox, false, "disabled" );
}
else
@ -848,7 +846,6 @@ function updateAlarmItemEnabled()
setFieldValue( alarmTrigger, true, "disabled" );
setFieldValue( alarmEmailField, true, "disabled" );
setFieldValue( alarmEmailCheckbox, true, "disabled" );
setFieldValue( alarmEmailCheckbox, false, "checked" );
}
}

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

@ -82,6 +82,7 @@ calendar.jar:
content/calendar/pref/calendarPref.xul (content/pref/calendarPref.xul)
content/calendar/pref/prefOverlay.xul (content/pref/prefOverlay.xul)
content/calendar/pref/publishPrefs.xul (content/pref/publishPrefs.xul)
content/calendar/pref/alarmPrefs.js (content/pref/alarmPrefs.js)
content/calendar/pref/rootCalendarPref.js (content/pref/rootCalendarPref.js)
content/calendar/pref/viewPrefs.xul (content/pref/viewPrefs.xul)
content/calendar/pref/timezonePrefs.xul (content/pref/timezonePrefs.xul)

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

@ -87,6 +87,8 @@ dateFormat=0
defaultStartHour=8
defaultEndHour=17
defaultzone=America/New_York
defaulteventalarmunit=minutes
defaulttodoalarmunit=minutes
Week=Week

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

@ -57,6 +57,8 @@
<!ENTITY pref.defalarm4todos.label "Default alarm setting for tasks:">
<!ENTITY pref.alarm.on "On">
<!ENTITY pref.alarm.off "Off">
<!ENTITY pref.defalarmlen4events.label "Default time an alarm goes off before an event:">
<!ENTITY pref.defalarmlen4todos.label "Default time an alarm goes off before a task:">
<!ENTITY pref.dateformat.label "Date Text Format:" >
<!ENTITY pref.dateformat.long "Long" >