Bug 295895: Make it possible to unsubscribe from a calendar. r=gekacheka

This commit is contained in:
mvl%exedo.nl 2005-06-01 13:38:11 +00:00
Родитель 4b7e260bb2
Коммит 676ab54730
5 изменённых файлов: 16 добавлений и 44 удалений

Просмотреть файл

@ -668,6 +668,16 @@ function editCalendarDialog(event)
openCalendarProperties(document.popupNode.calendar, null);
}
function deleteCalendar(event)
{
var cal = document.popupNode.calendar
getDisplayComposite().removeCalendar(cal.uri);
var calMgr = getCalendarManager();
calMgr.unregisterCalendar(cal);
// Delete file?
//calMgr.deleteCalendar(cal);
}
function appendCalendars(to, froms, listener)
{

Просмотреть файл

@ -103,7 +103,7 @@
<command id="new_calendar_command" oncommand="newCalendarDialog()"/>
<command id="edit_calendar_command" oncommand="editCalendarDialog(event)"/>
<command id="delete_calendar_command" oncommand="deleteCalendar()"/>
<command id="delete_calendar_command" oncommand="deleteCalendar(event)"/>
<command id="next_command" oncommand="gCalendarWindow.currentView.goToNext()"/>
<command id="previous_command" oncommand="gCalendarWindow.currentView.goToPrevious()"/>

Просмотреть файл

@ -63,7 +63,10 @@ var calCalendarManagerObserver = {
},
onCalendarUnregistering: function(aCalendar) {
setCalendarManagerUI();
var item = getListItem(aCalendar);
if (item) {
document.getElementById("list-calendars-listbox").removeChild(item);
}
},
onCalendarDeleting: function(aCalendar) {

Просмотреть файл

@ -1069,44 +1069,3 @@ CalendarView.prototype.preferredDaysOff = function() {
}
return isDayOff;
}
function deleteCalendar( )
{
// Show a dialog with option to import events with or without dialogs
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService();
promptService = promptService.QueryInterface(Components.interfaces.nsIPromptService);
var result = {value:0};
var buttonPressed =
promptService.confirmEx(window,
gCalendarBundle.getString( "deleteCalendarTitle" ), gCalendarBundle.getString( "deleteCalendarMessage" ),
(promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_0) +
(promptService.BUTTON_TITLE_CANCEL * promptService.BUTTON_POS_1) +
(promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_2),
gCalendarBundle.getString( "deleteCalendarOnly" ),null,gCalendarBundle.getString( "deleteCalendarAndFile" ),null, result);
var calendarList = document.getElementById("list-calendars-listbox");
var selectedCalendar = calendarList.currentItem.calendar;
if (buttonPressed == 0) {
// Delete calendar
getCalendarManager().unregisterCalendar(selectedCalendar);
}
else if(buttonPressed == 2) //delete calendar and file
{
getCalendarManager().unregisterCalendar(selectedCalendar);
getCalendarManager().deleteCalendar(selectedCalendar);
}
else if(buttonPressed == 1) // CANCEL
{
return false;
}
calendarList.removeChild(calendarList.currentItem);
refreshView();
return true;
}

Просмотреть файл

@ -77,7 +77,7 @@
<command id="edit_local_calendar_command" oncommand="gCalendarWindow.calendarManager.launchEditCalendarDialog()"/>
<command id="new_server_command" oncommand="gCalendarWindow.calendarManager.launchAddRemoteCalendarDialog()"/>
<command id="edit_server_command" oncommand="gCalendarWindow.calendarManager.launchEditRemoteCalendarDialog()"/>
<command id="delete_server_command" oncommand="deleteCalendar()"/>
<command id="delete_server_command" oncommand="deleteCalendar(event)"/>
<command id="find_new_calendar_command" oncommand="goFindNewCalendars()"/>
<command id="next_command" oncommand="gCalendarWindow.currentView.goToNext()"/>