Commit 8d437dd4 authored by Marco Bubke's avatar Marco Bubke

QmlDesigner: Add rollback function to the RewriterTransaction class

Change-Id: I04874043eb04bd3f2cbf330186bb2105ed7ac82b
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent 4ac93806
......@@ -29,6 +29,8 @@
#include "rewritertransaction.h"
#include <abstractview.h>
#include <designdocument.h>
#include <qmldesignerplugin.h>
namespace QmlDesigner {
......@@ -61,6 +63,16 @@ void RewriterTransaction::commit()
}
}
void RewriterTransaction::rollback()
{
// TODO: should be implemented with a function in the rewriter
if (m_valid) {
m_valid = false;
view()->emitRewriterEndTransaction();
QmlDesignerPlugin::instance()->currentDesignDocument()->undo();
}
}
AbstractView *RewriterTransaction::view()
{
return m_view.data();
......
......@@ -45,6 +45,7 @@ public:
RewriterTransaction(AbstractView *view);
~RewriterTransaction();
void commit();
void rollback();
RewriterTransaction(const RewriterTransaction &other);
RewriterTransaction& operator=(const RewriterTransaction &other);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment