Skip to content
Permalink
Browse files
Update vector layer edits rollback method and app rollback actions
- Make optional whether edit buffer is deleted
- Returns optional functionality where rollback was similar to setting undo stack to index 0
  • Loading branch information
dakcarto committed Feb 11, 2013
1 parent ba2082e commit 8feb84a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
@@ -5449,7 +5449,7 @@ void QgisApp::cancelEdits( QgsMapLayer *layer, bool leaveEditable, bool triggerR
mSaveRollbackInProgress = true;

mMapCanvas->freeze( true );
if ( !vlayer->rollBack() )
if ( !vlayer->rollBack( !leaveEditable ) )
{
mSaveRollbackInProgress = false;
QMessageBox::information( 0,
@@ -3326,7 +3326,7 @@ const QStringList &QgsVectorLayer::commitErrors()
return mCommitErrors;
}

bool QgsVectorLayer::rollBack()
bool QgsVectorLayer::rollBack( bool deleteBuffer )
{
if ( !mEditBuffer )
{
@@ -3344,8 +3344,12 @@ bool QgsVectorLayer::rollBack()

updateFields();

delete mEditBuffer;
mEditBuffer = 0;
if ( deleteBuffer )
{
delete mEditBuffer;
mEditBuffer = 0;
undoStack()->clear();
}
emit editingStopped();

// invalidate the cache so the layer updates properly to show its original
@@ -713,8 +713,10 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
bool commitChanges();
const QStringList &commitErrors();

/** Stop editing and discard the edits */
bool rollBack();
/** Stop editing and discard the edits
* @param deleteBuffer whether to delete editing buffer (added in 1.9)
*/
bool rollBack( bool deleteBuffer = true );

/**get edit type*/
EditType editType( int idx );

0 comments on commit 8feb84a

Please sign in to comment.