##// 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 if (!events.isEmpty() && eventProducts.isEmpty()) {
385 if (!events.isEmpty() && eventProducts.isEmpty()) {
386
386
387 if (QMessageBox::warning(this, tr("Remove Event(s)"),
387 auto canRemoveEvent
388 tr("The selected event(s) will be permanently removed "
388 = !this->isAllEventsDisplayed()
389 "from the repository!\nAre you sure you want to continue?"),
389 || (QMessageBox::warning(
390 QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
390 this, tr("Remove Event(s)"),
391 == QMessageBox::Yes) {
391 tr("The selected event(s) will be permanently removed "
392
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 for (auto event : events) {
397 for (auto event : events) {
394 sqpApp->catalogueController().removeEvent(event);
398 if (this->isAllEventsDisplayed()) {
395 impl->removeEvent(event, ui->treeView);
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 emit this->eventsRemoved(events);
411 emit this->eventsRemoved(events);
399 }
412 }
400 }
413 }
General Comments 0
You need to be logged in to leave comments. Login now