mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-03-11 08:54:48 +00:00
Fix formatting
This commit is contained in:
parent
98f70f4aaf
commit
6036e7fa7b
11 changed files with 53 additions and 47 deletions
|
|
@ -19,13 +19,13 @@
|
||||||
|
|
||||||
#include "core/Group.h"
|
#include "core/Group.h"
|
||||||
#include "core/Metadata.h"
|
#include "core/Metadata.h"
|
||||||
#include "gui/Icons.h"
|
|
||||||
#include "gui/GuiTools.h"
|
#include "gui/GuiTools.h"
|
||||||
|
#include "gui/Icons.h"
|
||||||
#include "gui/MessageBox.h"
|
#include "gui/MessageBox.h"
|
||||||
|
|
||||||
#include <QMenu>
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
|
#include <QMenu>
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
#include <QTableView>
|
#include <QTableView>
|
||||||
|
|
@ -51,7 +51,8 @@ ReportsWidgetBase::ReportsWidgetBase(QWidget* parent, SortProxyModelKind proxyMo
|
||||||
}
|
}
|
||||||
|
|
||||||
ReportsWidgetBase::~ReportsWidgetBase()
|
ReportsWidgetBase::~ReportsWidgetBase()
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void ReportsWidgetBase::loadSettings(QSharedPointer<Database> db)
|
void ReportsWidgetBase::loadSettings(QSharedPointer<Database> db)
|
||||||
{
|
{
|
||||||
|
|
@ -71,18 +72,18 @@ void ReportsWidgetBase::saveSettings()
|
||||||
// save settings
|
// save settings
|
||||||
}
|
}
|
||||||
|
|
||||||
QMenu *ReportsWidgetBase::customMenuRequestedBase()
|
QMenu* ReportsWidgetBase::customMenuRequestedBase()
|
||||||
{
|
{
|
||||||
auto selected = getTableView()->selectionModel()->selectedRows();
|
auto selected = getTableView()->selectionModel()->selectedRows();
|
||||||
if (selected.isEmpty()) {
|
if (selected.isEmpty()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the context menu
|
// Create the context menu
|
||||||
const auto menu = new QMenu(this);
|
const auto menu = new QMenu(this);
|
||||||
menu->setObjectName("customMenu");
|
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) {
|
if (selected.size() == 1) {
|
||||||
const auto edit = new QAction(icons()->icon("entry-edit"), tr("Edit Entry…"), this);
|
const auto edit = new QAction(icons()->icon("entry-edit"), tr("Edit Entry…"), this);
|
||||||
edit->setObjectName("contextMenuEditAction");
|
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);
|
const auto expEntry = new QAction(icons()->icon("entry-expire"), tr("Expire Entry(s)…", "", selected.size()), this);
|
||||||
expEntry->setObjectName("contextMenuExpireAction");
|
expEntry->setObjectName("contextMenuExpireAction");
|
||||||
menu->addAction(expEntry);
|
menu->addAction(expEntry);
|
||||||
connect(expEntry, &QAction::triggered, this, &ReportsWidgetBase::expireSelectedEntries);
|
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);
|
const auto delEntry = new QAction(icons()->icon("entry-delete"), tr("Delete Entry(s)…", "", selected.size()), this);
|
||||||
menu->addAction(delEntry);
|
menu->addAction(delEntry);
|
||||||
connect(delEntry, &QAction::triggered, this, &ReportsWidgetBase::deleteSelectedEntries);
|
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);
|
const auto excludeAction = new QAction(icons()->icon("reports-exclude"), tr("Exclude Entry(s) from reports"), this);
|
||||||
excludeAction->setObjectName("contextMenuExcludeAction");
|
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");
|
excludeGroupsAction->setObjectName("contextMenuxcludeGroupAction");
|
||||||
|
|
||||||
bool isExcluded = false;
|
bool isExcluded = false;
|
||||||
|
|
@ -139,28 +141,32 @@ QMenu *ReportsWidgetBase::customMenuRequestedBase()
|
||||||
connect(excludeAction, &QAction::toggled, excludeAction, [this, selected](bool checked) {
|
connect(excludeAction, &QAction::toggled, excludeAction, [this, selected](bool checked) {
|
||||||
QSet<Group*> groups;
|
QSet<Group*> groups;
|
||||||
|
|
||||||
// If we are including entries (checked is false) but a group is excluded, ask the user if they
|
// 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).
|
// 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
|
// If they exclude it, we need to include the whole group, and then exclude
|
||||||
// the entries that aren't selected here.
|
// the entries that aren't selected here.
|
||||||
if (!checked) {
|
if (!checked) {
|
||||||
for(const auto index : selected) {
|
for (const auto index : selected) {
|
||||||
auto row = m_modelProxy->mapToSource(index).row();
|
auto row = m_modelProxy->mapToSource(index).row();
|
||||||
auto entry = m_rowToEntry[row].second;
|
auto entry = m_rowToEntry[row].second;
|
||||||
|
|
||||||
if (entry) {
|
if (entry) {
|
||||||
auto *group = entry->group();
|
auto* group = entry->group();
|
||||||
if (group->excludeFromReports() && !groups.contains(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());
|
QString msg = tr("The Group for \"%1\" is excluded. Would you like to include all Entries from "
|
||||||
auto response = MessageBox::question(this, tr("Include Group?"), msg, MessageBox::Yes | MessageBox::No | MessageBox::Cancel, MessageBox::No);
|
"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) {
|
if (response == MessageBox::Cancel) {
|
||||||
return;
|
return;
|
||||||
}
|
} else if (response == MessageBox::Yes) {
|
||||||
else if (response == MessageBox::Yes) {
|
|
||||||
group->setExcludeFromReports(false);
|
group->setExcludeFromReports(false);
|
||||||
}
|
} else if (response == MessageBox::No) {
|
||||||
else if (response == MessageBox::No) {
|
|
||||||
// We'll exclude all entries from the group here and then
|
// We'll exclude all entries from the group here and then
|
||||||
// include the selected ones below
|
// include the selected ones below
|
||||||
group->setExcludeFromReports(false);
|
group->setExcludeFromReports(false);
|
||||||
|
|
@ -177,9 +183,9 @@ QMenu *ReportsWidgetBase::customMenuRequestedBase()
|
||||||
auto row = m_modelProxy->mapToSource(index).row();
|
auto row = m_modelProxy->mapToSource(index).row();
|
||||||
auto entry = m_rowToEntry[row].second;
|
auto entry = m_rowToEntry[row].second;
|
||||||
|
|
||||||
// If the containing group is excluded but the user wants to include
|
// 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
|
// this entry, ask if they want to keep the remaining items in the group
|
||||||
// excluded or included
|
// excluded or included
|
||||||
if (entry) {
|
if (entry) {
|
||||||
entry->setExcludeFromReports(checked);
|
entry->setExcludeFromReports(checked);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,10 +47,10 @@ public:
|
||||||
virtual void saveSettings();
|
virtual void saveSettings();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual QTableView *getTableView() const = 0;
|
virtual QTableView* getTableView() const = 0;
|
||||||
virtual void updateWidget() = 0;
|
virtual void updateWidget() = 0;
|
||||||
|
|
||||||
QMenu *customMenuRequestedBase();
|
QMenu* customMenuRequestedBase();
|
||||||
QList<Entry*> getSelectedEntries() const;
|
QList<Entry*> getSelectedEntries() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
|
||||||
|
|
@ -236,7 +236,7 @@ void ReportsWidgetBrowserStatistics::customMenuRequested(QPoint pos)
|
||||||
{
|
{
|
||||||
auto menu = customMenuRequestedBase();
|
auto menu = customMenuRequestedBase();
|
||||||
|
|
||||||
if(!menu) {
|
if (!menu) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -303,7 +303,7 @@ QMap<QString, QStringList> ReportsWidgetBrowserStatistics::getBrowserConfigFromE
|
||||||
return configList;
|
return configList;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTableView *ReportsWidgetBrowserStatistics::getTableView() const
|
QTableView* ReportsWidgetBrowserStatistics::getTableView() const
|
||||||
{
|
{
|
||||||
return m_ui->browserStatisticsTableView;
|
return m_ui->browserStatisticsTableView;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
void showEvent(QShowEvent* event) override;
|
void showEvent(QShowEvent* event) override;
|
||||||
void updateWidget() override;
|
void updateWidget() override;
|
||||||
QTableView *getTableView() const override;
|
QTableView* getTableView() const override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void entryActivated(Entry*);
|
void entryActivated(Entry*);
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,8 @@
|
||||||
#include "core/PasswordHealth.h"
|
#include "core/PasswordHealth.h"
|
||||||
#include "gui/GuiTools.h"
|
#include "gui/GuiTools.h"
|
||||||
#include "gui/Icons.h"
|
#include "gui/Icons.h"
|
||||||
#include "gui/styles/StateColorPalette.h"
|
|
||||||
#include "gui/reports/ProxyModels.h"
|
#include "gui/reports/ProxyModels.h"
|
||||||
|
#include "gui/styles/StateColorPalette.h"
|
||||||
|
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
|
|
@ -279,7 +279,7 @@ void ReportsWidgetHealthcheck::customMenuRequested(QPoint pos)
|
||||||
{
|
{
|
||||||
auto menu = customMenuRequestedBase();
|
auto menu = customMenuRequestedBase();
|
||||||
|
|
||||||
if(!menu) {
|
if (!menu) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -292,7 +292,7 @@ void ReportsWidgetHealthcheck::updateWidget()
|
||||||
calculateHealth();
|
calculateHealth();
|
||||||
}
|
}
|
||||||
|
|
||||||
QTableView *ReportsWidgetHealthcheck::getTableView() const
|
QTableView* ReportsWidgetHealthcheck::getTableView() const
|
||||||
{
|
{
|
||||||
return m_ui->healthcheckTableView;
|
return m_ui->healthcheckTableView;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
void showEvent(QShowEvent* event) override;
|
void showEvent(QShowEvent* event) override;
|
||||||
void updateWidget() override;
|
void updateWidget() override;
|
||||||
QTableView *getTableView() const override;
|
QTableView* getTableView() const override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void tablePopulated();
|
void tablePopulated();
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ void ReportsWidgetHibp::loadSettings(QSharedPointer<Database> db)
|
||||||
m_ui->validationButton->setEnabled(true);
|
m_ui->validationButton->setEnabled(true);
|
||||||
m_ui->progressBar->hide();
|
m_ui->progressBar->hide();
|
||||||
#else
|
#else
|
||||||
// Compiled without networking, can't do anything
|
// Compiled without networking, can't do anything
|
||||||
m_ui->stackedWidget->setCurrentIndex(2);
|
m_ui->stackedWidget->setCurrentIndex(2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -335,7 +335,7 @@ void ReportsWidgetHibp::customMenuRequested(QPoint pos)
|
||||||
// Create the context menu
|
// Create the context menu
|
||||||
const auto menu = customMenuRequestedBase();
|
const auto menu = customMenuRequestedBase();
|
||||||
|
|
||||||
if(!menu) {
|
if (!menu) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -348,7 +348,7 @@ void ReportsWidgetHibp::updateWidget()
|
||||||
makeHibpTable();
|
makeHibpTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
QTableView *ReportsWidgetHibp::getTableView() const
|
QTableView* ReportsWidgetHibp::getTableView() const
|
||||||
{
|
{
|
||||||
return m_ui->hibpTableView;
|
return m_ui->hibpTableView;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void updateWidget() override;
|
void updateWidget() override;
|
||||||
QTableView *getTableView() const override;
|
QTableView* getTableView() const override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void emitEntryActivated(const QModelIndex&);
|
void emitEntryActivated(const QModelIndex&);
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,8 @@
|
||||||
#include "gui/MessageBox.h"
|
#include "gui/MessageBox.h"
|
||||||
#include "gui/passkeys/PasskeyExporter.h"
|
#include "gui/passkeys/PasskeyExporter.h"
|
||||||
#include "gui/passkeys/PasskeyImporter.h"
|
#include "gui/passkeys/PasskeyImporter.h"
|
||||||
#include "gui/styles/StateColorPalette.h"
|
|
||||||
#include "gui/reports/ProxyModels.h"
|
#include "gui/reports/ProxyModels.h"
|
||||||
|
#include "gui/styles/StateColorPalette.h"
|
||||||
|
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
|
|
@ -246,7 +246,7 @@ void ReportsWidgetPasskeys::exportPasskey()
|
||||||
passkeyExporter.showExportDialog(getSelectedEntries());
|
passkeyExporter.showExportDialog(getSelectedEntries());
|
||||||
}
|
}
|
||||||
|
|
||||||
QTableView *ReportsWidgetPasskeys::getTableView() const
|
QTableView* ReportsWidgetPasskeys::getTableView() const
|
||||||
{
|
{
|
||||||
return m_ui->passkeysTableView;
|
return m_ui->passkeysTableView;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
void showEvent(QShowEvent* event) override;
|
void showEvent(QShowEvent* event) override;
|
||||||
void updateWidget() override;
|
void updateWidget() override;
|
||||||
QTableView *getTableView() const override;
|
QTableView* getTableView() const override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void updateEntries();
|
void updateEntries();
|
||||||
|
|
|
||||||
|
|
@ -2675,7 +2675,7 @@ void TestGui::testExcludedGroupReincludeAllEntries()
|
||||||
addGroup("Finance");
|
addGroup("Finance");
|
||||||
addGroup("Entertainment");
|
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", "Chase", "user1", "password");
|
||||||
addEntry("Finance", "Amex", "user1", "password123");
|
addEntry("Finance", "Amex", "user1", "password123");
|
||||||
addEntry("Finance", "Capital One", "user1", "password456");
|
addEntry("Finance", "Capital One", "user1", "password456");
|
||||||
|
|
@ -2697,13 +2697,13 @@ void TestGui::testExcludedGroupReincludeAllEntries()
|
||||||
auto* editGroupWidget = m_dbWidget->findChild<EditGroupWidget*>("editGroupWidget");
|
auto* editGroupWidget = m_dbWidget->findChild<EditGroupWidget*>("editGroupWidget");
|
||||||
QVERIFY(editGroupWidget);
|
QVERIFY(editGroupWidget);
|
||||||
|
|
||||||
// Bring up group edit page
|
// Bring up group edit page
|
||||||
QTest::mouseClick(editGroupWidget, Qt::LeftButton);
|
QTest::mouseClick(editGroupWidget, Qt::LeftButton);
|
||||||
|
|
||||||
QLineEdit* nameEdit = editGroupWidget->findChild<QLineEdit*>("editName");
|
QLineEdit* nameEdit = editGroupWidget->findChild<QLineEdit*>("editName");
|
||||||
QCOMPARE(nameEdit->text(), QString("Entertainment"));
|
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<QCheckBox*>("excludeReportsCheckBox");
|
QCheckBox* excludeGroupFromReportsCheckbox = editGroupWidget->findChild<QCheckBox*>("excludeReportsCheckBox");
|
||||||
QVERIFY(excludeGroupFromReportsCheckbox);
|
QVERIFY(excludeGroupFromReportsCheckbox);
|
||||||
|
|
||||||
|
|
@ -2712,14 +2712,14 @@ void TestGui::testExcludedGroupReincludeAllEntries()
|
||||||
auto* editGroupWidgetButtonBox = editGroupWidget->findChild<QDialogButtonBox*>("buttonBox");
|
auto* editGroupWidgetButtonBox = editGroupWidget->findChild<QDialogButtonBox*>("buttonBox");
|
||||||
QVERIFY(editGroupWidgetButtonBox);
|
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::Apply), Qt::LeftButton);
|
||||||
QTest::mouseClick(editGroupWidgetButtonBox->button(QDialogButtonBox::Ok), Qt::LeftButton);
|
QTest::mouseClick(editGroupWidgetButtonBox->button(QDialogButtonBox::Ok), Qt::LeftButton);
|
||||||
QCOMPARE(m_dbWidget->currentMode(), DatabaseWidget::Mode::ViewMode);
|
QCOMPARE(m_dbWidget->currentMode(), DatabaseWidget::Mode::ViewMode);
|
||||||
|
|
||||||
QVERIFY(entertainmentGroup->excludeFromReports());
|
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<QAction*>("actionReports");
|
auto* actionReports = m_mainWindow->findChild<QAction*>("actionReports");
|
||||||
QVERIFY(actionReports->isEnabled());
|
QVERIFY(actionReports->isEnabled());
|
||||||
|
|
||||||
|
|
@ -2752,7 +2752,7 @@ void TestGui::testExcludedGroupReincludeAllEntries()
|
||||||
QAbstractItemModel* healthModel = healthTable->model();
|
QAbstractItemModel* healthModel = healthTable->model();
|
||||||
QVERIFY(healthModel);
|
QVERIFY(healthModel);
|
||||||
|
|
||||||
// There should be 3 showing
|
// There should be 3 showing
|
||||||
QTRY_COMPARE(healthCheckWidgetSpy.count(), 1);
|
QTRY_COMPARE(healthCheckWidgetSpy.count(), 1);
|
||||||
QCOMPARE(healthModel->rowCount(), 5); // account for 2 existing passwords at the start of each test case
|
QCOMPARE(healthModel->rowCount(), 5); // account for 2 existing passwords at the start of each test case
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue