зеркало из https://github.com/mozilla/gecko-dev.git
Add a way to refresh calendars. bug 285018, r=shaver
This commit is contained in:
Родитель
b05c1a8138
Коммит
ea6fce7366
|
@ -275,6 +275,14 @@ interface calICalendar : nsISupports
|
|||
* Whether or not alarms for this calendar should be suppressed.
|
||||
*/
|
||||
attribute boolean suppressAlarms;
|
||||
|
||||
|
||||
/**
|
||||
* Refresh the datasource, and call the observers for any changes found.
|
||||
* May call the onLoad function of the observers if the provider doesn't
|
||||
* know the details of the changes.
|
||||
*/
|
||||
void refresh();
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -140,6 +140,10 @@ calDavCalendar.prototype = {
|
|||
get uri() { return this.mUri; },
|
||||
set uri(aUri) { this.mUri = aUri; },
|
||||
|
||||
refresh: function() {
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
|
||||
// attribute boolean suppressAlarms;
|
||||
get suppressAlarms() { return false; },
|
||||
set suppressAlarms(aSuppressAlarms) { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
|
|
|
@ -292,6 +292,12 @@ calCompositeCalendar.prototype = {
|
|||
this.mObservers = this.mObservers.filter( function (v) { return v != aObserver; } );
|
||||
},
|
||||
|
||||
refresh: function() {
|
||||
for each (cal in this.mCalendars) {
|
||||
try { cal.refresh(); } catch (e) { }
|
||||
}
|
||||
},
|
||||
|
||||
// void modifyItem( in calIItemBase aNewItem, in calIItemBase aOldItem, in calIOperationListener aListener );
|
||||
modifyItem: function (aNewItem, aOldItem, aListener) {
|
||||
if (aNewItem.calendar == null) {
|
||||
|
|
|
@ -111,13 +111,16 @@ calICSCalendar.prototype = {
|
|||
get uri() { return this.mUri },
|
||||
set uri(aUri) {
|
||||
this.mMemoryCalendar.uri = this.mUri;
|
||||
this.mUri = aUri;
|
||||
this.refresh();
|
||||
},
|
||||
|
||||
refresh: function() {
|
||||
// Lock other changes to the item list.
|
||||
this.locked = true;
|
||||
// set to prevent writing after loading, without any changes
|
||||
this.loading = true;
|
||||
|
||||
this.mUri = aUri;
|
||||
|
||||
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
|
||||
|
|
|
@ -114,6 +114,11 @@ calMemoryCalendar.prototype = {
|
|||
get uri() { return this.mUri; },
|
||||
set uri(aURI) { this.mUri = aURI; },
|
||||
|
||||
|
||||
refresh: function() {
|
||||
// no-op
|
||||
},
|
||||
|
||||
// attribute boolean suppressAlarms;
|
||||
get suppressAlarms() { return false; },
|
||||
set suppressAlarms(aSuppressAlarms) { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
|
|
|
@ -297,6 +297,10 @@ calStorageCalendar.prototype = {
|
|||
this.mURI = aURI;
|
||||
},
|
||||
|
||||
refresh: function() {
|
||||
// no-op
|
||||
},
|
||||
|
||||
// attribute boolean readOnly;
|
||||
get readOnly() { return false; },
|
||||
set readOnly() { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
|
|
|
@ -118,7 +118,7 @@
|
|||
<command id="import_command" oncommand="loadEventsFromFile()"/>
|
||||
<command id="export_command" oncommand="saveEventsToFile(gCalendarWindow.EventSelection.selectedEvents)" disabled="true" disabledwhennoeventsselected="true"/>
|
||||
|
||||
<command id="reload_remote_calendars" oncommand="gCalendarWindow.calendarManager.refreshAllRemoteCalendars()"/>
|
||||
<command id="reload_remote_calendars" oncommand="reloadCalendars()"/>
|
||||
<command id="publish_calendar" oncommand="publishEntireCalendar()"/>
|
||||
<command id="publish_events_command" oncommand="publishCalendarData()" disabled="true" disabledwhennoeventsselected="true"/>
|
||||
|
||||
|
|
|
@ -230,3 +230,8 @@ function getDefaultCalendar()
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function reloadCalendars()
|
||||
{
|
||||
getDisplayComposite().refresh();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче