Skip to content

Commit

Permalink
Cleanup compiler warnings on all platforms (keepassxreboot#10847)
Browse files Browse the repository at this point in the history
Fixes keepassxreboot#10730.

Co-authored-by: Christoph Reiter <reiter.christoph@gmail.com>
  • Loading branch information
2 people authored and pull[bot] committed Jun 15, 2024
1 parent d4ad58d commit 7c5d315
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 16 deletions.
23 changes: 13 additions & 10 deletions src/browser/BrowserService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,20 +515,23 @@ void BrowserService::showPasswordGenerator(const KeyPairMessage& keyPairMessage)
if (!m_passwordGenerator) {
m_passwordGenerator = PasswordGeneratorWidget::popupGenerator();

connect(m_passwordGenerator.data(), &PasswordGeneratorWidget::closed, m_passwordGenerator.data(), [=] {
if (!m_passwordGenerator->isPasswordGenerated()) {
auto errorMessage = browserMessageBuilder()->getErrorReply("generate-password",
ERROR_KEEPASS_ACTION_CANCELLED_OR_DENIED);
m_browserHost->sendClientMessage(keyPairMessage.socket, errorMessage);
}

QTimer::singleShot(50, this, [&] { hideWindow(); });
});
connect(m_passwordGenerator.data(),
&PasswordGeneratorWidget::closed,
m_passwordGenerator.data(),
[this, keyPairMessage] {
if (!m_passwordGenerator->isPasswordGenerated()) {
auto errorMessage = browserMessageBuilder()->getErrorReply(
"generate-password", ERROR_KEEPASS_ACTION_CANCELLED_OR_DENIED);
m_browserHost->sendClientMessage(keyPairMessage.socket, errorMessage);
}

QTimer::singleShot(50, this, [&] { hideWindow(); });
});

connect(m_passwordGenerator.data(),
&PasswordGeneratorWidget::appliedPassword,
m_passwordGenerator.data(),
[=](const QString& password) {
[this, keyPairMessage](const QString& password) {
const Parameters params{{"password", password}};
m_browserHost->sendClientMessage(keyPairMessage.socket,
browserMessageBuilder()->buildResponse("generate-password",
Expand Down
4 changes: 2 additions & 2 deletions src/core/FileWatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ void FileWatcher::checkFileChanged()
// Prevent reentrance
m_ignoreFileChange = true;

AsyncTask::runThenCallback([=] { return calculateChecksum(); },
AsyncTask::runThenCallback([this] { return calculateChecksum(); },
this,
[=](QByteArray checksum) {
[this](QByteArray checksum) {
if (checksum != m_fileChecksum) {
m_fileChecksum = checksum;
m_fileChangeDelayTimer.start(0);
Expand Down
2 changes: 1 addition & 1 deletion src/fdosecrets/widgets/AccessControlDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ AccessControlDialog::AccessControlDialog(QWindow* parent,
connect(cancelButton, &QPushButton::clicked, this, [this]() { done(DenyAll); });
connect(allowButton, &QPushButton::clicked, this, [this]() { done(AllowSelected); });
connect(allowAllButton, &QPushButton::clicked, this, [this]() { done(AllowAll); });
connect(detailsButton, &QPushButton::clicked, this, [=](bool checked) {
connect(detailsButton, &QPushButton::clicked, this, [this, detailsButton, detailsButtonText](bool checked) {
m_ui->detailsContainer->setVisible(checked);
if (checked) {
detailsButton->setText(detailsButtonText + QStringLiteral(" <<"));
Expand Down
2 changes: 1 addition & 1 deletion src/gui/DatabaseOpenDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ DatabaseOpenDialog::DatabaseOpenDialog(QWidget* parent)
void DatabaseOpenDialog::showEvent(QShowEvent* event)
{
QDialog::showEvent(event);
QTimer::singleShot(100, this, [=] {
QTimer::singleShot(100, this, [this] {
if (m_view->isOnQuickUnlockScreen() && !m_view->unlockingDatabase()) {
m_view->triggerQuickUnlock();
}
Expand Down
4 changes: 2 additions & 2 deletions tests/TestDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ void TestDatabase::testSaveAs()
QCOMPARE(spyFilePathChanged.count(), 1);
QVERIFY(QFile::exists(newDbFileName));
#ifdef Q_OS_WIN
QVERIFY(!QFileInfo::QFileInfo(newDbFileName).isHidden());
QVERIFY(!QFileInfo(newDbFileName).isHidden());
SetFileAttributes(newDbFileName.toStdString().c_str(), FILE_ATTRIBUTE_HIDDEN);
QVERIFY2(db->saveAs(newDbFileName, Database::Atomic, QString(), &error), error.toLatin1());
QVERIFY(QFileInfo::QFileInfo(newDbFileName).isHidden());
QVERIFY(QFileInfo(newDbFileName).isHidden());
#endif
QFile::remove(newDbFileName);
QVERIFY(!QFile::exists(newDbFileName));
Expand Down

0 comments on commit 7c5d315

Please sign in to comment.