Commit 1714e06f authored by Ralf Habacker's avatar Ralf Habacker

Disable undo while code importing to not pollute the undo stack.

CCBUG: 329648
(cherry picked from commit fd26bdd2)
parent e575ade1
......@@ -49,6 +49,7 @@
CodeImpStatusPage::CodeImpStatusPage(QWidget *parent)
: QWizardPage(parent),
m_workDone(false),
m_savedUndoEnabled(false),
m_index(0),
m_savedlistViewVisible(false)
#ifdef ENABLE_IMPORT_THREAD
......@@ -137,6 +138,9 @@ void CodeImpStatusPage::importCode()
ui_textEditLogger->setHtml(i18np("<b>Code import of 1 file:</b><br>", "<b>Code import of %1 files:</b><br>", m_files.size()));
m_index = 0;
m_workDone = false;
m_savedUndoEnabled = UMLApp::app()->isUndoEnabled();
UMLApp::app()->enableUndo(false);
#ifdef ENABLE_IMPORT_THREAD
m_thread = new QThread;
//connect(thread, SIGNAL(started()), this, SLOT(importCodeFile()));
......@@ -195,6 +199,9 @@ void CodeImpStatusPage::importNextFile(bool noError)
void CodeImpStatusPage::importCodeFinish()
{
UMLDoc* doc = UMLApp::app()->document();
UMLApp::app()->enableUndo(m_savedUndoEnabled);
doc->setLoading(false);
// Modification is set after the import is made, because the file was modified when adding the classes.
// Allowing undo of the whole class importing. I think it eats a lot of memory.
......@@ -229,6 +236,8 @@ void CodeImpStatusPage::importCodeStop()
messageToLog(m_file.fileName(), i18n("importing file ... stopped<br>"));
updateStatus(m_file.fileName(), i18n("Import stopped"));
UMLApp::app()->enableUndo(m_savedUndoEnabled);
UMLDoc* doc = UMLApp::app()->document();
doc->setLoading(false);
// Modification is set after the import is made, because the file was modified when adding the classes.
......
......@@ -53,6 +53,7 @@ public:
private:
QList<QFileInfo> m_files; ///< list of files to import
bool m_workDone;
bool m_savedUndoEnabled; ///< saved undo enabled state
int m_index; ///< index in m_files
QFileInfo m_file; ///< current file
bool m_savedlistViewVisible; ///< indicates previous state of list view
......
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