diff --git a/mozilla/calendar/resources/content/calendarCreation.js b/mozilla/calendar/resources/content/calendarCreation.js index f6a0253fcb6..ae463fc161f 100644 --- a/mozilla/calendar/resources/content/calendarCreation.js +++ b/mozilla/calendar/resources/content/calendarCreation.js @@ -112,6 +112,19 @@ function doCreateCalendar() return true; } +function initNameFromURI() { + var path = document.getElementById("calendar-uri").value; + var nameField = document.getElementById("calendar-name"); + if (!path || nameField.value) + return; + + var fullPathRegex = new RegExp("([^/:]+)[.]ics$"); + var captures = path.match(fullPathRegex); + if (captures && captures.length >= 1) { + nameField.value = captures[1]; + } +} + //Don't let the wizard advance if the URL isn't valid, since the calendar //creation will fail. function checkURL() { diff --git a/mozilla/calendar/resources/content/calendarCreation.xul b/mozilla/calendar/resources/content/calendarCreation.xul index ebd41bd7a5e..7b26ee235a5 100755 --- a/mozilla/calendar/resources/content/calendarCreation.xul +++ b/mozilla/calendar/resources/content/calendarCreation.xul @@ -113,7 +113,7 @@ description="&custompage.shortdescription;" label="&wizard.label;" next="finishPage" - onpageshow="checkRequired();" + onpageshow="initNameFromURI(); checkRequired();" onpageadvanced="doCreateCalendar();"> &custompage.longdescription;