Vincent Mora f63c302420 [FEATURE] Add undo and redo on transaction groups (#4765)
* [FEATURE] adds undo/redo for transaction groups

[needs-docs] the undo/redo now works with transcation groups. Just check
that there is no restriction in the transaction groups doc concerning
undo.

related to #14799

The undo/redo is implemented using SAVEPOINT.

The QgsTransaction interface has been enlarged to allow savepoints
creation and management. The savepoint is destroyed on
rollbackToSavepoint to have the same behavior has the sql ROLLBACK TO
SAVEPPOINT.

To avoid the creation of a savepoint for each feature modified in bulk
editing (e.g. paste, field calculator) the logic is a bit complicated: the
savepoint is created on QgsVectorLayer::editCommandStarted and the first
actual undo command (QgsVectorLayerUndoPassthroughCommand) is
responsible for the re-creation of the savepoint in case of undo-redo.
Since the behavior must be different in case edition doesn't take place
inside an edit command, a member function has been added to
QgsVectorLayer to expose the mEditCommandActive state.

Another (commented) tricky bit is the modification of the database
structure on add/delete attributes. On undo, the attribute is removed
before the rollback to savepoint, i.e. there is a useless ALTER TABLE
issued to restore the structure just before restoring it with the
ROLLBACK TO SAVEPOINT. This is necessary to make the provider
aware of the change of structure. It could be nicer/cleaner to have a way
to reload providers metadata.

The editPaste function has also been modified to use addFeatures instead of
addFeature (plural/singular), this is at the expense of an additional "cpy"
of the clipboard in memory, but it should improve perf with postgis provider.

* fixup operator aliases
2017-09-15 14:55:43 +02:00
..
2017-06-28 10:45:51 +02:00
2017-09-11 21:55:20 +10:00
2017-08-30 00:50:10 +02:00
2017-09-11 21:43:15 +10:00
2017-09-08 08:06:21 +02:00
2017-09-11 21:43:15 +10:00
2017-08-29 18:03:41 +10:00
2017-09-11 21:55:20 +10:00
2017-09-12 00:48:40 +02:00
2017-08-29 03:18:37 +10:00
2017-07-03 08:49:50 +02:00
2017-05-23 10:35:12 +02:00
2017-05-23 10:35:12 +02:00
2017-09-11 21:43:15 +10:00
2017-09-11 21:55:20 +10:00
2017-09-11 21:43:15 +10:00
2017-08-29 18:03:41 +10:00
2017-07-24 13:44:25 +02:00
2017-09-11 21:43:15 +10:00
2017-06-09 10:16:08 +02:00
2017-09-11 21:43:15 +10:00
2017-09-11 21:43:15 +10:00
2017-05-23 10:35:12 +02:00
2017-06-09 10:16:08 +02:00
2017-06-09 10:16:08 +02:00
2017-05-23 10:35:12 +02:00
2017-08-22 12:07:01 +02:00
2017-09-11 21:43:15 +10:00
2017-05-19 15:35:47 +02:00
2017-05-18 09:41:16 +02:00
2017-05-18 09:41:16 +02:00
2017-05-18 09:41:16 +02:00
2017-09-11 21:43:15 +10:00
2017-09-06 11:25:17 +10:00
2017-09-06 15:22:39 +01:00
2017-05-18 09:41:16 +02:00
2017-05-23 10:35:12 +02:00
2017-05-18 09:41:16 +02:00
2017-05-18 09:41:16 +02:00
2017-09-11 21:43:15 +10:00
2017-05-22 10:12:08 +02:00
2017-06-13 18:31:00 +02:00
2017-09-11 21:55:20 +10:00
2017-05-18 21:34:21 +02:00
2017-05-18 21:34:21 +02:00
2017-05-18 21:34:21 +02:00
2017-05-18 21:34:21 +02:00
2017-05-18 21:34:21 +02:00
2017-05-22 10:12:08 +02:00
2017-08-25 06:29:04 +10:00
2017-06-09 10:16:08 +02:00
2017-05-22 10:12:08 +02:00
2017-09-02 16:12:53 +10:00
2017-05-22 10:12:08 +02:00
2017-05-22 10:12:08 +02:00
2017-08-14 10:43:37 +02:00
2017-08-28 14:09:57 +01:00
2017-05-22 10:12:08 +02:00
2017-05-22 10:12:08 +02:00
2017-05-23 10:35:12 +02:00
2017-05-23 10:35:12 +02:00
2017-05-23 10:35:12 +02:00
2017-07-31 11:09:15 +01:00
2017-06-28 10:45:51 +02:00