##// END OF EJS Templates
Add saveEvent action
perrinel -
r1280:17a909168f5d
parent child
Show More
@@ -270,24 +270,15 void CatalogueController::waitForFinish()
270 void CatalogueController::CatalogueControllerPrivate::copyDBtoDB(const QString &dbFrom,
270 void CatalogueController::CatalogueControllerPrivate::copyDBtoDB(const QString &dbFrom,
271 const QString &dbTo)
271 const QString &dbTo)
272 {
272 {
273 auto cataloguesShared = std::list<std::shared_ptr<DBCatalogue> >{};
273 // auto cataloguesShared = std::list<std::shared_ptr<DBCatalogue> >{};
274 auto catalogues = m_CatalogueDao.getCatalogues(dbFrom);
274 auto catalogues = m_CatalogueDao.getCatalogues(dbFrom);
275 auto events = m_CatalogueDao.getEvents(dbFrom);
275 for (auto catalogue : catalogues) {
276 for (auto catalogue : catalogues) {
276 cataloguesShared.push_back(std::make_shared<DBCatalogue>(catalogue));
277 m_CatalogueDao.copyCatalogue(catalogue, dbTo, true);
277 }
278 }
278
279
279 auto eventsShared = std::list<std::shared_ptr<DBEvent> >{};
280 auto events = m_CatalogueDao.getEvents(dbFrom);
281 for (auto event : events) {
280 for (auto event : events) {
282 eventsShared.push_back(std::make_shared<DBEvent>(event));
281 m_CatalogueDao.copyEvent(event, dbTo, true);
283 }
284
285 for (auto catalogue : cataloguesShared) {
286 m_CatalogueDao.copyCatalogue(*catalogue, dbTo, true);
287 }
288
289 for (auto event : eventsShared) {
290 m_CatalogueDao.copyEvent(*event, dbTo, true);
291 }
282 }
292 }
283 }
293
284
@@ -322,7 +313,7 void CatalogueController::CatalogueControllerPrivate::savAllDB()
322 void CatalogueController::CatalogueControllerPrivate::saveEvent(std::shared_ptr<DBEvent> event,
313 void CatalogueController::CatalogueControllerPrivate::saveEvent(std::shared_ptr<DBEvent> event,
323 bool persist)
314 bool persist)
324 {
315 {
325 m_CatalogueDao.moveEvent(*event, toSyncRepository(event->getRepository()), true);
316 m_CatalogueDao.copyEvent(*event, toSyncRepository(event->getRepository()), true);
326 if (persist) {
317 if (persist) {
327 savAllDB();
318 savAllDB();
328 }
319 }
@@ -331,7 +322,7 void CatalogueController::CatalogueControllerPrivate::saveEvent(std::shared_ptr<
331 void CatalogueController::CatalogueControllerPrivate::saveCatalogue(
322 void CatalogueController::CatalogueControllerPrivate::saveCatalogue(
332 std::shared_ptr<DBCatalogue> catalogue, bool persist)
323 std::shared_ptr<DBCatalogue> catalogue, bool persist)
333 {
324 {
334 m_CatalogueDao.moveCatalogue(*catalogue, toSyncRepository(catalogue->getRepository()), true);
325 m_CatalogueDao.copyCatalogue(*catalogue, toSyncRepository(catalogue->getRepository()), true);
335 if (persist) {
326 if (persist) {
336 savAllDB();
327 savAllDB();
337 }
328 }
@@ -315,7 +315,11 void CatalogueEventsWidget::setEventChanges(const std::shared_ptr<DBEvent> &even
315 if (hasChanges) {
315 if (hasChanges) {
316 if (ui->treeView->indexWidget(validationIndex) == nullptr) {
316 if (ui->treeView->indexWidget(validationIndex) == nullptr) {
317 auto widget = CatalogueExplorerHelper::buildValidationWidget(
317 auto widget = CatalogueExplorerHelper::buildValidationWidget(
318 ui->treeView, [this, event]() { setEventChanges(event, false); },
318 ui->treeView,
319 [this, event]() {
320 sqpApp->catalogueController().saveEvent(event);
321 setEventChanges(event, false);
322 },
319 [this, event]() { setEventChanges(event, false); });
323 [this, event]() { setEventChanges(event, false); });
320 ui->treeView->setIndexWidget(validationIndex, widget);
324 ui->treeView->setIndexWidget(validationIndex, widget);
321 }
325 }
General Comments 3
Under Review
author

Auto status change to "Under Review"

Approved
author

Status change > Approved

You need to be logged in to leave comments. Login now