diff --git a/src/gui/reports/ReportsWidgetHealthcheck.cpp b/src/gui/reports/ReportsWidgetHealthcheck.cpp index 286869f0a6..a0a275987f 100644 --- a/src/gui/reports/ReportsWidgetHealthcheck.cpp +++ b/src/gui/reports/ReportsWidgetHealthcheck.cpp @@ -202,14 +202,29 @@ void ReportsWidgetHealthcheck::showEvent(QShowEvent* event) void ReportsWidgetHealthcheck::calculateHealth() { + m_referencesModel->clear(); + const QScopedPointer health(AsyncTask::runAndWaitForFuture([this] { return new Health(m_db); })); + if (health->items().empty()) { - m_referencesModel->clear(); - m_referencesModel->setHorizontalHeaderLabels(QStringList() << tr("") << tr("Title") << tr("Path") << tr("Reason")); + // No findings + m_referencesModel->clear(); + m_referencesModel->setHorizontalHeaderLabels(QStringList() << tr("Title")); + auto row = QList(); + row << new QStandardItem(tr("Congratulations, everything is healthy!")); + m_referencesModel->appendRow(row); - m_row2entry.clear(); - for (const auto& item : health->items()) { - addHealthRow(item.health, *item.group, *item.entry); + QBrush brush("green"); + m_referencesModel->item(0, 0)->setForeground(brush); + + } else { + + // Show our findings + m_referencesModel->setHorizontalHeaderLabels(QStringList() + << tr("") << tr("Title") << tr("Path") << tr("Reason")); + for (const auto& item : health->items()) { + addHealthRow(item.health, *item.group, *item.entry); + } } m_ui->healthcheckTableView->resizeRowsToContents();