From 6036e7fa7b8661cef8fcea307c7b8a6d0eb47fd7 Mon Sep 17 00:00:00 2001 From: Agoston Szepessy Date: Mon, 29 Dec 2025 21:14:26 -0800 Subject: [PATCH] Fix formatting --- src/gui/reports/ReportsWidgetBase.cpp | 56 ++++++++++--------- src/gui/reports/ReportsWidgetBase.h | 4 +- .../ReportsWidgetBrowserStatistics.cpp | 4 +- .../reports/ReportsWidgetBrowserStatistics.h | 2 +- src/gui/reports/ReportsWidgetHealthcheck.cpp | 6 +- src/gui/reports/ReportsWidgetHealthcheck.h | 2 +- src/gui/reports/ReportsWidgetHibp.cpp | 6 +- src/gui/reports/ReportsWidgetHibp.h | 2 +- src/gui/reports/ReportsWidgetPasskeys.cpp | 4 +- src/gui/reports/ReportsWidgetPasskeys.h | 2 +- tests/gui/TestGui.cpp | 12 ++-- 11 files changed, 53 insertions(+), 47 deletions(-) diff --git a/src/gui/reports/ReportsWidgetBase.cpp b/src/gui/reports/ReportsWidgetBase.cpp index cc2b3dc8c..3f3506b31 100644 --- a/src/gui/reports/ReportsWidgetBase.cpp +++ b/src/gui/reports/ReportsWidgetBase.cpp @@ -19,13 +19,13 @@ #include "core/Group.h" #include "core/Metadata.h" -#include "gui/Icons.h" #include "gui/GuiTools.h" +#include "gui/Icons.h" #include "gui/MessageBox.h" -#include #include #include +#include #include #include #include @@ -51,7 +51,8 @@ ReportsWidgetBase::ReportsWidgetBase(QWidget* parent, SortProxyModelKind proxyMo } ReportsWidgetBase::~ReportsWidgetBase() -{} +{ +} void ReportsWidgetBase::loadSettings(QSharedPointer db) { @@ -71,18 +72,18 @@ void ReportsWidgetBase::saveSettings() // save settings } -QMenu *ReportsWidgetBase::customMenuRequestedBase() +QMenu* ReportsWidgetBase::customMenuRequestedBase() { auto selected = getTableView()->selectionModel()->selectedRows(); if (selected.isEmpty()) { return nullptr; } - // Create the context menu + // Create the context menu const auto menu = new QMenu(this); menu->setObjectName("customMenu"); - // Create the "edit entry" menu item (only if 1 row is selected) + // Create the "edit entry" menu item (only if 1 row is selected) if (selected.size() == 1) { const auto edit = new QAction(icons()->icon("entry-edit"), tr("Edit Entry…"), this); edit->setObjectName("contextMenuEditAction"); @@ -94,21 +95,22 @@ QMenu *ReportsWidgetBase::customMenuRequestedBase() }); } - // Create the "Expire entry" menu item + // Create the "Expire entry" menu item const auto expEntry = new QAction(icons()->icon("entry-expire"), tr("Expire Entry(s)…", "", selected.size()), this); expEntry->setObjectName("contextMenuExpireAction"); menu->addAction(expEntry); connect(expEntry, &QAction::triggered, this, &ReportsWidgetBase::expireSelectedEntries); - // Create the "delete entry" menu item + // Create the "delete entry" menu item const auto delEntry = new QAction(icons()->icon("entry-delete"), tr("Delete Entry(s)…", "", selected.size()), this); menu->addAction(delEntry); connect(delEntry, &QAction::triggered, this, &ReportsWidgetBase::deleteSelectedEntries); - // Create the "exclude from reports" menu item + // Create the "exclude from reports" menu item const auto excludeAction = new QAction(icons()->icon("reports-exclude"), tr("Exclude Entry(s) from reports"), this); excludeAction->setObjectName("contextMenuExcludeAction"); - const auto excludeGroupsAction = new QAction(icons()->icon("reports-exclude"), tr("Exclude Group(s) from reports"), this); + const auto excludeGroupsAction = + new QAction(icons()->icon("reports-exclude"), tr("Exclude Group(s) from reports"), this); excludeGroupsAction->setObjectName("contextMenuxcludeGroupAction"); bool isExcluded = false; @@ -139,28 +141,32 @@ QMenu *ReportsWidgetBase::customMenuRequestedBase() connect(excludeAction, &QAction::toggled, excludeAction, [this, selected](bool checked) { QSet groups; - // If we are including entries (checked is false) but a group is excluded, ask the user if they - // would like to include the rest of the group as well (or keep it excluded). - // If they exclude it, we need to include the whole group, and then exclude - // the entries that aren't selected here. + // If we are including entries (checked is false) but a group is excluded, ask the user if they + // would like to include the rest of the group as well (or keep it excluded). + // If they exclude it, we need to include the whole group, and then exclude + // the entries that aren't selected here. if (!checked) { - for(const auto index : selected) { + for (const auto index : selected) { auto row = m_modelProxy->mapToSource(index).row(); auto entry = m_rowToEntry[row].second; if (entry) { - auto *group = entry->group(); + auto* group = entry->group(); if (group->excludeFromReports() && !groups.contains(group)) { - QString msg = tr("The Group for \"%1\" is excluded. Would you like to include all Entries from there as well?").arg(entry->title()); - auto response = MessageBox::question(this, tr("Include Group?"), msg, MessageBox::Yes | MessageBox::No | MessageBox::Cancel, MessageBox::No); + QString msg = tr("The Group for \"%1\" is excluded. Would you like to include all Entries from " + "there as well?") + .arg(entry->title()); + auto response = MessageBox::question(this, + tr("Include Group?"), + msg, + MessageBox::Yes | MessageBox::No | MessageBox::Cancel, + MessageBox::No); if (response == MessageBox::Cancel) { return; - } - else if (response == MessageBox::Yes) { + } else if (response == MessageBox::Yes) { group->setExcludeFromReports(false); - } - else if (response == MessageBox::No) { + } else if (response == MessageBox::No) { // We'll exclude all entries from the group here and then // include the selected ones below group->setExcludeFromReports(false); @@ -177,9 +183,9 @@ QMenu *ReportsWidgetBase::customMenuRequestedBase() auto row = m_modelProxy->mapToSource(index).row(); auto entry = m_rowToEntry[row].second; - // If the containing group is excluded but the user wants to include - // this entry, ask if they want to keep the remaining items in the group - // excluded or included + // If the containing group is excluded but the user wants to include + // this entry, ask if they want to keep the remaining items in the group + // excluded or included if (entry) { entry->setExcludeFromReports(checked); } diff --git a/src/gui/reports/ReportsWidgetBase.h b/src/gui/reports/ReportsWidgetBase.h index 89124fd2d..abb856435 100644 --- a/src/gui/reports/ReportsWidgetBase.h +++ b/src/gui/reports/ReportsWidgetBase.h @@ -47,10 +47,10 @@ public: virtual void saveSettings(); protected: - virtual QTableView *getTableView() const = 0; + virtual QTableView* getTableView() const = 0; virtual void updateWidget() = 0; - QMenu *customMenuRequestedBase(); + QMenu* customMenuRequestedBase(); QList getSelectedEntries() const; public slots: diff --git a/src/gui/reports/ReportsWidgetBrowserStatistics.cpp b/src/gui/reports/ReportsWidgetBrowserStatistics.cpp index a1eabed13..1e5d198cb 100644 --- a/src/gui/reports/ReportsWidgetBrowserStatistics.cpp +++ b/src/gui/reports/ReportsWidgetBrowserStatistics.cpp @@ -236,7 +236,7 @@ void ReportsWidgetBrowserStatistics::customMenuRequested(QPoint pos) { auto menu = customMenuRequestedBase(); - if(!menu) { + if (!menu) { return; } @@ -303,7 +303,7 @@ QMap ReportsWidgetBrowserStatistics::getBrowserConfigFromE return configList; } -QTableView *ReportsWidgetBrowserStatistics::getTableView() const +QTableView* ReportsWidgetBrowserStatistics::getTableView() const { return m_ui->browserStatisticsTableView; } diff --git a/src/gui/reports/ReportsWidgetBrowserStatistics.h b/src/gui/reports/ReportsWidgetBrowserStatistics.h index 9b17d221f..6ec8afb30 100644 --- a/src/gui/reports/ReportsWidgetBrowserStatistics.h +++ b/src/gui/reports/ReportsWidgetBrowserStatistics.h @@ -44,7 +44,7 @@ public: protected: void showEvent(QShowEvent* event) override; void updateWidget() override; - QTableView *getTableView() const override; + QTableView* getTableView() const override; signals: void entryActivated(Entry*); diff --git a/src/gui/reports/ReportsWidgetHealthcheck.cpp b/src/gui/reports/ReportsWidgetHealthcheck.cpp index 7d4a14089..086dd776d 100644 --- a/src/gui/reports/ReportsWidgetHealthcheck.cpp +++ b/src/gui/reports/ReportsWidgetHealthcheck.cpp @@ -24,8 +24,8 @@ #include "core/PasswordHealth.h" #include "gui/GuiTools.h" #include "gui/Icons.h" -#include "gui/styles/StateColorPalette.h" #include "gui/reports/ProxyModels.h" +#include "gui/styles/StateColorPalette.h" #include #include @@ -279,7 +279,7 @@ void ReportsWidgetHealthcheck::customMenuRequested(QPoint pos) { auto menu = customMenuRequestedBase(); - if(!menu) { + if (!menu) { return; } @@ -292,7 +292,7 @@ void ReportsWidgetHealthcheck::updateWidget() calculateHealth(); } -QTableView *ReportsWidgetHealthcheck::getTableView() const +QTableView* ReportsWidgetHealthcheck::getTableView() const { return m_ui->healthcheckTableView; } diff --git a/src/gui/reports/ReportsWidgetHealthcheck.h b/src/gui/reports/ReportsWidgetHealthcheck.h index 1dec5d8a7..7dfe0cdfc 100644 --- a/src/gui/reports/ReportsWidgetHealthcheck.h +++ b/src/gui/reports/ReportsWidgetHealthcheck.h @@ -47,7 +47,7 @@ public: protected: void showEvent(QShowEvent* event) override; void updateWidget() override; - QTableView *getTableView() const override; + QTableView* getTableView() const override; signals: void tablePopulated(); diff --git a/src/gui/reports/ReportsWidgetHibp.cpp b/src/gui/reports/ReportsWidgetHibp.cpp index 44a2d2131..b97b9986c 100644 --- a/src/gui/reports/ReportsWidgetHibp.cpp +++ b/src/gui/reports/ReportsWidgetHibp.cpp @@ -65,7 +65,7 @@ void ReportsWidgetHibp::loadSettings(QSharedPointer db) m_ui->validationButton->setEnabled(true); m_ui->progressBar->hide(); #else - // Compiled without networking, can't do anything + // Compiled without networking, can't do anything m_ui->stackedWidget->setCurrentIndex(2); #endif @@ -335,7 +335,7 @@ void ReportsWidgetHibp::customMenuRequested(QPoint pos) // Create the context menu const auto menu = customMenuRequestedBase(); - if(!menu) { + if (!menu) { return; } @@ -348,7 +348,7 @@ void ReportsWidgetHibp::updateWidget() makeHibpTable(); } -QTableView *ReportsWidgetHibp::getTableView() const +QTableView* ReportsWidgetHibp::getTableView() const { return m_ui->hibpTableView; } diff --git a/src/gui/reports/ReportsWidgetHibp.h b/src/gui/reports/ReportsWidgetHibp.h index 8148ea24b..2d59a090a 100644 --- a/src/gui/reports/ReportsWidgetHibp.h +++ b/src/gui/reports/ReportsWidgetHibp.h @@ -52,7 +52,7 @@ public: protected: void updateWidget() override; - QTableView *getTableView() const override; + QTableView* getTableView() const override; public slots: void emitEntryActivated(const QModelIndex&); diff --git a/src/gui/reports/ReportsWidgetPasskeys.cpp b/src/gui/reports/ReportsWidgetPasskeys.cpp index e76f509f7..737c72f68 100644 --- a/src/gui/reports/ReportsWidgetPasskeys.cpp +++ b/src/gui/reports/ReportsWidgetPasskeys.cpp @@ -29,8 +29,8 @@ #include "gui/MessageBox.h" #include "gui/passkeys/PasskeyExporter.h" #include "gui/passkeys/PasskeyImporter.h" -#include "gui/styles/StateColorPalette.h" #include "gui/reports/ProxyModels.h" +#include "gui/styles/StateColorPalette.h" #include #include @@ -246,7 +246,7 @@ void ReportsWidgetPasskeys::exportPasskey() passkeyExporter.showExportDialog(getSelectedEntries()); } -QTableView *ReportsWidgetPasskeys::getTableView() const +QTableView* ReportsWidgetPasskeys::getTableView() const { return m_ui->passkeysTableView; } diff --git a/src/gui/reports/ReportsWidgetPasskeys.h b/src/gui/reports/ReportsWidgetPasskeys.h index 3e6115013..30945bba6 100644 --- a/src/gui/reports/ReportsWidgetPasskeys.h +++ b/src/gui/reports/ReportsWidgetPasskeys.h @@ -44,7 +44,7 @@ public: protected: void showEvent(QShowEvent* event) override; void updateWidget() override; - QTableView *getTableView() const override; + QTableView* getTableView() const override; public slots: void updateEntries(); diff --git a/tests/gui/TestGui.cpp b/tests/gui/TestGui.cpp index 71fef6729..c06906249 100644 --- a/tests/gui/TestGui.cpp +++ b/tests/gui/TestGui.cpp @@ -2675,7 +2675,7 @@ void TestGui::testExcludedGroupReincludeAllEntries() addGroup("Finance"); addGroup("Entertainment"); - // Use bad passwords to make sure they all show up in health report + // Use bad passwords to make sure they all show up in health report addEntry("Finance", "Chase", "user1", "password"); addEntry("Finance", "Amex", "user1", "password123"); addEntry("Finance", "Capital One", "user1", "password456"); @@ -2697,13 +2697,13 @@ void TestGui::testExcludedGroupReincludeAllEntries() auto* editGroupWidget = m_dbWidget->findChild("editGroupWidget"); QVERIFY(editGroupWidget); - // Bring up group edit page + // Bring up group edit page QTest::mouseClick(editGroupWidget, Qt::LeftButton); QLineEdit* nameEdit = editGroupWidget->findChild("editName"); QCOMPARE(nameEdit->text(), QString("Entertainment")); - // Find database report exclusion checkbox and check it + // Find database report exclusion checkbox and check it QCheckBox* excludeGroupFromReportsCheckbox = editGroupWidget->findChild("excludeReportsCheckBox"); QVERIFY(excludeGroupFromReportsCheckbox); @@ -2712,14 +2712,14 @@ void TestGui::testExcludedGroupReincludeAllEntries() auto* editGroupWidgetButtonBox = editGroupWidget->findChild("buttonBox"); QVERIFY(editGroupWidgetButtonBox); - // Apply and go back to main view + // Apply and go back to main view QTest::mouseClick(editGroupWidgetButtonBox->button(QDialogButtonBox::Apply), Qt::LeftButton); QTest::mouseClick(editGroupWidgetButtonBox->button(QDialogButtonBox::Ok), Qt::LeftButton); QCOMPARE(m_dbWidget->currentMode(), DatabaseWidget::Mode::ViewMode); QVERIFY(entertainmentGroup->excludeFromReports()); - // Verify they don't show up in the report + // Verify they don't show up in the report auto* actionReports = m_mainWindow->findChild("actionReports"); QVERIFY(actionReports->isEnabled()); @@ -2752,7 +2752,7 @@ void TestGui::testExcludedGroupReincludeAllEntries() QAbstractItemModel* healthModel = healthTable->model(); QVERIFY(healthModel); - // There should be 3 showing + // There should be 3 showing QTRY_COMPARE(healthCheckWidgetSpy.count(), 1); QCOMPARE(healthModel->rowCount(), 5); // account for 2 existing passwords at the start of each test case