diff --git a/src/gui/reports/ReportsWidgetHibp.cpp b/src/gui/reports/ReportsWidgetHibp.cpp index 1c625d131..d4c3e447b 100644 --- a/src/gui/reports/ReportsWidgetHibp.cpp +++ b/src/gui/reports/ReportsWidgetHibp.cpp @@ -76,9 +76,18 @@ void ReportsWidgetHibp::makeHibpTable() { // Reset the table m_referencesModel->clear(); - m_referencesModel->setHorizontalHeaderLabels(QStringList() << tr("Title") << tr("Path") << tr("Password exposed…")); m_rowToEntry.clear(); + // If there were no findings, display a motivational message + if (m_pwndPasswords.isEmpty() && m_error.isEmpty()) { + m_referencesModel->setHorizontalHeaderLabels(QStringList() << tr("Congratulations, no exposed passwords!")); + m_ui->stackedWidget->setCurrentIndex(1); + return; + } + + // Standard header labels for found issues + m_referencesModel->setHorizontalHeaderLabels(QStringList() << tr("Title") << tr("Path") << tr("Password exposed…")); + // Search database for passwords that we've found so far QList> items; for (const auto* entry : m_db->rootGroup()->entriesRecursive()) { @@ -120,14 +129,6 @@ void ReportsWidgetHibp::makeHibpTable() row[0]->setForeground(QBrush(QColor("red"))); } - // If we're done and everything is good, display a motivational message -#ifdef WITH_XC_NETWORKING - if (m_downloader.passwordsRemaining() == 0 && m_pwndPasswords.isEmpty() && m_error.isEmpty()) { - m_referencesModel->clear(); - m_referencesModel->setHorizontalHeaderLabels(QStringList() << tr("Congratulations, no exposed passwords!")); - } -#endif - m_ui->hibpTableView->resizeRowsToContents(); m_ui->stackedWidget->setCurrentIndex(1); @@ -182,6 +183,12 @@ void ReportsWidgetHibp::startValidation() } } + // Short circuit if we didn't actually add any passwords + if (m_downloader.passwordsToValidate() == 0) { + makeHibpTable(); + return; + } + // Store the number of passwords we need to check for the progress bar m_ui->progressBar->show(); m_ui->progressBar->setMaximum(m_downloader.passwordsToValidate()); diff --git a/src/gui/reports/ReportsWidgetHibp.h b/src/gui/reports/ReportsWidgetHibp.h index b49ef082e..cd8456121 100644 --- a/src/gui/reports/ReportsWidgetHibp.h +++ b/src/gui/reports/ReportsWidgetHibp.h @@ -62,7 +62,7 @@ public slots: private: void makeHibpTable(); void startValidation(); - QString countToText(int count); + static QString countToText(int count); QScopedPointer m_ui; QScopedPointer m_referencesModel; diff --git a/src/gui/reports/ReportsWidgetHibp.ui b/src/gui/reports/ReportsWidgetHibp.ui index e3eccfd34..bda5da6fd 100644 --- a/src/gui/reports/ReportsWidgetHibp.ui +++ b/src/gui/reports/ReportsWidgetHibp.ui @@ -135,9 +135,6 @@ false - - false - true