diff --git a/src/Gui/Document.cpp b/src/Gui/Document.cpp index 7d6562911..972d9d148 100644 --- a/src/Gui/Document.cpp +++ b/src/Gui/Document.cpp @@ -930,13 +930,16 @@ bool Document::canClose () return false; } else if (!Gui::Control().isAllowedAlterDocument()) { - QMessageBox::warning(getActiveView(), - QObject::tr("Document not closable"), - QObject::tr("The document is in editing mode and thus cannot be closed for the moment.\n" - "You either have to finish or cancel the editing in the task panel.")); - Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog(); - if (dlg) Gui::Control().showDialog(dlg); - return false; + std::string name = Gui::Control().activeDialog()->getDocumentName(); + if (name == this->getDocument()->getName()) { + QMessageBox::warning(getActiveView(), + QObject::tr("Document not closable"), + QObject::tr("The document is in editing mode and thus cannot be closed for the moment.\n" + "You either have to finish or cancel the editing in the task panel.")); + Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog(); + if (dlg) Gui::Control().showDialog(dlg); + return false; + } } if (!isModified()) diff --git a/src/Gui/TaskView/TaskDialog.h b/src/Gui/TaskView/TaskDialog.h index 30dc84ddc..f6a0e402f 100644 --- a/src/Gui/TaskView/TaskDialog.h +++ b/src/Gui/TaskView/TaskDialog.h @@ -67,6 +67,8 @@ public: virtual void modifyStandardButtons(QDialogButtonBox*) {} + const std::string& getDocumentName() const + { return documentName; } virtual bool isAllowedAlterDocument(void) const { return false; } virtual bool isAllowedAlterView(void) const @@ -92,6 +94,7 @@ protected: /// List of TaskBoxes of that dialog std::vector Content; ButtonPosition pos; + std::string documentName; }; } //namespace TaskView diff --git a/src/Mod/Sketcher/Gui/TaskDlgEditSketch.h b/src/Mod/Sketcher/Gui/TaskDlgEditSketch.h index 506bf98d2..79e2f77e1 100644 --- a/src/Mod/Sketcher/Gui/TaskDlgEditSketch.h +++ b/src/Mod/Sketcher/Gui/TaskDlgEditSketch.h @@ -65,8 +65,6 @@ public: protected: ViewProviderSketch *sketchView; - std::string documentName; - TaskSketcherConstrains *Constraints; TaskSketcherGeneral *General; TaskSketcherMessages *Messages;