diff --git a/mozilla/calendar/resources/content/calendarEventDialog.js b/mozilla/calendar/resources/content/calendarEventDialog.js index 4feb077ea12..0d6b1fcf993 100644 --- a/mozilla/calendar/resources/content/calendarEventDialog.js +++ b/mozilla/calendar/resources/content/calendarEventDialog.js @@ -22,6 +22,7 @@ * Mike Potter * Colin Phillips * Chris Charabaruk + * ArentJan Banck * * 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 @@ -220,6 +221,31 @@ function loadCalendarEventDialog() setFieldValue( "repeat-until-radio", (gEvent.recurForever == undefined || gEvent.recurForever == false), "selected" ); + + // Load categories + var categoriesString = opener.gCalendarWindow.calendarPreferences.getPref( "categories" ); + var categoriesList = categoriesString.split( "," ); + + // insert the category already in the task so it doesn't get lost + if( gEvent.categories ) + if( categoriesString.indexOf( gEvent.categories ) == -1 ) + categoriesList[categoriesList.length] = gEvent.categories; + + // categoriesList.sort(); + + var oldMenulist = document.getElementById( "categories-menulist-menupopup" ); + while( oldMenulist.hasChildNodes() ) + oldMenulist.removeChild( oldMenulist.lastChild ); + + for (var i = 0; i < categoriesList.length ; i++) + { + document.getElementById( "categories-field" ).appendItem(categoriesList[i], categoriesList[i]); + } + + document.getElementById( "categories-field" ).selectedIndex = -1; + setFieldValue( "categories-field", gEvent.categories ); + + // update enabling and disabling updateRepeatItemEnabled(); @@ -309,6 +335,9 @@ function onOKCommand() { gEvent.alarmEmailAddress = ""; } + + gEvent.categories = getFieldValue( "categories-field", "value" ); + gEvent.recur = getFieldValue( "repeat-checkbox", "checked" ); gEvent.recurUnits = getFieldValue( "repeat-length-units", "value" ); gEvent.recurForever = getFieldValue( "repeat-forever-radio", "selected" ); diff --git a/mozilla/calendar/resources/content/calendarEventDialog.xul b/mozilla/calendar/resources/content/calendarEventDialog.xul index b592f726a0a..ca104b5dbf0 100644 --- a/mozilla/calendar/resources/content/calendarEventDialog.xul +++ b/mozilla/calendar/resources/content/calendarEventDialog.xul @@ -23,6 +23,7 @@ - Mike Potter - Colin Phillips - Chris Charabaruk + - ArentJan Banck - - 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 @@ -263,6 +264,19 @@ + + + + + + + + + + + + diff --git a/mozilla/calendar/resources/content/calendarToDoDialog.js b/mozilla/calendar/resources/content/calendarToDoDialog.js index aef2dd75559..9409bdba5ef 100644 --- a/mozilla/calendar/resources/content/calendarToDoDialog.js +++ b/mozilla/calendar/resources/content/calendarToDoDialog.js @@ -22,6 +22,7 @@ * Mike Potter * Colin Phillips * Chris Charabaruk + * ArentJan Banck * * 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 @@ -163,9 +164,8 @@ function loadCalendarToDoDialog() setFieldValue( "alarm-length-units", gToDo.alarmUnits ); - // Load default categories - this.categoriesStringBundle = srGetStrBundle("chrome://calendar/locale/categories.properties"); - var categoriesString = this.categoriesStringBundle.GetStringFromName("categories" ); + // Load categories + var categoriesString = opener.gCalendarWindow.calendarPreferences.getPref( "categories" ); var categoriesList = categoriesString.split( "," ); // insert the category already in the task so it doesn't get lost diff --git a/mozilla/calendar/resources/content/eventDialog.js b/mozilla/calendar/resources/content/eventDialog.js index 4feb077ea12..0d6b1fcf993 100644 --- a/mozilla/calendar/resources/content/eventDialog.js +++ b/mozilla/calendar/resources/content/eventDialog.js @@ -22,6 +22,7 @@ * Mike Potter * Colin Phillips * Chris Charabaruk + * ArentJan Banck * * 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 @@ -220,6 +221,31 @@ function loadCalendarEventDialog() setFieldValue( "repeat-until-radio", (gEvent.recurForever == undefined || gEvent.recurForever == false), "selected" ); + + // Load categories + var categoriesString = opener.gCalendarWindow.calendarPreferences.getPref( "categories" ); + var categoriesList = categoriesString.split( "," ); + + // insert the category already in the task so it doesn't get lost + if( gEvent.categories ) + if( categoriesString.indexOf( gEvent.categories ) == -1 ) + categoriesList[categoriesList.length] = gEvent.categories; + + // categoriesList.sort(); + + var oldMenulist = document.getElementById( "categories-menulist-menupopup" ); + while( oldMenulist.hasChildNodes() ) + oldMenulist.removeChild( oldMenulist.lastChild ); + + for (var i = 0; i < categoriesList.length ; i++) + { + document.getElementById( "categories-field" ).appendItem(categoriesList[i], categoriesList[i]); + } + + document.getElementById( "categories-field" ).selectedIndex = -1; + setFieldValue( "categories-field", gEvent.categories ); + + // update enabling and disabling updateRepeatItemEnabled(); @@ -309,6 +335,9 @@ function onOKCommand() { gEvent.alarmEmailAddress = ""; } + + gEvent.categories = getFieldValue( "categories-field", "value" ); + gEvent.recur = getFieldValue( "repeat-checkbox", "checked" ); gEvent.recurUnits = getFieldValue( "repeat-length-units", "value" ); gEvent.recurForever = getFieldValue( "repeat-forever-radio", "selected" ); diff --git a/mozilla/calendar/resources/content/eventDialog.xul b/mozilla/calendar/resources/content/eventDialog.xul index b592f726a0a..ca104b5dbf0 100644 --- a/mozilla/calendar/resources/content/eventDialog.xul +++ b/mozilla/calendar/resources/content/eventDialog.xul @@ -23,6 +23,7 @@ - Mike Potter - Colin Phillips - Chris Charabaruk + - ArentJan Banck - - 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 @@ -263,6 +264,19 @@ + + + + + + + + + + + + diff --git a/mozilla/calendar/resources/content/pref/calendarPref.xul b/mozilla/calendar/resources/content/pref/calendarPref.xul index 5106c185abc..65bc6959f73 100644 --- a/mozilla/calendar/resources/content/pref/calendarPref.xul +++ b/mozilla/calendar/resources/content/pref/calendarPref.xul @@ -20,6 +20,7 @@ - - Contributor(s): - Mike Potter + - ArentJan Banck - - 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 @@ -46,20 +47,20 @@ + headertitle="&calendarPanel.label;"> - + &pref.alarmgoesoff.label; @@ -68,40 +69,45 @@ label="&pref.showalarmbox;" /> - Date Text Format: + &pref.dateformat.label; - - + + - First Day Of The Week: + &pref.weekstarts.label; - - - - - - - + + + + + + + - Default Event Length: + &pref.defaultlength.label; - Default Snooze Length: + &pref.defaultsnoozelength.label; + + + + + diff --git a/mozilla/calendar/resources/content/pref/rootCalendarPref.js b/mozilla/calendar/resources/content/pref/rootCalendarPref.js index b5aa82b74b9..87f2d378b48 100644 --- a/mozilla/calendar/resources/content/pref/rootCalendarPref.js +++ b/mozilla/calendar/resources/content/pref/rootCalendarPref.js @@ -19,6 +19,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): Mike Potter + * ArentJan Banck * * 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 @@ -75,6 +76,15 @@ calendarPrefObserver.prototype = function calendarPreferences( CalendarWindow ) { + function getDefaultCategories() + { + try { + var categoriesStringBundle = srGetStrBundle("chrome://calendar/locale/categories.properties"); + return categoriesStringBundle.GetStringFromName("categories" ); + } + catch(e) { return "" } + } + window.calendarPrefObserver = new calendarPrefObserver( this ); this.calendarWindow = CalendarWindow; @@ -94,6 +104,7 @@ function calendarPreferences( CalendarWindow ) this.calendarPref.setIntPref( "week.start", 0 ); this.calendarPref.setIntPref( "event.defaultlength", 60 ); this.calendarPref.setIntPref( "alarms.defaultsnoozelength", 10 ); + this.calendarPref.setCharPref( "categories.names", getDefaultCategories() ); this.loadPreferences(); } @@ -113,6 +124,8 @@ calendarPreferences.prototype.loadPreferences = function() this.arrayOfPrefs.defaulteventlength = this.calendarPref.getIntPref( "event.defaultlength" ); this.arrayOfPrefs.defaultsnoozelength = this.calendarPref.getIntPref( "alarms.defaultsnoozelength" ); + + this.arrayOfPrefs.categories = this.calendarPref.getCharPref( "categories.names" ); } calendarPreferences.prototype.getPref = function( Preference ) diff --git a/mozilla/calendar/resources/content/toDoDialog.js b/mozilla/calendar/resources/content/toDoDialog.js index aef2dd75559..9409bdba5ef 100644 --- a/mozilla/calendar/resources/content/toDoDialog.js +++ b/mozilla/calendar/resources/content/toDoDialog.js @@ -22,6 +22,7 @@ * Mike Potter * Colin Phillips * Chris Charabaruk + * ArentJan Banck * * 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 @@ -163,9 +164,8 @@ function loadCalendarToDoDialog() setFieldValue( "alarm-length-units", gToDo.alarmUnits ); - // Load default categories - this.categoriesStringBundle = srGetStrBundle("chrome://calendar/locale/categories.properties"); - var categoriesString = this.categoriesStringBundle.GetStringFromName("categories" ); + // Load categories + var categoriesString = opener.gCalendarWindow.calendarPreferences.getPref( "categories" ); var categoriesList = categoriesString.split( "," ); // insert the category already in the task so it doesn't get lost diff --git a/mozilla/calendar/resources/locale/en-US/calendarPrefs.dtd b/mozilla/calendar/resources/locale/en-US/calendarPrefs.dtd index 7de7bd7d5e6..49f1c9596b1 100644 --- a/mozilla/calendar/resources/locale/en-US/calendarPrefs.dtd +++ b/mozilla/calendar/resources/locale/en-US/calendarPrefs.dtd @@ -20,6 +20,7 @@ - the Initial Developer. All Rights Reserved. - - Contributor(s): Mike Potter + - ArentJan Banck - - 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 @@ -36,9 +37,26 @@ - ***** END LICENSE BLOCK ***** --> + - + + + + + + + + + + + + + + + + + diff --git a/mozilla/calendar/resources/locale/en-US/prefs.dtd b/mozilla/calendar/resources/locale/en-US/prefs.dtd index 7de7bd7d5e6..49f1c9596b1 100644 --- a/mozilla/calendar/resources/locale/en-US/prefs.dtd +++ b/mozilla/calendar/resources/locale/en-US/prefs.dtd @@ -20,6 +20,7 @@ - the Initial Developer. All Rights Reserved. - - Contributor(s): Mike Potter + - ArentJan Banck - - 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 @@ -36,9 +37,26 @@ - ***** END LICENSE BLOCK ***** --> + - + + + + + + + + + + + + + + + + +