bug 329642 make 'all occurrences vs. this occurrence' dialog cancelable. patch by robin.edrenius, r=dmose

This commit is contained in:
mattwillis%gmail.com 2006-05-15 02:55:58 +00:00
Родитель b108172fe7
Коммит 02936111e0
3 изменённых файлов: 25 добавлений и 7 удалений

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

@ -20,6 +20,7 @@
*
* Contributor(s):
* Stuart Parmenter <stuart.parmenter@oracle.com>
* Robin Edrenius <robin.edrenius@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -149,7 +150,9 @@ function modifyEventWithDialog(item)
}
}
openEventDialog(item, item.calendar, "modify", onModifyItem);
if (item) {
openEventDialog(item, item.calendar, "modify", onModifyItem);
}
}
function openEventDialog(calendarItem, calendar, mode, callback)
@ -204,13 +207,15 @@ function getOccurrenceOrParent(occurrence) {
var buttonLabel2 = props.GetStringFromName("editRecurSingle");
var flags = promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_0 +
promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_1;
promptService.BUTTON_TITLE_CANCEL * promptService.BUTTON_POS_1 +
promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_2;
if (promptService.confirmEx(null, promptTitle, promptMessage, flags,
buttonLabel1, buttonLabel2, null, null, {})) {
return occurrence;
} else {
return occurrence.parentItem;
var choice = promptService.confirmEx(null, promptTitle, promptMessage, flags,
buttonLabel1,null , buttonLabel2, null, {});
switch(choice) {
case 0: return occurrence.parentItem;
case 2: return occurrence;
default: return null;
}
}

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

@ -191,6 +191,9 @@ var ltnCalendarViewController = {
// if we can modify this thing directly (e.g. just the time changed),
// then do so; otherwise pop up the dialog
var itemToEdit = getOccurrenceOrParent(aOccurrence);
if (!itemToEdit) {
return;
}
if (aNewStartTime && aNewEndTime && !aNewStartTime.isDate && !aNewEndTime.isDate) {
var instance = itemToEdit.clone();
@ -218,6 +221,9 @@ var ltnCalendarViewController = {
deleteOccurrence: function (aOccurrence) {
var itemToDelete = getOccurrenceOrParent(aOccurrence);
if (!itemToDelete) {
return;
}
if (itemToDelete.parentItem != itemToDelete) {
var event = itemToDelete.parentItem.clone();
event.recurrenceInfo.removeOccurrenceAt(itemToDelete.recurrenceId);

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

@ -21,6 +21,7 @@
* Contributor(s): Garth Smedley <garths@oeone.com>
* Mike Potter <mikep@oeone.com>
* Eric Belhaire <belhaire@ief.u-psud.fr>
* Robin Edrenius <robin.edrenius@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -75,6 +76,9 @@ calViewController.prototype.modifyOccurrence = function (aOccurrence, aNewStartT
if (aNewStartTime && aNewEndTime && !aNewStartTime.isDate
&& !aNewEndTime.isDate) {
var itemToEdit = getOccurrenceOrParent(aOccurrence);
if (!itemToEdit) {
return;
}
var instance = itemToEdit.clone();
var newStartTime = aNewStartTime;
@ -100,6 +104,9 @@ calViewController.prototype.modifyOccurrence = function (aOccurrence, aNewStartT
calViewController.prototype.deleteOccurrence = function (aOccurrence) {
var itemToDelete = getOccurrenceOrParent(aOccurrence);
if (!itemToDelete) {
return;
}
if (itemToDelete.parentItem != itemToDelete) {
var event = itemToDelete.parentItem.clone();
event.recurrenceInfo.removeOccurrenceAt(itemToDelete.recurrenceId);