mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-25 15:29:44 -05:00
Fix issues with HIBP report
* Show horizontal header in results table * Correctly handle the case when there are no entries to analyze * Make countToText static
This commit is contained in:
parent
f0709d187d
commit
ab9856ee88
@ -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<QPair<const Entry*, int>> 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());
|
||||
|
@ -62,7 +62,7 @@ public slots:
|
||||
private:
|
||||
void makeHibpTable();
|
||||
void startValidation();
|
||||
QString countToText(int count);
|
||||
static QString countToText(int count);
|
||||
|
||||
QScopedPointer<Ui::ReportsWidgetHibp> m_ui;
|
||||
QScopedPointer<QStandardItemModel> m_referencesModel;
|
||||
|
@ -135,9 +135,6 @@
|
||||
<property name="sortingEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
|
Loading…
Reference in New Issue
Block a user