diff --git a/calendar/resources/content/calendar.xul b/calendar/resources/content/calendar.xul
index f18f11ce8eac..9051a404971f 100644
--- a/calendar/resources/content/calendar.xul
+++ b/calendar/resources/content/calendar.xul
@@ -100,7 +100,8 @@
-
+
+
diff --git a/calendar/resources/content/calendarManager.js b/calendar/resources/content/calendarManager.js
index 5be71fd8a75d..7c50e315f3a0 100644
--- a/calendar/resources/content/calendarManager.js
+++ b/calendar/resources/content/calendarManager.js
@@ -128,7 +128,23 @@ function calendarManager( CalendarWindow )
/*
** Launch the new calendar file dialog
*/
-calendarManager.prototype.launchAddCalendarDialog = function calMan_launchAddCalendarDialog( aName, aPath )
+calendarManager.prototype.launchNewCalendarFileDialog = function calMan_launchNewCalendarFileDialog( aName, aPath )
+{
+ this.launchNewOrOpenCalendarFileDialog(aName, aPath, "new");
+}
+
+/*
+** Launch the open calendar file dialog
+*/
+calendarManager.prototype.launchOpenCalendarFileDialog = function calMan_launchOpenCalendarFileDialog( aName, aPath )
+{
+ this.launchNewOrOpenCalendarFileDialog(aName, aPath, "open");
+}
+
+/*
+** PRIVATE: Launch the new file dialog or open calendar file dialog
+*/
+calendarManager.prototype.launchNewOrOpenCalendarFileDialog = function calMan_launchNewOrOpenCalendarFileDialog( aName, aPath, aMode )
{
// set up a bunch of args to pass to the dialog
var ThisCalendarObject = new CalendarObject();
@@ -140,7 +156,7 @@ calendarManager.prototype.launchAddCalendarDialog = function calMan_launchAddCal
ThisCalendarObject.path = aPath;
var args = new Object();
- args.mode = "new";
+ args.mode = aMode;
var thisManager = this;
@@ -648,7 +664,7 @@ calendarManager.prototype.checkCalendarURL = function calMan_checkCalendarURL( C
FilePath = profileFile.path;
saveDataToFile(FilePath, CalendarData, null);
- CalendarManager.launchAddCalendarDialog( CalendarName, FilePath );
+ CalendarManager.launchOpenCalendarFileDialog( CalendarName, FilePath );
}
}
var result = this.getRemoteCalendarText( Channel, onResponse, null );
@@ -767,6 +783,11 @@ calendarManager.prototype.getDefaultServer = function calMan_getDefaultServer()
return( this.rootContainer.getSubNodes()[0].getAttribute( "http://home.netscape.com/NC-rdf#path" ) );
}
+calendarManager.prototype.getDefaultCalendarName = function calMan_getDefaultName()
+{
+ return( this.rootContainer.getSubNodes()[0].getAttribute( "http://home.netscape.com/NC-rdf#name" ) );
+}
+
calendarManager.prototype.getAndConvertAllOldCalendars = function calMan_getAllCalendars()
{
@@ -1099,8 +1120,8 @@ var calendarManagerDNDObserver = {
// url has spec, fileName, fileBaseName, fileExtension and others
var url = Components.classes["@mozilla.org/network/standard-url;1"].createInstance();
url = url.QueryInterface(Components.interfaces.nsIURL);
- url.spec = droppedUrl;
- gCalendarWindow.calendarManager.launchAddCalendarDialog(url.fileBaseName, url.spec )
+ url.spec = droppedUrl;
+ gCalendarWindow.calendarManager.launchOpenCalendarFileDialog(url.fileBaseName, url.spec );
break;
diff --git a/calendar/resources/content/localCalDialog.js b/calendar/resources/content/localCalDialog.js
index 72044dfdf442..16991bfabb8b 100644
--- a/calendar/resources/content/localCalDialog.js
+++ b/calendar/resources/content/localCalDialog.js
@@ -49,18 +49,26 @@
* NOTES
* Code for creating a new local calendar.
*
-* Invoke this dialog to create a new event as follows:
+* Invoke this dialog to create a new calendar file as follows:
var args = new Object();
- args.mode = "new"; // "new" or "edit"
+ args.mode = "new"; // "new", "open", or "edit"
args.onOk = ; // funtion to call when OK is clicked
calendar.openDialog("caNewCalendar", "chrome://calendar/content/localCalDialog.xul", true, args );
*
-* Invoke this dialog to edit an existing event as follows:
+* Invoke this dialog to open an existing local calendar file as follows:
+
+ var args = new Object();
+ args.mode = "open"; // "new", "open", or "edit"
+ args.onOk = ; // funtion to call when OK is clicked
+
+ calendar.openDialog("caNewCalendar", "chrome://calendar/content/localCalDialog.xul", true, args );
+*
+* Invoke this dialog to edit a known calendar file as follows:
*
var args = new Object();
- args.mode = "edit"; // "new" or "edit"
+ args.mode = "edit"; // "new", "open", or "edit"
args.onOk = ; // funtion to call when OK is clicked
* When the user clicks OK the onOk function will be called with a calendar event object.
@@ -79,7 +87,7 @@
var gCalendarObject; // event being edited
var gOnOkFunction; // function to be called when user clicks OK
-var gMode = ''; //what mode are we in? new or edit...
+var gMode = ''; //what mode are we in? new or open or edit...
/*-----------------------------------------------------------------
* W I N D O W F U N C T I O N S
@@ -107,13 +115,17 @@ function loadCalendarServerDialog()
{
titleDataItem = document.getElementById( "data-event-title-new" );
}
+ else if( "open" == args.mode )
+ {
+ titleDataItem = document.getElementById( "data-event-title-open" );
+ }
else
{
titleDataItem = document.getElementById( "data-event-title-edit" );
document.getElementById( "server-path-textbox" ).setAttribute( "readonly", "true" );
}
-
+
// CofC - calendar coloring change
document.getElementById("calendar-color").color = gCalendarObject.color;
@@ -173,7 +185,14 @@ function launchFilePicker()
// caller can force disable of sand box, even if ON globally
- fp.init(window, gCalendarBundle.getString( "Save" ), nsIFilePicker.modeSave);
+ // Note: because all changes are saved immediately,
+ // must save a file name for new calendar files as well.
+ if (gMode == "new")
+ fp.init(window, gCalendarBundle.getString( "New" ), nsIFilePicker.modeSave);
+ else if (gMode == "open")
+ fp.init(window, gCalendarBundle.getString( "Open" ), nsIFilePicker.modeOpen);
+ else /* gMode == "edit" */
+ fp.init(window, gCalendarBundle.getString( "Save" ), nsIFilePicker.modeSave);
var ServerName = document.getElementById( "server-name-textbox" ).value;
diff --git a/calendar/resources/content/localCalDialog.xul b/calendar/resources/content/localCalDialog.xul
index 786fbb9204e3..1cfa1bf5b083 100644
--- a/calendar/resources/content/localCalDialog.xul
+++ b/calendar/resources/content/localCalDialog.xul
@@ -72,6 +72,7 @@
+
diff --git a/calendar/resources/content/menuOverlay.xul b/calendar/resources/content/menuOverlay.xul
index b8028e030daa..ee152e39fe7c 100644
--- a/calendar/resources/content/menuOverlay.xul
+++ b/calendar/resources/content/menuOverlay.xul
@@ -95,6 +95,7 @@
label="&fileMenu.label;"
accesskey="&fileMenu.accesskey;">
@@ -276,33 +310,15 @@
-
@@ -276,33 +311,15 @@
-