diff --git a/core/src/Catalogue/CatalogueController.cpp b/core/src/Catalogue/CatalogueController.cpp index ee018a0..b9e5743 100644 --- a/core/src/Catalogue/CatalogueController.cpp +++ b/core/src/Catalogue/CatalogueController.cpp @@ -290,6 +290,14 @@ void CatalogueController::saveCatalogue(std::shared_ptr catalogue) { impl->saveCatalogue(catalogue, true); impl->m_KeysWithChanges.remove(impl->catalogueUniqueKey(catalogue)); + + // remove key of events of the catalogue + if (catalogue->getType() == CatalogueType::STATIC) { + auto events = this->retrieveEventsFromCatalogue(catalogue); + for (auto event : events) { + impl->m_KeysWithChanges.remove(impl->eventUniqueKey(event)); + } + } } void CatalogueController::discardCatalogue(std::shared_ptr catalogue, bool &removed) diff --git a/gui/include/Catalogue/CatalogueEventsWidget.h b/gui/include/Catalogue/CatalogueEventsWidget.h index fad8d26..d9b6307 100644 --- a/gui/include/Catalogue/CatalogueEventsWidget.h +++ b/gui/include/Catalogue/CatalogueEventsWidget.h @@ -40,6 +40,7 @@ public: void addEvent(const std::shared_ptr &event); void setEventChanges(const std::shared_ptr &event, bool hasChanges); + void setEventsChanges(const std::shared_ptr &event, bool hasChanges); QVector > displayedCatalogues() const; bool isAllEventsDisplayed() const; diff --git a/gui/include/Catalogue/CatalogueSideBarWidget.h b/gui/include/Catalogue/CatalogueSideBarWidget.h index e3e0d0d..6259021 100644 --- a/gui/include/Catalogue/CatalogueSideBarWidget.h +++ b/gui/include/Catalogue/CatalogueSideBarWidget.h @@ -24,6 +24,7 @@ signals: void allEventsSelected(); void trashSelected(); void selectionCleared(); + void catalogueSaved(const std::shared_ptr &catalogue); public: explicit CatalogueSideBarWidget(QWidget *parent = 0); diff --git a/gui/src/Catalogue/CatalogueExplorer.cpp b/gui/src/Catalogue/CatalogueExplorer.cpp index 358c144..0065e6c 100644 --- a/gui/src/Catalogue/CatalogueExplorer.cpp +++ b/gui/src/Catalogue/CatalogueExplorer.cpp @@ -76,6 +76,9 @@ CatalogueExplorer::CatalogueExplorer(QWidget *parent) ui->events->clear(); }); + connect(ui->catalogues, &CatalogueSideBarWidget::catalogueSaved, ui->events, + &CatalogueEventsWidget::refresh); + // Updates the inspectot when something is selected in the events connect(ui->events, &CatalogueEventsWidget::eventsSelected, [this](auto events) { if (events.count() == 1) { diff --git a/gui/src/Catalogue/CatalogueSideBarWidget.cpp b/gui/src/Catalogue/CatalogueSideBarWidget.cpp index 8f2ffb0..724249d 100644 --- a/gui/src/Catalogue/CatalogueSideBarWidget.cpp +++ b/gui/src/Catalogue/CatalogueSideBarWidget.cpp @@ -394,6 +394,7 @@ void CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::setHasChanges( [this, validationIndex, sideBarWidget, catalogue]() { if (catalogue) { sqpApp->catalogueController().saveCatalogue(catalogue); + emit sideBarWidget->catalogueSaved(catalogue); } setHasChanges(false, validationIndex, sideBarWidget); },