bug #369084 missing thunderbird integration for undo/redo r=lilmatt

This commit is contained in:
michael.buettner%sun.com 2007-03-08 17:13:59 +00:00
Родитель 05674eba64
Коммит 315c435e6b
2 изменённых файлов: 36 добавлений и 1 удалений

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

@ -332,6 +332,7 @@ calTransaction.prototype = {
mOldItem: null,
mOldCalendar: null,
mListener: null,
mIsDoTransaction: false,
QueryInterface: function (aIID) {
if (!aIID.equals(Components.interfaces.nsISupports) &&
@ -348,7 +349,11 @@ calTransaction.prototype = {
if (aOperationType == Components.interfaces.calIOperationListener.ADD ||
aOperationType ==Components.interfaces.calIOperationListener.MODIFY) {
// Add/Delete return the original item as detail for success
this.mItem = aDetail;
if (this.mIsDoTransaction) {
this.mItem = aDetail;
} else {
this.mOldItem = aDetail;
}
}
} else {
Components.utils.reportError("Severe error in internal transaction code!\n" +
@ -366,6 +371,7 @@ calTransaction.prototype = {
},
doTransaction: function () {
this.mIsDoTransaction = true;
switch (this.mAction) {
case 'add':
this.mCalendar.addItem(this.mItem, this);
@ -385,6 +391,7 @@ calTransaction.prototype = {
}
},
undoTransaction: function () {
this.mIsDoTransaction = false;
switch (this.mAction) {
case 'add':
this.mCalendar.deleteItem(this.mItem, this);

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

@ -51,6 +51,8 @@ var CalendarController =
case "cmd_cut":
case "cmd_copy":
case "cmd_paste":
case "cmd_undo":
case "cmd_redo":
case "cmd_print":
case "cmd_printpreview":
return true;
@ -68,6 +70,22 @@ var CalendarController =
return currentView().getSelectedItems({}).length != 0;
case "cmd_paste":
return canPaste();
case "cmd_undo":
if (this.isCalendarInForeground()) {
goSetMenuValue(command, 'valueDefault');
if (canUndo()) {
return true;
}
}
break;
case "cmd_redo":
if (this.isCalendarInForeground()) {
goSetMenuValue(command, 'valueDefault');
if(canRedo()) {
return true;
}
}
break;
case "cmd_print":
if (this.isCalendarInForeground()) {
return true;
@ -104,6 +122,16 @@ var CalendarController =
case "cmd_paste":
pasteFromClipboard();
break;
case "cmd_undo":
if (this.isCalendarInForeground() && canUndo()) {
gTransactionMgr.undoTransaction();
}
break;
case "cmd_redo":
if (this.isCalendarInForeground() && canRedo()) {
gTransactionMgr.redoTransaction();
}
break;
case "cmd_print":
if (this.isCalendarInForeground()) {
calPrint();