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;
}
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())

View File

@ -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<QWidget*> Content;
ButtonPosition pos;
std::string documentName;
};
} //namespace TaskView

View File

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