Show question dialog to ask user to continue when deleting an object

This commit is contained in:
wmayer 2013-05-25 14:01:15 +02:00
parent 152d2b895f
commit ff031ec4c6

View File

@ -1050,6 +1050,15 @@ void StdCmdDelete::activated(int iMsg)
} }
} }
if (!doDeletion) {
int ret = QMessageBox::question(Gui::getMainWindow(),
qApp->translate("Std_Delete", "Object dependencies"),
qApp->translate("Std_Delete", "This object is referenced by other objects and thus these objects might get broken.\n"
"Are you sure to continue?"),
QMessageBox::Yes, QMessageBox::No);
if (ret == QMessageBox::Yes)
doDeletion = true;
}
if (doDeletion) { if (doDeletion) {
(*it)->openTransaction("Delete"); (*it)->openTransaction("Delete");
for (std::vector<Gui::SelectionObject>::iterator ft = sel.begin(); ft != sel.end(); ++ft) { for (std::vector<Gui::SelectionObject>::iterator ft = sel.begin(); ft != sel.end(); ++ft) {
@ -1063,11 +1072,6 @@ void StdCmdDelete::activated(int iMsg)
} }
(*it)->commitTransaction(); (*it)->commitTransaction();
} }
else {
QMessageBox::warning(Gui::getMainWindow(),
qApp->translate("Std_Delete", "Object dependencies"),
qApp->translate("Std_Delete", "This object is referenced by other objects and thus cannot be deleted."));
}
} }
} }
} }