Moving default values for prefs to properties file.

This commit is contained in:
mikep%oeone.com 2003-01-09 21:55:34 +00:00
Родитель b6ceb73089
Коммит bdb922400d
13 изменённых файлов: 56 добавлений и 19 удалений

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

@ -78,7 +78,7 @@ h1 {
<td id="mozver">
<h1>
<a id="mozlink" href="http://www.mozilla.org/projects/calendar/" target="_new">Mozilla Calendar 2003010815-cal</a>
<a id="mozlink" href="http://www.mozilla.org/projects/calendar/" target="_new">Mozilla Calendar 2003010911-cal</a>
</h1>
<script type="application/x-javascript">
// using try..catch to handle empty useragents and other cases where the regex fails to apply

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

@ -149,7 +149,9 @@ function createAlarmBox( Event )
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
OuterBox.getElementsByAttribute( "name", "alarm-length-field" )[0].value = getIntPref(prefService.getBranch("calendar."), "event.defaultsnoozelength", 60 );
var categoriesStringBundle = srGetStrBundle("chrome://calendar/locale/calendar.properties");
OuterBox.getElementsByAttribute( "name", "alarm-length-field" )[0].value = getIntPref(prefService.getBranch("calendar."), "alarms.defaultsnoozelength", categoriesStringBundle.GetStringFromName("defaultSnoozeAlarmLength" ) );
kungFooDeathGripOnEventBoxes.push( OuterBox.getElementsByAttribute( "name", "SnoozeButton" )[0] );

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

@ -557,7 +557,9 @@ function newEvent( startDate, endDate )
if( !endDate )
{
var MinutesToAddOn = getIntPref(gCalendarWindow.calendarPreferences.calendarPref, "event.defaultlength", 60 );
var categoriesStringBundle = srGetStrBundle("chrome://calendar/locale/calendar.properties");
var MinutesToAddOn = getIntPref(gCalendarWindow.calendarPreferences.calendarPref, "event.defaultlength", categoriesStringBundle.GetStringFromName("defaultEventLength" ) );
var endDateTime = startDate.getTime() + ( 1000 * 60 * MinutesToAddOn );

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

@ -647,7 +647,9 @@ CalendarAlarmObserver.prototype.fireAlarm = function calAlarm_fireAlarm( calenda
return;
}
if( getBoolPref(gCalendarWindow.calendarPreferences.calendarPref, "alarms.playsound", false ) )
var categoriesStringBundle = srGetStrBundle("chrome://calendar/locale/calendar.properties");
if( getBoolPref(gCalendarWindow.calendarPreferences.calendarPref, "alarms.playsound", categoriesStringBundle.GetStringFromName("playAlarmSound" ) ) )
{
playSound();
}

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

@ -115,7 +115,9 @@ function calendarManager( CalendarWindow )
/* Refresh remote calendars */
var RefreshServers = getBoolPref(this.CalendarWindow.calendarPreferences.calendarPref, "servers.reloadonlaunch", false );
var categoriesStringBundle = srGetStrBundle("chrome://calendar/locale/calendar.properties");
var RefreshServers = getBoolPref(this.CalendarWindow.calendarPreferences.calendarPref, "servers.reloadonlaunch", categoriesStringBundle.GetStringFromName("reloadServersOnLaunch" ) );
if( RefreshServers == true )
this.refreshAllRemoteCalendars( );

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

@ -109,7 +109,9 @@ function addEventToDialog( Event )
{
gAllowWindowOpen = false;
if( getBoolPref(gCalendarWindow.calendarPreferences.calendarPref, "alarms.show", true ) )
var categoriesStringBundle = srGetStrBundle("chrome://calendar/locale/calendar.properties");
if( getBoolPref(gCalendarWindow.calendarPreferences.calendarPref, "alarms.show", categoriesStringBundle.GetStringFromName("showAlarms" ) ) )
{
calendarAlarmWindow = openCalendarAlarmWindow( Event );
}

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

@ -244,7 +244,9 @@ function pasteFromClipboard()
//change the date of all the events to now
startDate = gCalendarWindow.currentView.getNewEventDate();
MinutesToAddOn = getIntPref(gCalendarWindow.calendarPreferences.calendarPref, "event.defaultlength", 60 );
var categoriesStringBundle = srGetStrBundle("chrome://calendar/locale/calendar.properties");
MinutesToAddOn = getIntPref(gCalendarWindow.calendarPreferences.calendarPref, "event.defaultlength", categoriesStringBundle.GetStringFromName("defaultEventLength" ) );
endDateTime = startDate.getTime() + ( 1000 * 60 * MinutesToAddOn );

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

@ -156,7 +156,7 @@ DayView.prototype.refreshEvents = function dayview_refreshEvents( )
//refresh the array and the current spot.
var LowestStartHour = getIntPref( this.calendarWindow.calendarPreferences.calendarPref, "event.defaultstarthour", 8 );
var HighestEndHour = getIntPref( this.calendarWindow.calendarPreferences.calendarPref, "event.defaultendhour", 17 );;
var HighestEndHour = getIntPref( this.calendarWindow.calendarPreferences.calendarPref, "event.defaultendhour", 17 );
for ( var i = 0; i < dayEventList.length; i++ )
{
dayEventList[i].OtherSpotArray = new Array('0');

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

@ -209,7 +209,7 @@
<label for="uri-field" value="&newevent.uri.label;"/>
</hbox>
<hbox>
<textbox id="uri-field" flex="1"/>
<textbox id="uri-field" type="autocomplete" searchSessions="history" timeout="50" flex="1"/>
<button label="&newevent.uri.visit.label;" oncommand="launchBrowser()"/>
</hbox>
</row>

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

@ -94,7 +94,7 @@
<menulist id="dateformat" crop="none" prefstring="calendar.date.format">
<menupopup id="dateformat">
<menuitem id="dateformat-long-menuitem" label="&pref.dateformat.long;" value="0"/>
<menuitem id="dateformat-short-menuitem" label="&pref.dateformat.short;" value="1"/>
<menuitem id="dateformat-short-menuitem" label="&pref.dateformat.short;" value="1" selected="true"/>
</menupopup>
</menulist>
</hbox>
@ -109,17 +109,17 @@
<menuitem label="&pref.weekstarts.wednesday;" value="3"/>
<menuitem label="&pref.weekstarts.thursday;" value="4"/>
<menuitem label="&pref.weekstarts.friday;" value="5"/>
<menuitem label="&pref.weekstarts.saturday;" value="6"/>
<menuitem label="&pref.weekstarts.saturday;" value="6" selected="true"/>
</menupopup>
</menulist>
</hbox>
<hbox align="center">
<description>Unless there are events, restrict day view to </description>
<textbox id="daystarthour" preftype="int" prefstring="calendar.event.defaultstarthour" maxlength="2" size="2"/>
<description>:00 AM and </description>
<textbox id="dayendhour" preftype="int" prefstring="calendar.event.defaultendhour" maxlength="2" size="2"/>
<description>:00 PM ( 0 - 24 ) </description>
<textbox id="daystarthour" preftype="int" prefstring="calendar.event.defaultstarthour" maxlength="2" size="2" value="8"/>
<description>:00 and </description>
<textbox id="dayendhour" preftype="int" prefstring="calendar.event.defaultendhour" maxlength="2" size="2" value="17"/>
<description>:00 ( 0 - 24 ) </description>
</hbox>
<hbox align="center">

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

@ -90,9 +90,18 @@ function calendarPreferences( CalendarWindow )
this.calendarPref = prefService.getBranch("calendar."); // preferences calendar node
var categoriesStringBundle = 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.playsound", categoriesStringBundle.GetStringFromName("playAlarmSound" ) );
getCharPref( this.calendarPref, "categories.names", getDefaultCategories() );
getIntPref( this.calendarPref, "event.defaultlength", 60 );
getIntPref( this.calendarPref, "event.defaultsnoozelength", 60 );
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" ) );
}

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

@ -525,8 +525,11 @@ WeekView.prototype.switchTo = function( )
WeekView.prototype.refreshDisplay = function( )
{
var categoriesStringBundle = srGetStrBundle("chrome://calendar/locale/calendar.properties");
var defaultWeekStart = categoriesStringBundle.GetStringFromName("defaultWeekStart" );
// Set the from-to title string, based on the selected date
var Offset = getIntPref(this.calendarWindow.calendarPreferences.calendarPref, "week.start", 0 );
var Offset = getIntPref(this.calendarWindow.calendarPreferences.calendarPref, "week.start", defaultWeekStart );
var viewDay = this.calendarWindow.getSelectedDate().getDay();
var viewDayOfMonth = this.calendarWindow.getSelectedDate().getDate();

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

@ -67,6 +67,19 @@ deleteCalendarMessage=Are you sure you want to delete this calendar?
deleteCalendarOnly=Delete Calendar
deleteCalendarAndFile=Delete Calendar And File
#
# P R E F S
# Default values for preferences
#
#the default day to start the week on
#0=Sunday 1=Monday 2=Tuesday 3=Wednesdsay 4=Thursday 5=Friday 6=Saturday
defaultWeekStart=0
defaultWeekStart=0
showAlarms=true
playAlarmSound=false
reloadServersOnLaunch=false
defaultEventLength=60
defaultSnoozeAlarmLength=60
dateFormat=0
defaultStartHour=8
defaultEndHour=17