Fixes several undo/redo issues with the attachment dialog
This commit is contained in:
@@ -1073,9 +1073,7 @@ TaskDlgAttacher::~TaskDlgAttacher() = default;
|
||||
|
||||
void TaskDlgAttacher::open()
|
||||
{
|
||||
Gui::Document* document = Gui::Application::Instance->getDocument(ViewProvider->getObject()->getDocument());
|
||||
if (!document->hasPendingCommand())
|
||||
document->openCommand(QT_TRANSLATE_NOOP("Command", "Edit attachment"));
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Edit attachment"));
|
||||
}
|
||||
|
||||
void TaskDlgAttacher::clicked(int)
|
||||
@@ -1113,7 +1111,7 @@ bool TaskDlgAttacher::accept()
|
||||
Gui::cmdAppObject(obj, "recompute()");
|
||||
|
||||
Gui::cmdGuiDocument(obj, "resetEdit()");
|
||||
document->commitCommand();
|
||||
Gui::Command::commitCommand();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
QMessageBox::warning(parameter, tr("Datum dialog: Input error"), QCoreApplication::translate("Exception", e.what()));
|
||||
@@ -1129,7 +1127,7 @@ bool TaskDlgAttacher::reject()
|
||||
Gui::Document* document = doc.getDocument();
|
||||
if (document) {
|
||||
// roll back the done things
|
||||
document->abortCommand();
|
||||
Gui::Command::abortCommand();
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"%s.resetEdit()", doc.getGuiDocumentPython().c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"%s.recompute()", doc.getAppDocumentPython().c_str());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user