Auto status change to "Under Review"
@@ -48,8 +48,9 public: | |||||
48 | void updateEventProduct(std::shared_ptr<DBEventProduct> eventProduct); |
|
48 | void updateEventProduct(std::shared_ptr<DBEventProduct> eventProduct); | |
49 | void removeEvent(std::shared_ptr<DBEvent> event); |
|
49 | void removeEvent(std::shared_ptr<DBEvent> event); | |
50 | // void trashEvent(std::shared_ptr<DBEvent> event); |
|
50 | // void trashEvent(std::shared_ptr<DBEvent> event); | |
51 |
// void restore( |
|
51 | // void restore(std::shared_ptr<DBEvent> event); | |
52 | void saveEvent(std::shared_ptr<DBEvent> event); |
|
52 | void saveEvent(std::shared_ptr<DBEvent> event); | |
|
53 | void discardEvent(std::shared_ptr<DBEvent> event); | |||
53 | bool eventHasChanges(std::shared_ptr<DBEvent> event) const; |
|
54 | bool eventHasChanges(std::shared_ptr<DBEvent> event) const; | |
54 |
|
55 | |||
55 | // Catalogue |
|
56 | // Catalogue |
@@ -191,6 +191,26 void CatalogueController::saveEvent(std::shared_ptr<DBEvent> event) | |||||
191 | impl->m_EventKeysWithChanges.remove(impl->eventUniqueKey(event)); |
|
191 | impl->m_EventKeysWithChanges.remove(impl->eventUniqueKey(event)); | |
192 | } |
|
192 | } | |
193 |
|
193 | |||
|
194 | void CatalogueController::discardEvent(std::shared_ptr<DBEvent> event) | |||
|
195 | { | |||
|
196 | auto uniqIdPredicate = std::make_shared<ComparaisonPredicate>( | |||
|
197 | QString{"uniqId"}, event->getUniqId(), ComparaisonOperation::EQUALEQUAL); | |||
|
198 | ||||
|
199 | auto repositoryPredicate = std::make_shared<ComparaisonPredicate>( | |||
|
200 | QString{"repository"}, impl->toSyncRepository(event->getRepository()), | |||
|
201 | ComparaisonOperation::EQUALEQUAL); | |||
|
202 | ||||
|
203 | auto compCompoundPred = std::make_shared<CompoundPredicate>(CompoundOperation::AND); | |||
|
204 | compCompoundPred->AddRequestPredicate(uniqIdPredicate); | |||
|
205 | compCompoundPred->AddRequestPredicate(repositoryPredicate); | |||
|
206 | ||||
|
207 | ||||
|
208 | auto syncEvent = impl->m_CatalogueDao.getEvent(compCompoundPred); | |||
|
209 | impl->m_CatalogueDao.copyEvent(syncEvent, impl->toWorkRepository(event->getRepository()), true); | |||
|
210 | *event = syncEvent; | |||
|
211 | impl->m_EventKeysWithChanges.remove(impl->eventUniqueKey(event)); | |||
|
212 | } | |||
|
213 | ||||
194 | bool CatalogueController::eventHasChanges(std::shared_ptr<DBEvent> event) const |
|
214 | bool CatalogueController::eventHasChanges(std::shared_ptr<DBEvent> event) const | |
195 | { |
|
215 | { | |
196 | return impl->m_EventKeysWithChanges.contains(impl->eventUniqueKey(event)); |
|
216 | return impl->m_EventKeysWithChanges.contains(impl->eventUniqueKey(event)); | |
@@ -297,8 +317,8 CatalogueController::eventsForMimeData(const QByteArray &mimeData) const | |||||
297 |
|
317 | |||
298 | void CatalogueController::initialize() |
|
318 | void CatalogueController::initialize() | |
299 | { |
|
319 | { | |
300 | qCDebug(LOG_CatalogueController()) |
|
320 | qCDebug(LOG_CatalogueController()) << tr("CatalogueController init") | |
301 | << tr("CatalogueController init") << QThread::currentThread(); |
|
321 | << QThread::currentThread(); | |
302 |
|
322 | |||
303 | impl->m_CatalogueDao.initialize(); |
|
323 | impl->m_CatalogueDao.initialize(); | |
304 | auto defaultRepositoryLocation |
|
324 | auto defaultRepositoryLocation |
@@ -371,7 +371,11 void CatalogueEventsWidget::setEventChanges(const std::shared_ptr<DBEvent> &even | |||||
371 | sqpApp->catalogueController().saveEvent(event); |
|
371 | sqpApp->catalogueController().saveEvent(event); | |
372 | setEventChanges(event, false); |
|
372 | setEventChanges(event, false); | |
373 | }, |
|
373 | }, | |
374 |
[this, event]() { |
|
374 | [this, event]() { | |
|
375 | sqpApp->catalogueController().discardEvent(event); | |||
|
376 | setEventChanges(event, false); | |||
|
377 | impl->m_Model->refreshEvent(event); | |||
|
378 | }); | |||
375 | ui->treeView->setIndexWidget(validationIndex, widget); |
|
379 | ui->treeView->setIndexWidget(validationIndex, widget); | |
376 | } |
|
380 | } | |
377 | } |
|
381 | } |
@@ -315,10 +315,8 void CatalogueSideBarWidget::CatalogueSideBarWidgetPrivate::setHasChanges(bool v | |||||
315 | if (value) { |
|
315 | if (value) { | |
316 | if (!hasChanges(validationIndex, treeView)) { |
|
316 | if (!hasChanges(validationIndex, treeView)) { | |
317 | auto widget = CatalogueExplorerHelper::buildValidationWidget( |
|
317 | auto widget = CatalogueExplorerHelper::buildValidationWidget( | |
318 | treeView, |
|
318 | treeView, [this, validationIndex, | |
319 |
|
|
319 | treeView]() { setHasChanges(false, validationIndex, treeView); }, | |
320 | setHasChanges(false, validationIndex, treeView); |
|
|||
321 | }, |
|
|||
322 | [this, validationIndex, treeView]() { |
|
320 | [this, validationIndex, treeView]() { | |
323 | setHasChanges(false, validationIndex, treeView); |
|
321 | setHasChanges(false, validationIndex, treeView); | |
324 | }); |
|
322 | }); |
General Comments 3
Status change > Approved
You need to be logged in to leave comments.
Login now