##// END OF EJS Templates
Remove Event from Catalogue only unreferenced them
perrinel -
r1366:fdf0baf1b82b
parent child
Show More
@@ -384,17 +384,30 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent)
384 384
385 385 if (!events.isEmpty() && eventProducts.isEmpty()) {
386 386
387 if (QMessageBox::warning(this, tr("Remove Event(s)"),
388 tr("The selected event(s) will be permanently removed "
389 "from the repository!\nAre you sure you want to continue?"),
390 QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
391 == QMessageBox::Yes) {
392
387 auto canRemoveEvent
388 = !this->isAllEventsDisplayed()
389 || (QMessageBox::warning(
390 this, tr("Remove Event(s)"),
391 tr("The selected event(s) will be permanently removed "
392 "from the repository!\nAre you sure you want to continue?"),
393 QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
394 == QMessageBox::Yes);
395
396 if (canRemoveEvent) {
393 397 for (auto event : events) {
394 sqpApp->catalogueController().removeEvent(event);
395 impl->removeEvent(event, ui->treeView);
398 if (this->isAllEventsDisplayed()) {
399 impl->removeEvent(event, ui->treeView);
400 }
401 else {
402 for (auto catalogue : this->displayedCatalogues()) {
403 catalogue->removeEvent(event->getUniqId());
404 sqpApp->catalogueController().updateCatalogue(catalogue);
405 }
406 }
407 impl->m_Model->removeEvent(event);
396 408 }
397 409
410
398 411 emit this->eventsRemoved(events);
399 412 }
400 413 }
General Comments 0
You need to be logged in to leave comments. Login now