##// END OF EJS Templates
Handle selection of trash and repository items
trabillard -
r1289:f48f3e7d295f
parent child
Show More
@@ -42,6 +42,7 public:
42 public slots:
42 public slots:
43 void populateWithCatalogues(const QVector<std::shared_ptr<DBCatalogue> > &catalogues);
43 void populateWithCatalogues(const QVector<std::shared_ptr<DBCatalogue> > &catalogues);
44 void populateWithAllEvents();
44 void populateWithAllEvents();
45 void clear();
45 void refresh();
46 void refresh();
46
47
47 private:
48 private:
@@ -293,6 +293,8 CatalogueEventsWidget::CatalogueEventsWidget(QWidget *parent)
293 setEventChanges(event, impl->m_Model->eventsHasChanges(event));
293 setEventChanges(event, impl->m_Model->eventsHasChanges(event));
294 }
294 }
295 });
295 });
296
297 populateWithAllEvents();
296 }
298 }
297
299
298 CatalogueEventsWidget::~CatalogueEventsWidget()
300 CatalogueEventsWidget::~CatalogueEventsWidget()
@@ -345,7 +347,7 QVector<std::shared_ptr<DBCatalogue> > CatalogueEventsWidget::displayedCatalogue
345
347
346 bool CatalogueEventsWidget::isAllEventsDisplayed() const
348 bool CatalogueEventsWidget::isAllEventsDisplayed() const
347 {
349 {
348 return impl->m_DisplayedCatalogues.isEmpty();
350 return impl->m_DisplayedCatalogues.isEmpty() && !impl->m_Model->events().isEmpty();
349 }
351 }
350
352
351 bool CatalogueEventsWidget::isEventDisplayed(const std::shared_ptr<DBEvent> &event) const
353 bool CatalogueEventsWidget::isEventDisplayed(const std::shared_ptr<DBEvent> &event) const
@@ -388,6 +390,12 void CatalogueEventsWidget::populateWithAllEvents()
388 impl->setEvents(events, ui->treeView);
390 impl->setEvents(events, ui->treeView);
389 }
391 }
390
392
393 void CatalogueEventsWidget::clear()
394 {
395 impl->m_DisplayedCatalogues.clear();
396 impl->setEvents({}, ui->treeView);
397 }
398
391 void CatalogueEventsWidget::refresh()
399 void CatalogueEventsWidget::refresh()
392 {
400 {
393 if (impl->m_DisplayedCatalogues.isEmpty()) {
401 if (impl->m_DisplayedCatalogues.isEmpty()) {
@@ -42,16 +42,29 CatalogueExplorer::CatalogueExplorer(QWidget *parent)
42 ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
42 ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
43 });
43 });
44
44
45 connect(ui->catalogues, &CatalogueSideBarWidget::trashSelected,
45 connect(ui->catalogues, &CatalogueSideBarWidget::trashSelected, [this]() {
46 [this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); });
46 ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
47 ui->events->clear();
48 });
47
49
48 connect(ui->catalogues, &CatalogueSideBarWidget::allEventsSelected, [this]() {
50 connect(ui->catalogues, &CatalogueSideBarWidget::allEventsSelected, [this]() {
49 ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
51 ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
50 ui->events->populateWithAllEvents();
52 ui->events->populateWithAllEvents();
51 });
53 });
52
54
53 connect(ui->catalogues, &CatalogueSideBarWidget::selectionCleared,
55 connect(ui->catalogues, &CatalogueSideBarWidget::databaseSelected, [this](auto databaseList) {
54 [this]() { ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty); });
56 QVector<std::shared_ptr<DBCatalogue> > catalogueList;
57 for (auto database : databaseList) {
58 catalogueList.append(ui->catalogues->getCatalogues(database));
59 }
60 ui->events->populateWithCatalogues(catalogueList);
61 ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
62 });
63
64 connect(ui->catalogues, &CatalogueSideBarWidget::selectionCleared, [this]() {
65 ui->inspector->showPage(CatalogueInspectorWidget::Page::Empty);
66 ui->events->clear();
67 });
55
68
56 connect(ui->events, &CatalogueEventsWidget::eventsSelected, [this](auto events) {
69 connect(ui->events, &CatalogueEventsWidget::eventsSelected, [this](auto events) {
57 if (events.count() == 1) {
70 if (events.count() == 1) {
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