0000789: Sketcher active in one document blocks closing another.

This commit is contained in:
wmayer 2012-07-11 17:24:53 +02:00
parent 70bb37ab9d
commit 6efe6ff0cb
3 changed files with 13 additions and 9 deletions

View File

@ -930,13 +930,16 @@ bool Document::canClose ()
return false; return false;
} }
else if (!Gui::Control().isAllowedAlterDocument()) { else if (!Gui::Control().isAllowedAlterDocument()) {
QMessageBox::warning(getActiveView(), std::string name = Gui::Control().activeDialog()->getDocumentName();
QObject::tr("Document not closable"), if (name == this->getDocument()->getName()) {
QObject::tr("The document is in editing mode and thus cannot be closed for the moment.\n" QMessageBox::warning(getActiveView(),
"You either have to finish or cancel the editing in the task panel.")); QObject::tr("Document not closable"),
Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog(); QObject::tr("The document is in editing mode and thus cannot be closed for the moment.\n"
if (dlg) Gui::Control().showDialog(dlg); "You either have to finish or cancel the editing in the task panel."));
return false; Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog();
if (dlg) Gui::Control().showDialog(dlg);
return false;
}
} }
if (!isModified()) if (!isModified())

View File

@ -67,6 +67,8 @@ public:
virtual void modifyStandardButtons(QDialogButtonBox*) virtual void modifyStandardButtons(QDialogButtonBox*)
{} {}
const std::string& getDocumentName() const
{ return documentName; }
virtual bool isAllowedAlterDocument(void) const virtual bool isAllowedAlterDocument(void) const
{ return false; } { return false; }
virtual bool isAllowedAlterView(void) const virtual bool isAllowedAlterView(void) const
@ -92,6 +94,7 @@ protected:
/// List of TaskBoxes of that dialog /// List of TaskBoxes of that dialog
std::vector<QWidget*> Content; std::vector<QWidget*> Content;
ButtonPosition pos; ButtonPosition pos;
std::string documentName;
}; };
} //namespace TaskView } //namespace TaskView

View File

@ -65,8 +65,6 @@ public:
protected: protected:
ViewProviderSketch *sketchView; ViewProviderSketch *sketchView;
std::string documentName;
TaskSketcherConstrains *Constraints; TaskSketcherConstrains *Constraints;
TaskSketcherGeneral *General; TaskSketcherGeneral *General;
TaskSketcherMessages *Messages; TaskSketcherMessages *Messages;