##// END OF EJS Templates
Remove Event from Catalogue only unreferenced them
perrinel -
r1366:fdf0baf1b82b
parent child
Show More
@@ -384,16 +384,29 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 = !this->isAllEventsDisplayed()
389 || (QMessageBox::warning(
390 this, tr("Remove Event(s)"),
388 tr("The selected event(s) will be permanently removed "
391 tr("The selected event(s) will be permanently removed "
389 "from the repository!\nAre you sure you want to continue?"),
392 "from the repository!\nAre you sure you want to continue?"),
390 QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
393 QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
391 == QMessageBox::Yes) {
394 == QMessageBox::Yes);
392
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);
396 }
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);
408 }
409
397
410
398 emit this->eventsRemoved(events);
411 emit this->eventsRemoved(events);
399 }
412 }
General Comments 0
You need to be logged in to leave comments. Login now