From caf8a4516a83104cd9aca547d9132106e837ce0f Mon Sep 17 00:00:00 2001
From: Thomas Hartmann <Thomas.Hartmann@nokia.com>
Date: Tue, 2 Mar 2010 12:15:53 +0100
Subject: [PATCH] QmlDesigner.propertyEditor: adding new files

---
 .../propertyeditortransaction.cpp             | 34 +++++++++++++++++++
 .../propertyeditortransaction.h               | 27 +++++++++++++++
 2 files changed, 61 insertions(+)
 create mode 100644 src/plugins/qmldesigner/components/propertyeditor/propertyeditortransaction.cpp
 create mode 100644 src/plugins/qmldesigner/components/propertyeditor/propertyeditortransaction.h

diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditortransaction.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditortransaction.cpp
new file mode 100644
index 00000000000..9b94842ccdd
--- /dev/null
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditortransaction.cpp
@@ -0,0 +1,34 @@
+#include "propertyeditortransaction.h"
+
+#include <QDebug>
+
+namespace QmlDesigner {
+
+PropertyEditorTransaction::PropertyEditorTransaction(QmlDesigner::PropertyEditor *propertyEditor) : QObject(propertyEditor), m_propertyEditor(propertyEditor)
+{
+}
+
+void PropertyEditorTransaction::start()
+{
+    if (m_rewriterTransaction.isValid())
+        m_rewriterTransaction.commit();
+    m_rewriterTransaction = m_propertyEditor->beginRewriterTransaction();
+    startTimer(4000);
+}
+
+void PropertyEditorTransaction::end()
+{
+    if (m_rewriterTransaction.isValid())
+        m_rewriterTransaction.commit();
+}
+
+void PropertyEditorTransaction::timerEvent(QTimerEvent *timerEvent)
+{
+    qDebug() << "timer";
+    killTimer(timerEvent->timerId());
+    if (m_rewriterTransaction.isValid())
+        m_rewriterTransaction.commit();
+}
+
+} //QmlDesigner
+
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditortransaction.h b/src/plugins/qmldesigner/components/propertyeditor/propertyeditortransaction.h
new file mode 100644
index 00000000000..84b96f35b78
--- /dev/null
+++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditortransaction.h
@@ -0,0 +1,27 @@
+#ifndef PROPERTYEDITORTRANSACTION_H
+#define PROPERTYEDITORTRANSACTION_H
+
+#include "propertyeditor.h"
+
+namespace QmlDesigner {
+
+class PropertyEditorTransaction : public QObject
+{
+    Q_OBJECT
+public:
+    PropertyEditorTransaction(QmlDesigner::PropertyEditor *propertyEditor);
+
+public slots:
+    void start();
+    void end();
+protected:
+     void timerEvent(QTimerEvent *event);
+
+private:
+    QmlDesigner::PropertyEditor *m_propertyEditor;
+    QmlDesigner::RewriterTransaction m_rewriterTransaction;
+};
+
+} //QmlDesigner
+
+#endif // PROPERTYEDITORTRANSACTION_H
-- 
GitLab