Checked in attachment #157201 for bug 256890:

Provide a way to tell calendar to reload a calendar file


git-svn-id: svn://10.0.0.236/trunk@161547 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mostafah%oeone.com
2004-08-31 19:09:47 +00:00
parent 762ad455af
commit 455848e3b9

View File

@@ -550,19 +550,25 @@ calendarManager.prototype.refreshAllRemoteCalendars = function calMan_refreshAll
** Otherwise, returns false.
*/
calendarManager.prototype.isURLAlreadySubscribed = function calMan_isCalendarSubscribed( CalendarURL )
calendarManager.prototype.isURLAlreadySubscribed = function calMan_isCalendarSubscribed( CalendarURI )
{
CalendarURL = CalendarURL.replace( "webcal:", "http:" );
CalendarURL = CalendarURI.spec.replace( "webcal:", "http:" );
this.rdf.getRootContainers().length == 0
for( var i = 0; i < this.rootContainer.getSubNodes().length; i++ )
var subNodes = this.rootContainer.getSubNodes();
for( var i = 0; i < subNodes.length; i++ )
{
if( this.rootContainer.getSubNodes()[i].getAttribute( "http://home.netscape.com/NC-rdf#remotePath" ) == CalendarURL )
if( subNodes[i].getAttribute( "http://home.netscape.com/NC-rdf#remotePath" ) == CalendarURL )
{
return( this.rootContainer.getSubNodes()[i] );
return( subNodes[i] );
}
}
if( CalendarURI.scheme == "file" ) {
for( i = 0; i < subNodes.length; i++ ) {
if( makeURLFromPath( subNodes[i].getAttribute( "http://home.netscape.com/NC-rdf#path" ) ).equals( CalendarURI ) ) {
return( subNodes[i] );
}
}
}
return( false );
}
@@ -575,7 +581,7 @@ calendarManager.prototype.isURLAlreadySubscribed = function calMan_isCalendarSub
calendarManager.prototype.checkCalendarURL = function calMan_checkCalendarURL( Channel )
{
var calendarSubscribed = this.isURLAlreadySubscribed( Channel.URI.spec );
var calendarSubscribed = this.isURLAlreadySubscribed( Channel.URI );
if( calendarSubscribed === false )
{
@@ -641,13 +647,12 @@ calendarManager.prototype.checkCalendarURL = function calMan_checkCalendarURL( C
else
{
//calendarSubscribed is the subscribed calendar object.
if( calendarSubscribed.active == false )
{
calendarSubscribed.active = true;
if( calendarSubscribed.getAttribute( "http://home.netscape.com/NC-rdf#active" ) == "false" ) {
calendarSubscribed.setAttribute( "http://home.netscape.com/NC-rdf#active", "true" );
this.addCalendar( calendarSubscribed );
document.getElementById( "calendar-list-item-"+calendarSubscribed.serverNumber ).setAttribute( "checked", "true" );
//document.getElementById( "calendar-list-item-"+calendarSubscribed.serverNumber ).setAttribute( "checked", "true" );
refreshEventTree( getAndSetEventTable() );
@@ -862,6 +867,15 @@ calendarManager.prototype.getAndConvertAllOldCalendars = function calMan_getAllC
}
}
function makeURLFromPath( path ) {
var localFile = Components.classes["@mozilla.org/file/local;1"].createInstance().
QueryInterface(Components.interfaces.nsILocalFile);
localFile.initWithPath( path );
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
return ioService.newFileURI(localFile);
}
/*
** swithces the calendar from on to off and off to on
*/