diff --git a/src/Gui/DlgUndoRedo.cpp b/src/Gui/DlgUndoRedo.cpp index f746c8afe4..b7a6b0f125 100644 --- a/src/Gui/DlgUndoRedo.cpp +++ b/src/Gui/DlgUndoRedo.cpp @@ -58,20 +58,20 @@ UndoDialog::~UndoDialog() void UndoDialog::onFetchInfo() { clear(); // Remove first all items - Gui::Document* pcDoc = Application::Instance->activeDocument(); - if (pcDoc) - { - std::vector vecUndos = pcDoc->getUndoVector(); - for (std::vector::iterator i=vecUndos.begin(); i!=vecUndos.end(); ++i) - addAction(QString::fromUtf8((*i).c_str()), this, SLOT(onSelected())); + + MDIView* mdi = getMainWindow()->activeWindow(); + EditorView* view = qobject_cast(mdi); + if (view) { + QStringList vecUndos = view->undoActions(); + for (QStringList::Iterator i = vecUndos.begin(); i != vecUndos.end(); ++i) + addAction(*i, this, SLOT(onSelected())); } - else - { - EditorView* view = qobject_cast(getMainWindow()->activeWindow()); - if (view) { - QStringList vecUndos = view->undoActions(); - for (QStringList::Iterator i=vecUndos.begin(); i!=vecUndos.end(); ++i) - addAction(*i, this, SLOT(onSelected())); + else if (mdi) { + Gui::Document* pcDoc = mdi->getGuiDocument(); + if (pcDoc) { + std::vector vecUndos = pcDoc->getUndoVector(); + for (std::vector::iterator i = vecUndos.begin(); i != vecUndos.end(); ++i) + addAction(QString::fromUtf8((*i).c_str()), this, SLOT(onSelected())); } } } @@ -115,20 +115,20 @@ RedoDialog::~RedoDialog() void RedoDialog::onFetchInfo() { clear(); // Remove first all items - Gui::Document* pcDoc = Application::Instance->activeDocument(); - if (pcDoc) - { - std::vector vecRedos = pcDoc->getRedoVector(); - for (std::vector::iterator i=vecRedos.begin(); i!=vecRedos.end(); ++i) - addAction(QString::fromUtf8((*i).c_str()), this, SLOT(onSelected())); + + MDIView* mdi = getMainWindow()->activeWindow(); + EditorView* view = qobject_cast(mdi); + if (view) { + QStringList vecRedos = view->redoActions(); + for (QStringList::Iterator i = vecRedos.begin(); i != vecRedos.end(); ++i) + addAction(*i, this, SLOT(onSelected())); } - else - { - EditorView* view = qobject_cast(getMainWindow()->activeWindow()); - if (view) { - QStringList vecRedos = view->redoActions(); - for (QStringList::Iterator i=vecRedos.begin(); i!=vecRedos.end(); ++i) - addAction(*i, this, SLOT(onSelected())); + else if (mdi) { + Gui::Document* pcDoc = mdi->getGuiDocument(); + if (pcDoc) { + std::vector vecRedos = pcDoc->getRedoVector(); + for (std::vector::iterator i = vecRedos.begin(); i != vecRedos.end(); ++i) + addAction(QString::fromUtf8((*i).c_str()), this, SLOT(onSelected())); } } }