Gui: [skip ci] when closing document via context-menu ask the user first how to continue

See also forum thread: https://forum.freecadweb.org/viewtopic.php?f=3&t=51746
This commit is contained in:
wmayer
2020-11-03 12:09:28 +01:00
parent 709c0b546f
commit 0324d2de64

View File

@@ -2209,13 +2209,16 @@ void TreeWidget::onReloadDoc() {
}
}
void TreeWidget::onCloseDoc() {
void TreeWidget::onCloseDoc()
{
if (!this->contextItem || this->contextItem->type() != DocumentType)
return;
DocumentItem* docitem = static_cast<DocumentItem*>(this->contextItem);
App::Document* doc = docitem->document()->getDocument();
try {
Command::doCommand(Command::Doc, "App.closeDocument(\"%s\")", doc->getName());
DocumentItem* docitem = static_cast<DocumentItem*>(this->contextItem);
Gui::Document* gui = docitem->document();
App::Document* doc = gui->getDocument();
if (gui->canClose(true, true))
Command::doCommand(Command::Doc, "App.closeDocument(\"%s\")", doc->getName());
} catch (const Base::Exception& e) {
e.ReportException();
} catch (std::exception &e) {