зеркало из https://github.com/mozilla/gecko-dev.git
bug #369084 missing thunderbird integration for undo/redo r=lilmatt
This commit is contained in:
Родитель
05674eba64
Коммит
315c435e6b
|
@ -332,6 +332,7 @@ calTransaction.prototype = {
|
||||||
mOldItem: null,
|
mOldItem: null,
|
||||||
mOldCalendar: null,
|
mOldCalendar: null,
|
||||||
mListener: null,
|
mListener: null,
|
||||||
|
mIsDoTransaction: false,
|
||||||
|
|
||||||
QueryInterface: function (aIID) {
|
QueryInterface: function (aIID) {
|
||||||
if (!aIID.equals(Components.interfaces.nsISupports) &&
|
if (!aIID.equals(Components.interfaces.nsISupports) &&
|
||||||
|
@ -348,7 +349,11 @@ calTransaction.prototype = {
|
||||||
if (aOperationType == Components.interfaces.calIOperationListener.ADD ||
|
if (aOperationType == Components.interfaces.calIOperationListener.ADD ||
|
||||||
aOperationType ==Components.interfaces.calIOperationListener.MODIFY) {
|
aOperationType ==Components.interfaces.calIOperationListener.MODIFY) {
|
||||||
// Add/Delete return the original item as detail for success
|
// Add/Delete return the original item as detail for success
|
||||||
this.mItem = aDetail;
|
if (this.mIsDoTransaction) {
|
||||||
|
this.mItem = aDetail;
|
||||||
|
} else {
|
||||||
|
this.mOldItem = aDetail;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Components.utils.reportError("Severe error in internal transaction code!\n" +
|
Components.utils.reportError("Severe error in internal transaction code!\n" +
|
||||||
|
@ -366,6 +371,7 @@ calTransaction.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
doTransaction: function () {
|
doTransaction: function () {
|
||||||
|
this.mIsDoTransaction = true;
|
||||||
switch (this.mAction) {
|
switch (this.mAction) {
|
||||||
case 'add':
|
case 'add':
|
||||||
this.mCalendar.addItem(this.mItem, this);
|
this.mCalendar.addItem(this.mItem, this);
|
||||||
|
@ -385,6 +391,7 @@ calTransaction.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
undoTransaction: function () {
|
undoTransaction: function () {
|
||||||
|
this.mIsDoTransaction = false;
|
||||||
switch (this.mAction) {
|
switch (this.mAction) {
|
||||||
case 'add':
|
case 'add':
|
||||||
this.mCalendar.deleteItem(this.mItem, this);
|
this.mCalendar.deleteItem(this.mItem, this);
|
||||||
|
|
|
@ -51,6 +51,8 @@ var CalendarController =
|
||||||
case "cmd_cut":
|
case "cmd_cut":
|
||||||
case "cmd_copy":
|
case "cmd_copy":
|
||||||
case "cmd_paste":
|
case "cmd_paste":
|
||||||
|
case "cmd_undo":
|
||||||
|
case "cmd_redo":
|
||||||
case "cmd_print":
|
case "cmd_print":
|
||||||
case "cmd_printpreview":
|
case "cmd_printpreview":
|
||||||
return true;
|
return true;
|
||||||
|
@ -68,6 +70,22 @@ var CalendarController =
|
||||||
return currentView().getSelectedItems({}).length != 0;
|
return currentView().getSelectedItems({}).length != 0;
|
||||||
case "cmd_paste":
|
case "cmd_paste":
|
||||||
return canPaste();
|
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":
|
case "cmd_print":
|
||||||
if (this.isCalendarInForeground()) {
|
if (this.isCalendarInForeground()) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -104,6 +122,16 @@ var CalendarController =
|
||||||
case "cmd_paste":
|
case "cmd_paste":
|
||||||
pasteFromClipboard();
|
pasteFromClipboard();
|
||||||
break;
|
break;
|
||||||
|
case "cmd_undo":
|
||||||
|
if (this.isCalendarInForeground() && canUndo()) {
|
||||||
|
gTransactionMgr.undoTransaction();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "cmd_redo":
|
||||||
|
if (this.isCalendarInForeground() && canRedo()) {
|
||||||
|
gTransactionMgr.redoTransaction();
|
||||||
|
}
|
||||||
|
break;
|
||||||
case "cmd_print":
|
case "cmd_print":
|
||||||
if (this.isCalendarInForeground()) {
|
if (this.isCalendarInForeground()) {
|
||||||
calPrint();
|
calPrint();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче