Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGianluca Recchia <gianluca.recchia97@gmail.com>2018-11-01 06:27:38 +0300
committerJonathan White <support@dmapps.us>2018-11-29 02:29:15 +0300
commitfc930bae69be516cb2ad72e83dad1cf6d8631956 (patch)
tree3deee79bad7608204299f3f6cc6dce51865c49fd
parentf9625189cb7ddf9d1353a6dab079830778623d48 (diff)
Restore correct formatting
Many lines were not conformant with the project's formatting rules. This patch should fix all formatting and whitespace issues in the code base. A clang-format directive was put around the connect() calls containing SIGNALs and SLOTs whose signatures would be denormalized because of the formatting rules.
-rw-r--r--src/autotype/AutoType.cpp10
-rw-r--r--src/autotype/AutoTypeSelectDialog.cpp3
-rw-r--r--src/autotype/WildcardMatcher.cpp2
-rw-r--r--src/autotype/WildcardMatcher.h2
-rw-r--r--src/autotype/xcb/AutoTypeXCB.cpp3
-rw-r--r--src/browser/BrowserAccessControlDialog.cpp39
-rw-r--r--src/browser/BrowserAccessControlDialog.h32
-rw-r--r--src/browser/BrowserAction.cpp37
-rw-r--r--src/browser/BrowserAction.h32
-rw-r--r--src/browser/BrowserClients.cpp32
-rw-r--r--src/browser/BrowserClients.h32
-rw-r--r--src/browser/BrowserEntryConfig.cpp32
-rw-r--r--src/browser/BrowserEntryConfig.h32
-rw-r--r--src/browser/BrowserEntrySaveDialog.cpp42
-rw-r--r--src/browser/BrowserEntrySaveDialog.h39
-rw-r--r--src/browser/BrowserOptionDialog.cpp59
-rw-r--r--src/browser/BrowserOptionDialog.h36
-rw-r--r--src/browser/BrowserService.cpp89
-rw-r--r--src/browser/BrowserService.h34
-rw-r--r--src/browser/BrowserSettings.cpp42
-rw-r--r--src/browser/BrowserSettings.h36
-rw-r--r--src/browser/HostInstaller.cpp40
-rw-r--r--src/browser/HostInstaller.h32
-rw-r--r--src/browser/NativeMessagingBase.cpp35
-rw-r--r--src/browser/NativeMessagingBase.h36
-rw-r--r--src/browser/NativeMessagingHost.cpp36
-rw-r--r--src/browser/NativeMessagingHost.h32
-rw-r--r--src/browser/Variant.cpp30
-rw-r--r--src/browser/Variant.h30
-rw-r--r--src/cli/Add.cpp12
-rw-r--r--src/cli/Clip.cpp7
-rw-r--r--src/cli/Diceware.cpp6
-rw-r--r--src/cli/Edit.cpp18
-rw-r--r--src/cli/Estimate.cpp13
-rw-r--r--src/cli/Extract.cpp3
-rw-r--r--src/cli/Generate.cpp21
-rw-r--r--src/cli/List.cpp3
-rw-r--r--src/cli/Merge.cpp6
-rw-r--r--src/cli/Show.cpp6
-rw-r--r--src/cli/Utils.cpp201
-rw-r--r--src/cli/Utils.h26
-rw-r--r--src/core/AsyncTask.h2
-rw-r--r--src/core/Bootstrap.cpp308
-rw-r--r--src/core/Bootstrap.h16
-rw-r--r--src/core/Config.cpp2
-rw-r--r--src/core/Database.cpp5
-rw-r--r--src/core/Entry.cpp9
-rw-r--r--src/core/Entry.h3
-rw-r--r--src/core/EntryAttributes.cpp4
-rw-r--r--src/core/Group.cpp6
-rw-r--r--src/core/InactivityTimer.cpp3
-rw-r--r--src/core/Merger.cpp68
-rw-r--r--src/core/Merger.h20
-rw-r--r--src/core/Metadata.cpp2
-rw-r--r--src/core/OSEventFilter.h1
-rw-r--r--src/core/PasswordGenerator.cpp1
-rw-r--r--src/core/Tools.cpp226
-rw-r--r--src/core/Tools.h42
-rw-r--r--src/crypto/Crypto.cpp5
-rw-r--r--src/crypto/SymmetricCipher.cpp30
-rw-r--r--src/crypto/SymmetricCipher.h30
-rw-r--r--src/crypto/SymmetricCipherBackend.h30
-rw-r--r--src/crypto/SymmetricCipherGcrypt.cpp30
-rw-r--r--src/crypto/SymmetricCipherGcrypt.h30
-rw-r--r--src/crypto/kdf/Argon2Kdf.h12
-rw-r--r--src/crypto/kdf/Kdf.h2
-rw-r--r--src/format/Kdbx3Reader.cpp3
-rw-r--r--src/format/Kdbx3Writer.cpp7
-rw-r--r--src/format/Kdbx4Writer.cpp10
-rw-r--r--src/format/KdbxXmlReader.cpp2
-rw-r--r--src/format/KdbxXmlReader.h3
-rw-r--r--src/format/KdbxXmlWriter.cpp2
-rw-r--r--src/format/KeePass1.h32
-rw-r--r--src/format/KeePass2.cpp18
-rw-r--r--src/format/KeePass2.h30
-rw-r--r--src/gui/AboutDialog.cpp7
-rw-r--r--src/gui/ApplicationSettingsWidget.h2
-rw-r--r--src/gui/CategoryListWidget.cpp5
-rw-r--r--src/gui/DatabaseOpenWidget.cpp4
-rw-r--r--src/gui/DatabaseTabWidget.cpp12
-rw-r--r--src/gui/DatabaseWidget.cpp6
-rw-r--r--src/gui/EditWidget.cpp1
-rw-r--r--src/gui/EditWidgetIcons.cpp37
-rw-r--r--src/gui/EditWidgetIcons.h8
-rw-r--r--src/gui/EditWidgetProperties.cpp25
-rw-r--r--src/gui/KeePass1OpenWidget.cpp2
-rw-r--r--src/gui/MainWindow.cpp29
-rw-r--r--src/gui/PasswordEdit.cpp5
-rw-r--r--src/gui/PasswordGeneratorWidget.cpp6
-rw-r--r--src/gui/TotpSetupDialog.cpp3
-rw-r--r--src/gui/csvImport/CsvImportWidget.cpp8
-rw-r--r--src/gui/csvImport/CsvImportWizard.cpp1
-rw-r--r--src/gui/dbsettings/DatabaseSettingsDialog.cpp10
-rw-r--r--src/gui/dbsettings/DatabaseSettingsDialog.h2
-rw-r--r--src/gui/dbsettings/DatabaseSettingsWidget.cpp2
-rw-r--r--src/gui/dbsettings/DatabaseSettingsWidget.h2
-rw-r--r--src/gui/dbsettings/DatabaseSettingsWidgetBrowser.cpp74
-rw-r--r--src/gui/dbsettings/DatabaseSettingsWidgetBrowser.h18
-rw-r--r--src/gui/dbsettings/DatabaseSettingsWidgetEncryption.cpp11
-rw-r--r--src/gui/dbsettings/DatabaseSettingsWidgetEncryption.h17
-rw-r--r--src/gui/dbsettings/DatabaseSettingsWidgetGeneral.cpp8
-rw-r--r--src/gui/dbsettings/DatabaseSettingsWidgetGeneral.h9
-rw-r--r--src/gui/dbsettings/DatabaseSettingsWidgetMasterKey.cpp41
-rw-r--r--src/gui/dbsettings/DatabaseSettingsWidgetMasterKey.h15
-rw-r--r--src/gui/dbsettings/DatabaseSettingsWidgetMetaDataSimple.cpp1
-rw-r--r--src/gui/dbsettings/DatabaseSettingsWidgetMetaDataSimple.h11
-rw-r--r--src/gui/entry/AutoTypeMatchView.cpp6
-rw-r--r--src/gui/entry/EditEntryWidget.cpp49
-rw-r--r--src/gui/entry/EditEntryWidget.h3
-rw-r--r--src/gui/entry/EntryAttachmentsWidget.cpp3
-rw-r--r--src/gui/entry/EntryAttributesModel.cpp6
-rw-r--r--src/gui/entry/EntryView.cpp13
-rw-r--r--src/gui/group/EditGroupWidget.cpp3
-rw-r--r--src/gui/group/EditGroupWidget.h2
-rw-r--r--src/gui/group/GroupModel.cpp2
-rw-r--r--src/gui/group/GroupView.cpp2
-rw-r--r--src/gui/masterkey/KeyComponentWidget.cpp4
-rw-r--r--src/gui/masterkey/KeyComponentWidget.h8
-rw-r--r--src/gui/masterkey/KeyFileEditWidget.cpp9
-rw-r--r--src/gui/masterkey/KeyFileEditWidget.h6
-rw-r--r--src/gui/masterkey/PasswordEditWidget.cpp8
-rw-r--r--src/gui/masterkey/PasswordEditWidget.h4
-rw-r--r--src/gui/masterkey/YubiKeyEditWidget.cpp17
-rw-r--r--src/gui/masterkey/YubiKeyEditWidget.h4
-rw-r--r--src/gui/settings/SettingsWidget.h4
-rw-r--r--src/gui/wizard/NewDatabaseWizard.cpp10
-rw-r--r--src/gui/wizard/NewDatabaseWizard.h4
-rw-r--r--src/gui/wizard/NewDatabaseWizardPage.cpp1
-rw-r--r--src/gui/wizard/NewDatabaseWizardPage.h6
-rw-r--r--src/gui/wizard/NewDatabaseWizardPageEncryption.h4
-rw-r--r--src/gui/wizard/NewDatabaseWizardPageMasterKey.h4
-rw-r--r--src/gui/wizard/NewDatabaseWizardPageMetaData.h4
-rw-r--r--src/keys/ChallengeResponseKey.h41
-rw-r--r--src/keys/CompositeKey.cpp32
-rw-r--r--src/keys/CompositeKey.h34
-rw-r--r--src/keys/FileKey.cpp32
-rw-r--r--src/keys/FileKey.h32
-rw-r--r--src/keys/Key.h35
-rw-r--r--src/keys/PasswordKey.cpp30
-rw-r--r--src/keys/PasswordKey.h33
-rw-r--r--src/keys/YkChallengeResponseKey.cpp33
-rw-r--r--src/keys/YkChallengeResponseKey.h2
-rw-r--r--src/keys/drivers/YubiKey.cpp32
-rw-r--r--src/keys/drivers/YubiKey.h32
-rw-r--r--src/keys/drivers/YubiKeyStub.cpp32
-rw-r--r--src/main.cpp31
-rw-r--r--src/proxy/NativeMessagingHost.cpp37
-rw-r--r--src/proxy/NativeMessagingHost.h30
-rw-r--r--src/proxy/keepassxc-proxy.cpp32
-rw-r--r--src/sshagent/ASN1Key.cpp2
-rw-r--r--src/sshagent/ASN1Key.h2
-rw-r--r--src/sshagent/AgentSettingsPage.h2
-rw-r--r--src/sshagent/AgentSettingsWidget.cpp3
-rw-r--r--src/sshagent/KeeAgentSettings.cpp2
-rw-r--r--src/sshagent/OpenSSHKey.cpp2
-rw-r--r--src/streams/HashedBlockStream.cpp30
-rw-r--r--src/streams/HashedBlockStream.h30
-rw-r--r--src/streams/HmacBlockStream.cpp30
-rw-r--r--src/streams/HmacBlockStream.h30
-rw-r--r--src/streams/LayeredStream.cpp30
-rw-r--r--src/streams/LayeredStream.h30
-rw-r--r--src/streams/StoreDataStream.cpp30
-rw-r--r--src/streams/StoreDataStream.h30
-rw-r--r--src/totp/totp.cpp26
-rw-r--r--src/totp/totp.h79
-rw-r--r--src/touchid/TouchID.h8
-rw-r--r--tests/TestCli.cpp251
-rw-r--r--tests/TestCli.h6
-rw-r--r--tests/TestCryptoHash.cpp5
-rw-r--r--tests/TestCsvExporter.cpp7
-rw-r--r--tests/TestEntry.cpp61
-rw-r--r--tests/TestGlobal.h2
-rw-r--r--tests/TestKdbx4.cpp8
-rw-r--r--tests/TestKeePass2Format.cpp3
-rw-r--r--tests/TestMerge.cpp61
-rw-r--r--tests/TestMerge.h19
-rw-r--r--tests/TestModified.cpp1
-rw-r--r--tests/TestOpenSSHKey.cpp318
-rw-r--r--tests/TestPasswordGenerator.cpp19
-rw-r--r--tests/TestPasswordGenerator.h2
-rw-r--r--tests/TestSymmetricCipher.cpp39
-rw-r--r--tests/TestTools.cpp2
-rw-r--r--tests/gui/TestGui.cpp23
-rw-r--r--tests/mock/MockChallengeResponseKey.cpp2
-rw-r--r--tests/mock/MockChallengeResponseKey.h2
-rw-r--r--tests/util/TemporaryFile.h2
186 files changed, 2432 insertions, 2117 deletions
diff --git a/src/autotype/AutoType.cpp b/src/autotype/AutoType.cpp
index c2ddc9752..012dee62c 100644
--- a/src/autotype/AutoType.cpp
+++ b/src/autotype/AutoType.cpp
@@ -672,7 +672,7 @@ bool AutoType::checkSyntax(const QString& string)
QString shortcutKeys = "[\\^\\%~\\+@]";
// a normal string not in parentheses
QString fixedStrings = "[^\\^\\%~\\+@\\{\\}]*";
-
+ // clang-format off
QRegularExpression autoTypeSyntax(
"^(?:" + shortcutKeys + "|" + fixedStrings + "|\\{(?:" + normalCommands + "|" + specialLiterals + "|"
+ functionKeys
@@ -688,6 +688,7 @@ bool AutoType::checkSyntax(const QString& string)
+ customAttributes
+ "\\})*$",
QRegularExpression::CaseInsensitiveOption);
+ // clang-format on
QRegularExpressionMatch match = autoTypeSyntax.match(string);
return match.hasMatch();
}
@@ -755,9 +756,10 @@ bool AutoType::verifyAutoTypeSyntax(const QString& sequence)
}
} else if (AutoType::checkHighRepetition(sequence)) {
QMessageBox::StandardButton reply;
- reply =
- QMessageBox::question(nullptr, tr("Auto-Type"), tr("This Auto-Type command contains arguments which are "
- "repeated very often. Do you really want to proceed?"));
+ reply = QMessageBox::question(nullptr,
+ tr("Auto-Type"),
+ tr("This Auto-Type command contains arguments which are "
+ "repeated very often. Do you really want to proceed?"));
if (reply == QMessageBox::No) {
return false;
diff --git a/src/autotype/AutoTypeSelectDialog.cpp b/src/autotype/AutoTypeSelectDialog.cpp
index fe0ba811e..1449f9e02 100644
--- a/src/autotype/AutoTypeSelectDialog.cpp
+++ b/src/autotype/AutoTypeSelectDialog.cpp
@@ -67,10 +67,13 @@ AutoTypeSelectDialog::AutoTypeSelectDialog(QWidget* parent)
QLabel* descriptionLabel = new QLabel(tr("Select entry to Auto-Type:"), this);
layout->addWidget(descriptionLabel);
+ // clang-format off
connect(m_view, SIGNAL(activated(QModelIndex)), SLOT(emitMatchActivated(QModelIndex)));
connect(m_view, SIGNAL(clicked(QModelIndex)), SLOT(emitMatchActivated(QModelIndex)));
connect(m_view->model(), SIGNAL(rowsRemoved(QModelIndex,int,int)), SLOT(matchRemoved()));
connect(m_view, SIGNAL(rejected()), SLOT(reject()));
+ // clang-format on
+
layout->addWidget(m_view);
QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel, Qt::Horizontal, this);
diff --git a/src/autotype/WildcardMatcher.cpp b/src/autotype/WildcardMatcher.cpp
index 6afd10cee..b69425ee1 100644
--- a/src/autotype/WildcardMatcher.cpp
+++ b/src/autotype/WildcardMatcher.cpp
@@ -23,7 +23,7 @@
const QChar WildcardMatcher::Wildcard = '*';
const Qt::CaseSensitivity WildcardMatcher::Sensitivity = Qt::CaseInsensitive;
-WildcardMatcher::WildcardMatcher(QString text)
+WildcardMatcher::WildcardMatcher(QString text)
: m_text(std::move(text))
{
}
diff --git a/src/autotype/WildcardMatcher.h b/src/autotype/WildcardMatcher.h
index 5be6f5e40..d8ee1dc79 100644
--- a/src/autotype/WildcardMatcher.h
+++ b/src/autotype/WildcardMatcher.h
@@ -23,7 +23,7 @@
class WildcardMatcher
{
public:
- explicit WildcardMatcher(QString text);
+ explicit WildcardMatcher(QString text);
bool match(const QString& pattern);
static const QChar Wildcard;
diff --git a/src/autotype/xcb/AutoTypeXCB.cpp b/src/autotype/xcb/AutoTypeXCB.cpp
index 5198468cf..94a132d40 100644
--- a/src/autotype/xcb/AutoTypeXCB.cpp
+++ b/src/autotype/xcb/AutoTypeXCB.cpp
@@ -211,8 +211,7 @@ int AutoTypePlatformX11::platformEventFilter(void* event)
xcb_key_press_event_t* keyPressEvent = static_cast<xcb_key_press_event_t*>(event);
if (keyPressEvent->detail == m_currentGlobalKeycode
&& (keyPressEvent->state & m_modifierMask) == m_currentGlobalNativeModifiers
- && (!QApplication::activeWindow() || QApplication::activeWindow()->isMinimized())
- && m_loaded) {
+ && (!QApplication::activeWindow() || QApplication::activeWindow()->isMinimized()) && m_loaded) {
if (type == XCB_KEY_PRESS) {
emit globalShortcutTriggered();
}
diff --git a/src/browser/BrowserAccessControlDialog.cpp b/src/browser/BrowserAccessControlDialog.cpp
index e4205f811..9a10e555f 100644
--- a/src/browser/BrowserAccessControlDialog.cpp
+++ b/src/browser/BrowserAccessControlDialog.cpp
@@ -1,25 +1,26 @@
/*
-* Copyright (C) 2013 Francois Ferrand
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2013 Francois Ferrand
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include "BrowserAccessControlDialog.h"
-#include "core/Entry.h"
#include "ui_BrowserAccessControlDialog.h"
+#include "core/Entry.h"
+
BrowserAccessControlDialog::BrowserAccessControlDialog(QWidget* parent)
: QDialog(parent)
, m_ui(new Ui::BrowserAccessControlDialog())
@@ -38,8 +39,8 @@ BrowserAccessControlDialog::~BrowserAccessControlDialog()
void BrowserAccessControlDialog::setUrl(const QString& url)
{
m_ui->label->setText(QString(tr("%1 has requested access to passwords for the following item(s).\n"
- "Please select whether you want to allow access."))
- .arg(QUrl(url).host()));
+ "Please select whether you want to allow access."))
+ .arg(QUrl(url).host()));
}
void BrowserAccessControlDialog::setItems(const QList<Entry*>& items)
diff --git a/src/browser/BrowserAccessControlDialog.h b/src/browser/BrowserAccessControlDialog.h
index 65cfe5e97..4c93a54fc 100644
--- a/src/browser/BrowserAccessControlDialog.h
+++ b/src/browser/BrowserAccessControlDialog.h
@@ -1,20 +1,20 @@
/*
-* Copyright (C) 2013 Francois Ferrand
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2013 Francois Ferrand
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef BROWSERACCESSCONTROLDIALOG_H
#define BROWSERACCESSCONTROLDIALOG_H
diff --git a/src/browser/BrowserAction.cpp b/src/browser/BrowserAction.cpp
index ccd17c5fd..97ead6a34 100644
--- a/src/browser/BrowserAction.cpp
+++ b/src/browser/BrowserAction.cpp
@@ -1,20 +1,20 @@
/*
-* Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include "BrowserAction.h"
#include "BrowserSettings.h"
@@ -167,9 +167,10 @@ QJsonObject BrowserAction::handleAssociate(const QJsonObject& json, const QStrin
QMutexLocker locker(&m_mutex);
if (key.compare(m_clientPublicKey, Qt::CaseSensitive) == 0) {
- // Check for identification key. If it's not found, ensure backwards compatibility and use the current public key
+ // Check for identification key. If it's not found, ensure backwards compatibility and use the current public
+ // key
const QString idKey = decrypted.value("idKey").toString();
- const QString id = m_browserService.storeKey((idKey.isEmpty() ? key: idKey));
+ const QString id = m_browserService.storeKey((idKey.isEmpty() ? key : idKey));
if (id.isEmpty()) {
return getErrorReply(action, ERROR_KEEPASS_ACTION_CANCELLED_OR_DENIED);
}
diff --git a/src/browser/BrowserAction.h b/src/browser/BrowserAction.h
index b7a60938f..c82af2c17 100644
--- a/src/browser/BrowserAction.h
+++ b/src/browser/BrowserAction.h
@@ -1,20 +1,20 @@
/*
-* Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef BROWSERACTION_H
#define BROWSERACTION_H
diff --git a/src/browser/BrowserClients.cpp b/src/browser/BrowserClients.cpp
index c994ef1d0..083df3945 100644
--- a/src/browser/BrowserClients.cpp
+++ b/src/browser/BrowserClients.cpp
@@ -1,20 +1,20 @@
/*
-* Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include "BrowserClients.h"
#include <QJsonParseError>
diff --git a/src/browser/BrowserClients.h b/src/browser/BrowserClients.h
index b725154a5..1fa3dfe17 100644
--- a/src/browser/BrowserClients.h
+++ b/src/browser/BrowserClients.h
@@ -1,20 +1,20 @@
/*
-* Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef BROWSERCLIENTS_H
#define BROWSERCLIENTS_H
diff --git a/src/browser/BrowserEntryConfig.cpp b/src/browser/BrowserEntryConfig.cpp
index 47e8762a8..a058b6a05 100644
--- a/src/browser/BrowserEntryConfig.cpp
+++ b/src/browser/BrowserEntryConfig.cpp
@@ -1,20 +1,20 @@
/*
-* Copyright (C) 2013 Francois Ferrand
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2013 Francois Ferrand
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include "BrowserEntryConfig.h"
#include "core/Entry.h"
diff --git a/src/browser/BrowserEntryConfig.h b/src/browser/BrowserEntryConfig.h
index f1363f421..183c492aa 100644
--- a/src/browser/BrowserEntryConfig.h
+++ b/src/browser/BrowserEntryConfig.h
@@ -1,20 +1,20 @@
/*
-* Copyright (C) 2013 Francois Ferrand
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2013 Francois Ferrand
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef BROWSERENTRYCONFIG_H
#define BROWSERENTRYCONFIG_H
diff --git a/src/browser/BrowserEntrySaveDialog.cpp b/src/browser/BrowserEntrySaveDialog.cpp
index 305c46c6d..43d6c0c62 100644
--- a/src/browser/BrowserEntrySaveDialog.cpp
+++ b/src/browser/BrowserEntrySaveDialog.cpp
@@ -1,20 +1,20 @@
/*
-* Copyright (C) 2013 Francois Ferrand
-* Copyright (C) 2018 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2013 Francois Ferrand
+ * Copyright (C) 2018 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include "BrowserEntrySaveDialog.h"
#include "ui_BrowserEntrySaveDialog.h"
@@ -34,7 +34,7 @@ BrowserEntrySaveDialog::BrowserEntrySaveDialog(QWidget* parent)
m_ui->itemsList->setSelectionMode(QAbstractItemView::SingleSelection);
m_ui->label->setText(QString(tr("You have multiple databases open.\n"
- "Please select the correct database for saving credentials.")));
+ "Please select the correct database for saving credentials.")));
}
BrowserEntrySaveDialog::~BrowserEntrySaveDialog()
@@ -58,7 +58,7 @@ int BrowserEntrySaveDialog::setItems(QList<DatabaseWidget*>& databaseWidgets, Da
} else {
item->setText(QString("%1 (%2)").arg(databaseName, databaseFileName));
}
-
+
if (currentWidget == dbWidget) {
activeIndex = counter;
}
@@ -76,7 +76,7 @@ int BrowserEntrySaveDialog::setItems(QList<DatabaseWidget*>& databaseWidgets, Da
return databaseWidgets.length();
}
- QList<QListWidgetItem*> BrowserEntrySaveDialog::getSelected() const
- {
+QList<QListWidgetItem*> BrowserEntrySaveDialog::getSelected() const
+{
return m_ui->itemsList->selectedItems();
- }
+}
diff --git a/src/browser/BrowserEntrySaveDialog.h b/src/browser/BrowserEntrySaveDialog.h
index 0b1db7271..2e2378635 100644
--- a/src/browser/BrowserEntrySaveDialog.h
+++ b/src/browser/BrowserEntrySaveDialog.h
@@ -1,28 +1,29 @@
/*
-* Copyright (C) 2013 Francois Ferrand
-* Copyright (C) 2018 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2013 Francois Ferrand
+ * Copyright (C) 2018 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef BROWSERENTRYSAVEDIALOG_H
#define BROWSERENTRYSAVEDIALOG_H
+#include "gui/DatabaseTabWidget.h"
+
#include <QDialog>
-#include <QScopedPointer>
#include <QListWidgetItem>
-#include "gui/DatabaseTabWidget.h"
+#include <QScopedPointer>
class Entry;
@@ -40,7 +41,7 @@ public:
~BrowserEntrySaveDialog() override;
int setItems(QList<DatabaseWidget*>& databaseWidgets, DatabaseWidget* currentWidget) const;
- QList<QListWidgetItem *> getSelected() const;
+ QList<QListWidgetItem*> getSelected() const;
private:
QScopedPointer<Ui::BrowserEntrySaveDialog> m_ui;
diff --git a/src/browser/BrowserOptionDialog.cpp b/src/browser/BrowserOptionDialog.cpp
index 6dcbd3263..27dce7994 100644
--- a/src/browser/BrowserOptionDialog.cpp
+++ b/src/browser/BrowserOptionDialog.cpp
@@ -1,27 +1,28 @@
/*
-* Copyright (C) 2013 Francois Ferrand
-* Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2013 Francois Ferrand
+ * Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include "BrowserOptionDialog.h"
+#include "ui_BrowserOptionDialog.h"
+
#include "BrowserSettings.h"
#include "config-keepassx.h"
#include "core/FilePath.h"
-#include "ui_BrowserOptionDialog.h"
#include <QFileDialog>
@@ -32,18 +33,24 @@ BrowserOptionDialog::BrowserOptionDialog(QWidget* parent)
m_ui->setupUi(this);
m_ui->extensionLabel->setOpenExternalLinks(true);
- m_ui->extensionLabel->setText(tr("KeePassXC-Browser is needed for the browser integration to work. <br />Download it for %1 and %2.").arg(
- "<a href=\"https://addons.mozilla.org/en-US/firefox/addon/keepassxc-browser/\">Firefox</a>",
- "<a href=\"https://chrome.google.com/webstore/detail/keepassxc-browser/oboonakemofpalcgghocfoadofidjkkk\">Google Chrome / Chromium / Vivaldi</a>"));
+ m_ui->extensionLabel->setText(
+ tr("KeePassXC-Browser is needed for the browser integration to work. <br />Download it for %1 and %2.")
+ .arg("<a href=\"https://addons.mozilla.org/en-US/firefox/addon/keepassxc-browser/\">Firefox</a>",
+ "<a "
+ "href=\"https://chrome.google.com/webstore/detail/keepassxc-browser/"
+ "oboonakemofpalcgghocfoadofidjkkk\">Google Chrome / Chromium / Vivaldi</a>"));
m_ui->scriptWarningWidget->setVisible(false);
m_ui->scriptWarningWidget->setAutoHideTimeout(-1);
- m_ui->scriptWarningWidget->showMessage(tr("<b>Warning</b>, the keepassxc-proxy application was not found!"
- "<br />Please check the KeePassXC installation directory or confirm the custom path in advanced options."
- "<br />Browser integration WILL NOT WORK without the proxy application."
- "<br />Expected Path: "), MessageWidget::Warning);
+ m_ui->scriptWarningWidget->showMessage(
+ tr("<b>Warning</b>, the keepassxc-proxy application was not found!"
+ "<br />Please check the KeePassXC installation directory or confirm the custom path in advanced options."
+ "<br />Browser integration WILL NOT WORK without the proxy application."
+ "<br />Expected Path: "),
+ MessageWidget::Warning);
- m_ui->warningWidget->showMessage(tr("<b>Warning:</b> The following options can be dangerous!"), MessageWidget::Warning);
+ m_ui->warningWidget->showMessage(tr("<b>Warning:</b> The following options can be dangerous!"),
+ MessageWidget::Warning);
m_ui->warningWidget->setCloseButtonVisible(false);
m_ui->warningWidget->setAutoHideTimeout(-1);
diff --git a/src/browser/BrowserOptionDialog.h b/src/browser/BrowserOptionDialog.h
index 5423f010f..5efb808e5 100644
--- a/src/browser/BrowserOptionDialog.h
+++ b/src/browser/BrowserOptionDialog.h
@@ -1,27 +1,27 @@
/*
-* Copyright (C) 2013 Francois Ferrand
-* Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2013 Francois Ferrand
+ * Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef BROWSEROPTIONDIALOG_H
#define BROWSEROPTIONDIALOG_H
-#include <QScopedPointer>
#include <QPointer>
+#include <QScopedPointer>
#include <QWidget>
namespace Ui
diff --git a/src/browser/BrowserService.cpp b/src/browser/BrowserService.cpp
index 1f616bd85..945f1303a 100644
--- a/src/browser/BrowserService.cpp
+++ b/src/browser/BrowserService.cpp
@@ -1,32 +1,32 @@
/*
-* Copyright (C) 2013 Francois Ferrand
-* Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2013 Francois Ferrand
+ * Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
-#include <QJsonArray>
#include <QInputDialog>
-#include <QProgressDialog>
+#include <QJsonArray>
#include <QMessageBox>
+#include <QProgressDialog>
#include <QUuid>
-#include "BrowserService.h"
#include "BrowserAccessControlDialog.h"
#include "BrowserEntryConfig.h"
#include "BrowserEntrySaveDialog.h"
+#include "BrowserService.h"
#include "BrowserSettings.h"
#include "core/Database.h"
#include "core/EntrySearcher.h"
@@ -54,7 +54,8 @@ BrowserService::BrowserService(DatabaseTabWidget* parent)
// Don't connect the signals when used from DatabaseSettingsWidgetBrowser (parent is nullptr)
if (m_dbTabWidget) {
connect(m_dbTabWidget, SIGNAL(databaseLocked(DatabaseWidget*)), this, SLOT(databaseLocked(DatabaseWidget*)));
- connect(m_dbTabWidget, SIGNAL(databaseUnlocked(DatabaseWidget*)), this, SLOT(databaseUnlocked(DatabaseWidget*)));
+ connect(
+ m_dbTabWidget, SIGNAL(databaseUnlocked(DatabaseWidget*)), this, SLOT(databaseUnlocked(DatabaseWidget*)));
connect(m_dbTabWidget,
SIGNAL(activateDatabaseChanged(DatabaseWidget*)),
this,
@@ -355,7 +356,8 @@ void BrowserService::updateEntry(const QString& id,
return;
}
- if (username.compare(login, Qt::CaseSensitive) != 0 || entry->password().compare(password, Qt::CaseSensitive) != 0) {
+ if (username.compare(login, Qt::CaseSensitive) != 0
+ || entry->password().compare(password, Qt::CaseSensitive) != 0) {
int dialogResult = QMessageBox::No;
if (!browserSettings()->alwaysAllowUpdate()) {
QMessageBox msgBox;
@@ -393,16 +395,17 @@ QList<Entry*> BrowserService::searchEntries(QSharedPointer<Database> db, const Q
QString entryScheme = entryQUrl.scheme();
QUrl qUrl(url);
- // Ignore entry if port or scheme defined in the URL doesn't match
- if ((entryQUrl.port() > 0 && entryQUrl.port() != qUrl.port()) ||
- (browserSettings()->matchUrlScheme() && !entryScheme.isEmpty() && entryScheme.compare(qUrl.scheme()) != 0)) {
+ // Ignore entry if port or scheme defined in the URL doesn't match
+ if ((entryQUrl.port() > 0 && entryQUrl.port() != qUrl.port())
+ || (browserSettings()->matchUrlScheme() && !entryScheme.isEmpty()
+ && entryScheme.compare(qUrl.scheme()) != 0)) {
continue;
}
// Filter to match hostname in URL field
- if ((!entryUrl.isEmpty() && hostname.contains(entryUrl))
+ if ((!entryUrl.isEmpty() && hostname.contains(entryUrl))
|| (matchUrlScheme(entryUrl) && hostname.endsWith(entryQUrl.host()))) {
- entries.append(entry);
+ entries.append(entry);
}
}
@@ -420,7 +423,8 @@ QList<Entry*> BrowserService::searchEntries(const QString& url, const StringPair
if (const auto& db = dbWidget->database()) {
// Check if database is connected with KeePassXC-Browser
for (const StringPair& keyPair : keyList) {
- QString key = db->metadata()->customData()->value(QLatin1String(ASSOCIATE_KEY_PREFIX) + keyPair.first);
+ QString key =
+ db->metadata()->customData()->value(QLatin1String(ASSOCIATE_KEY_PREFIX) + keyPair.first);
if (!key.isEmpty() && keyPair.second == key) {
databases << db;
}
@@ -484,16 +488,22 @@ void BrowserService::convertAttributesToCustomData(QSharedPointer<Database> curr
progress.reset();
if (counter > 0) {
- QMessageBox::information(nullptr, tr("KeePassXC: Converted KeePassHTTP attributes"),
+ QMessageBox::information(nullptr,
+ tr("KeePassXC: Converted KeePassHTTP attributes"),
tr("Successfully converted attributes from %1 entry(s).\n"
- "Moved %2 keys to custom data.", "").arg(counter).arg(keyCounter),
+ "Moved %2 keys to custom data.",
+ "")
+ .arg(counter)
+ .arg(keyCounter),
QMessageBox::Ok);
} else if (counter == 0 && keyCounter > 0) {
- QMessageBox::information(nullptr, tr("KeePassXC: Converted KeePassHTTP attributes"),
+ QMessageBox::information(nullptr,
+ tr("KeePassXC: Converted KeePassHTTP attributes"),
tr("Successfully moved %n keys to custom data.", "", keyCounter),
QMessageBox::Ok);
} else {
- QMessageBox::information(nullptr, tr("KeePassXC: No entry with KeePassHTTP attributes found!"),
+ QMessageBox::information(nullptr,
+ tr("KeePassXC: No entry with KeePassHTTP attributes found!"),
tr("The active database does not contain an entry with KeePassHTTP attributes."),
QMessageBox::Ok);
}
@@ -539,9 +549,14 @@ QList<Entry*> BrowserService::sortEntries(QList<Entry*>& pwEntries, const QStrin
// Sort same priority entries by Title or UserName
auto entries = priorities.values(i);
std::sort(entries.begin(), entries.end(), [&field](Entry* left, Entry* right) {
- return (QString::localeAwareCompare(left->attributes()->value(field), right->attributes()->value(field)) < 0) ||
- ((QString::localeAwareCompare(left->attributes()->value(field), right->attributes()->value(field)) == 0) &&
- (QString::localeAwareCompare(left->attributes()->value("UserName"), right->attributes()->value("UserName")) < 0));
+ return (QString::localeAwareCompare(left->attributes()->value(field), right->attributes()->value(field))
+ < 0)
+ || ((QString::localeAwareCompare(left->attributes()->value(field),
+ right->attributes()->value(field))
+ == 0)
+ && (QString::localeAwareCompare(left->attributes()->value("UserName"),
+ right->attributes()->value("UserName"))
+ < 0));
});
results << entries;
if (browserSettings()->bestMatchOnly() && !pwEntries.isEmpty()) {
@@ -843,7 +858,8 @@ int BrowserService::moveKeysToCustomData(Entry* entry, QSharedPointer<Database>
// Add key to database custom data
if (db && !db->metadata()->customData()->contains(QLatin1String(ASSOCIATE_KEY_PREFIX) + publicKey)) {
- db->metadata()->customData()->set(QLatin1String(ASSOCIATE_KEY_PREFIX) + publicKey, entry->attributes()->value(key));
+ db->metadata()->customData()->set(QLatin1String(ASSOCIATE_KEY_PREFIX) + publicKey,
+ entry->attributes()->value(key));
++keyCounter;
}
}
@@ -879,7 +895,6 @@ bool BrowserService::checkLegacySettings()
"Do you want to upgrade the settings to the latest standard?\n"
"This is necessary to maintain compatibility with the browser plugin."),
QMessageBox::Yes | QMessageBox::No);
-
return dialogResult == QMessageBox::Yes;
}
diff --git a/src/browser/BrowserService.h b/src/browser/BrowserService.h
index 612b55eec..6c84696f9 100644
--- a/src/browser/BrowserService.h
+++ b/src/browser/BrowserService.h
@@ -1,21 +1,21 @@
/*
-* Copyright (C) 2013 Francois Ferrand
-* Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 or (at your option)
-* version 3 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2013 Francois Ferrand
+ * Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef BROWSERSERVICE_H
#define BROWSERSERVICE_H
diff --git a/src/browser/BrowserSettings.cpp b/src/browser/BrowserSettings.cpp
index 646c6c4d3..f1f9667f8 100644
--- a/src/browser/BrowserSettings.cpp
+++ b/src/browser/BrowserSettings.cpp
@@ -1,21 +1,21 @@
/*
-* Copyright (C) 2013 Francois Ferrand
-* Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2013 Francois Ferrand
+ * Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include "BrowserSettings.h"
#include "core/Config.h"
@@ -192,7 +192,7 @@ bool BrowserSettings::chromeSupport()
void BrowserSettings::setChromeSupport(bool enabled)
{
m_hostInstaller.installBrowser(
- HostInstaller::SupportedBrowsers::CHROME, enabled, supportBrowserProxy(), customProxyLocation());
+ HostInstaller::SupportedBrowsers::CHROME, enabled, supportBrowserProxy(), customProxyLocation());
}
bool BrowserSettings::chromiumSupport()
@@ -203,7 +203,7 @@ bool BrowserSettings::chromiumSupport()
void BrowserSettings::setChromiumSupport(bool enabled)
{
m_hostInstaller.installBrowser(
- HostInstaller::SupportedBrowsers::CHROMIUM, enabled, supportBrowserProxy(), customProxyLocation());
+ HostInstaller::SupportedBrowsers::CHROMIUM, enabled, supportBrowserProxy(), customProxyLocation());
}
bool BrowserSettings::firefoxSupport()
@@ -214,7 +214,7 @@ bool BrowserSettings::firefoxSupport()
void BrowserSettings::setFirefoxSupport(bool enabled)
{
m_hostInstaller.installBrowser(
- HostInstaller::SupportedBrowsers::FIREFOX, enabled, supportBrowserProxy(), customProxyLocation());
+ HostInstaller::SupportedBrowsers::FIREFOX, enabled, supportBrowserProxy(), customProxyLocation());
}
bool BrowserSettings::vivaldiSupport()
@@ -225,7 +225,7 @@ bool BrowserSettings::vivaldiSupport()
void BrowserSettings::setVivaldiSupport(bool enabled)
{
m_hostInstaller.installBrowser(
- HostInstaller::SupportedBrowsers::VIVALDI, enabled, supportBrowserProxy(), customProxyLocation());
+ HostInstaller::SupportedBrowsers::VIVALDI, enabled, supportBrowserProxy(), customProxyLocation());
}
bool BrowserSettings::torBrowserSupport()
diff --git a/src/browser/BrowserSettings.h b/src/browser/BrowserSettings.h
index 92cdcd16d..0a9dc8261 100644
--- a/src/browser/BrowserSettings.h
+++ b/src/browser/BrowserSettings.h
@@ -1,21 +1,21 @@
/*
-* Copyright (C) 2013 Francois Ferrand
-* Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2013 Francois Ferrand
+ * Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef BROWSERSETTINGS_H
#define BROWSERSETTINGS_H
@@ -72,7 +72,7 @@ public:
void setVivaldiSupport(bool enabled);
bool torBrowserSupport();
void setTorBrowserSupport(bool enabled);
-
+
bool passwordUseNumbers();
void setPasswordUseNumbers(bool useNumbers);
bool passwordUseLowercase();
diff --git a/src/browser/HostInstaller.cpp b/src/browser/HostInstaller.cpp
index f4585febe..08782fa16 100644
--- a/src/browser/HostInstaller.cpp
+++ b/src/browser/HostInstaller.cpp
@@ -1,20 +1,20 @@
/*
-* Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include "HostInstaller.h"
#include "config-keepassx.h"
@@ -46,8 +46,10 @@ HostInstaller::HostInstaller()
, TARGET_DIR_VIVALDI("/.config/vivaldi/NativeMessagingHosts")
, TARGET_DIR_TOR_BROWSER("/.tor-browser/app/Browser/TorBrowser/Data/Browser/.mozilla/native-messaging-hosts")
#elif defined(Q_OS_WIN)
+ // clang-format off
, TARGET_DIR_CHROME("HKEY_CURRENT_USER\\Software\\Google\\Chrome\\NativeMessagingHosts\\org.keepassxc.keepassxc_browser")
, TARGET_DIR_CHROMIUM("HKEY_CURRENT_USER\\Software\\Chromium\\NativeMessagingHosts\\org.keepassxc.keepassxc_browser")
+ // clang-format on
, TARGET_DIR_FIREFOX("HKEY_CURRENT_USER\\Software\\Mozilla\\NativeMessagingHosts\\org.keepassxc.keepassxc_browser")
, TARGET_DIR_VIVALDI(TARGET_DIR_CHROME)
, TARGET_DIR_TOR_BROWSER(TARGET_DIR_FIREFOX)
@@ -163,14 +165,14 @@ QString HostInstaller::getTargetPath(SupportedBrowsers browser) const
case SupportedBrowsers::VIVALDI:
return TARGET_DIR_VIVALDI;
case SupportedBrowsers::TOR_BROWSER:
- return TARGET_DIR_TOR_BROWSER;
+ return TARGET_DIR_TOR_BROWSER;
default:
return QString();
}
}
/**
- * Returns the browser name
+ * Returns the browser name
* Needed for Windows to separate Chromium- or Firefox-based scripts
*
* @param browser Selected browser
@@ -188,7 +190,7 @@ QString HostInstaller::getBrowserName(SupportedBrowsers browser) const
case SupportedBrowsers::VIVALDI:
return "vivaldi";
case SupportedBrowsers::TOR_BROWSER:
- return "tor-browser";
+ return "tor-browser";
default:
return QString();
}
diff --git a/src/browser/HostInstaller.h b/src/browser/HostInstaller.h
index 77d1ffca5..ea0c4bd2f 100644
--- a/src/browser/HostInstaller.h
+++ b/src/browser/HostInstaller.h
@@ -1,20 +1,20 @@
/*
-* Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef HOSTINSTALLER_H
#define HOSTINSTALLER_H
diff --git a/src/browser/NativeMessagingBase.cpp b/src/browser/NativeMessagingBase.cpp
index 87c44b42c..fa88c015f 100644
--- a/src/browser/NativeMessagingBase.cpp
+++ b/src/browser/NativeMessagingBase.cpp
@@ -1,20 +1,20 @@
/*
-* Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include "NativeMessagingBase.h"
#include <QStandardPaths>
@@ -138,7 +138,8 @@ QString NativeMessagingBase::getLocalServerPath() const
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
// Use XDG_RUNTIME_DIR instead of /tmp if it's available
QString path = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);
- return path.isEmpty() ? QStandardPaths::writableLocation(QStandardPaths::TempLocation) + serverPath : path + serverPath;
+ return path.isEmpty() ? QStandardPaths::writableLocation(QStandardPaths::TempLocation) + serverPath
+ : path + serverPath;
#else // Q_OS_MACOS, Q_OS_WIN and others
return QStandardPaths::writableLocation(QStandardPaths::TempLocation) + serverPath;
#endif
diff --git a/src/browser/NativeMessagingBase.h b/src/browser/NativeMessagingBase.h
index f27edbfc1..12e551665 100644
--- a/src/browser/NativeMessagingBase.h
+++ b/src/browser/NativeMessagingBase.h
@@ -1,20 +1,20 @@
/*
-* Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef NATIVEMESSAGINGBASE_H
#define NATIVEMESSAGINGBASE_H
@@ -33,11 +33,11 @@
#include <unistd.h>
#ifndef Q_OS_WIN
+#include <sys/socket.h>
#include <sys/types.h>
-#include <sys/socket.h>
#endif
-static const int NATIVE_MSG_MAX_LENGTH = 1024*1024;
+static const int NATIVE_MSG_MAX_LENGTH = 1024 * 1024;
class NativeMessagingBase : public QObject
{
diff --git a/src/browser/NativeMessagingHost.cpp b/src/browser/NativeMessagingHost.cpp
index 03f742020..5d2383b2b 100644
--- a/src/browser/NativeMessagingHost.cpp
+++ b/src/browser/NativeMessagingHost.cpp
@@ -1,20 +1,20 @@
/*
-* Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include "NativeMessagingHost.h"
#include "BrowserSettings.h"
@@ -65,8 +65,8 @@ void NativeMessagingHost::run()
// Update KeePassXC/keepassxc-proxy binary paths to Native Messaging scripts
if (browserSettings()->updateBinaryPath()) {
- browserSettings()->updateBinaryPaths(browserSettings()->useCustomProxy() ? browserSettings()->customProxyLocation()
- : "");
+ browserSettings()->updateBinaryPaths(
+ browserSettings()->useCustomProxy() ? browserSettings()->customProxyLocation() : "");
}
m_running.store(true);
diff --git a/src/browser/NativeMessagingHost.h b/src/browser/NativeMessagingHost.h
index 774306d30..30a67378a 100644
--- a/src/browser/NativeMessagingHost.h
+++ b/src/browser/NativeMessagingHost.h
@@ -1,20 +1,20 @@
/*
-* Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef NATIVEMESSAGINGHOST_H
#define NATIVEMESSAGINGHOST_H
diff --git a/src/browser/Variant.cpp b/src/browser/Variant.cpp
index 2d42ac4ec..64231736f 100644
--- a/src/browser/Variant.cpp
+++ b/src/browser/Variant.cpp
@@ -1,19 +1,19 @@
/*
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include "Variant.h"
diff --git a/src/browser/Variant.h b/src/browser/Variant.h
index 8acdbaa56..76211cdc9 100644
--- a/src/browser/Variant.h
+++ b/src/browser/Variant.h
@@ -1,19 +1,19 @@
/*
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef VARIANT_H
#define VARIANT_H
diff --git a/src/cli/Add.cpp b/src/cli/Add.cpp
index e51803614..9c78db2fb 100644
--- a/src/cli/Add.cpp
+++ b/src/cli/Add.cpp
@@ -51,7 +51,8 @@ int Add::execute(const QStringList& arguments)
parser.addOption(Command::QuietOption);
parser.addOption(Command::KeyFileOption);
- QCommandLineOption username(QStringList() << "u" << "username",
+ QCommandLineOption username(QStringList() << "u"
+ << "username",
QObject::tr("Username for the entry."),
QObject::tr("username"));
parser.addOption(username);
@@ -59,15 +60,18 @@ int Add::execute(const QStringList& arguments)
QCommandLineOption url(QStringList() << "url", QObject::tr("URL for the entry."), QObject::tr("URL"));
parser.addOption(url);
- QCommandLineOption prompt(QStringList() << "p" << "password-prompt",
+ QCommandLineOption prompt(QStringList() << "p"
+ << "password-prompt",
QObject::tr("Prompt for the entry's password."));
parser.addOption(prompt);
- QCommandLineOption generate(QStringList() << "g" << "generate",
+ QCommandLineOption generate(QStringList() << "g"
+ << "generate",
QObject::tr("Generate a password for the entry."));
parser.addOption(generate);
- QCommandLineOption length(QStringList() << "l" << "password-length",
+ QCommandLineOption length(QStringList() << "l"
+ << "password-length",
QObject::tr("Length for the generated password."),
QObject::tr("length"));
parser.addOption(length);
diff --git a/src/cli/Clip.cpp b/src/cli/Clip.cpp
index 6417c8c4b..7e81bcf70 100644
--- a/src/cli/Clip.cpp
+++ b/src/cli/Clip.cpp
@@ -50,12 +50,13 @@ int Clip::execute(const QStringList& arguments)
parser.addOption(Command::QuietOption);
parser.addOption(Command::KeyFileOption);
- QCommandLineOption totp(QStringList() << "t" << "totp",
+ QCommandLineOption totp(QStringList() << "t"
+ << "totp",
QObject::tr("Copy the current TOTP to the clipboard."));
parser.addOption(totp);
parser.addPositionalArgument("entry", QObject::tr("Path of the entry to clip.", "clip = copy to clipboard"));
- parser.addPositionalArgument("timeout",
- QObject::tr("Timeout in seconds before clearing the clipboard."), "[timeout]");
+ parser.addPositionalArgument(
+ "timeout", QObject::tr("Timeout in seconds before clearing the clipboard."), "[timeout]");
parser.addHelpOption();
parser.process(arguments);
diff --git a/src/cli/Diceware.cpp b/src/cli/Diceware.cpp
index bb7931352..be1ac084f 100644
--- a/src/cli/Diceware.cpp
+++ b/src/cli/Diceware.cpp
@@ -43,11 +43,13 @@ int Diceware::execute(const QStringList& arguments)
QCommandLineParser parser;
parser.setApplicationDescription(description);
- QCommandLineOption words(QStringList() << "W" << "words",
+ QCommandLineOption words(QStringList() << "W"
+ << "words",
QObject::tr("Word count for the diceware passphrase."),
QObject::tr("count", "CLI parameter"));
parser.addOption(words);
- QCommandLineOption wordlistFile(QStringList() << "w" << "word-list",
+ QCommandLineOption wordlistFile(QStringList() << "w"
+ << "word-list",
QObject::tr("Wordlist for the diceware generator.\n[Default: EFF English]"),
QObject::tr("path"));
parser.addOption(wordlistFile);
diff --git a/src/cli/Edit.cpp b/src/cli/Edit.cpp
index d8d89833a..81c1e3223 100644
--- a/src/cli/Edit.cpp
+++ b/src/cli/Edit.cpp
@@ -51,7 +51,8 @@ int Edit::execute(const QStringList& arguments)
parser.addOption(Command::QuietOption);
parser.addOption(Command::KeyFileOption);
- QCommandLineOption username(QStringList() << "u" << "username",
+ QCommandLineOption username(QStringList() << "u"
+ << "username",
QObject::tr("Username for the entry."),
QObject::tr("username"));
parser.addOption(username);
@@ -59,20 +60,24 @@ int Edit::execute(const QStringList& arguments)
QCommandLineOption url(QStringList() << "url", QObject::tr("URL for the entry."), QObject::tr("URL"));
parser.addOption(url);
- QCommandLineOption title(QStringList() << "t" << "title",
+ QCommandLineOption title(QStringList() << "t"
+ << "title",
QObject::tr("Title for the entry."),
QObject::tr("title"));
parser.addOption(title);
- QCommandLineOption prompt(QStringList() << "p" << "password-prompt",
+ QCommandLineOption prompt(QStringList() << "p"
+ << "password-prompt",
QObject::tr("Prompt for the entry's password."));
parser.addOption(prompt);
- QCommandLineOption generate(QStringList() << "g" << "generate",
+ QCommandLineOption generate(QStringList() << "g"
+ << "generate",
QObject::tr("Generate a password for the entry."));
parser.addOption(generate);
- QCommandLineOption length(QStringList() << "l" << "password-length",
+ QCommandLineOption length(QStringList() << "l"
+ << "password-length",
QObject::tr("Length for the generated password."),
QObject::tr("length"));
parser.addOption(length);
@@ -111,8 +116,7 @@ int Edit::execute(const QStringList& arguments)
}
if (parser.value("username").isEmpty() && parser.value("url").isEmpty() && parser.value("title").isEmpty()
- && !parser.isSet(prompt)
- && !parser.isSet(generate)) {
+ && !parser.isSet(prompt) && !parser.isSet(generate)) {
err << QObject::tr("Not changing any field for entry %1.").arg(entryPath) << endl;
return EXIT_FAILURE;
}
diff --git a/src/cli/Estimate.cpp b/src/cli/Estimate.cpp
index db32f8dc7..556ff4435 100644
--- a/src/cli/Estimate.cpp
+++ b/src/cli/Estimate.cpp
@@ -51,9 +51,11 @@ static void estimate(const char* pwd, bool advanced)
int len = static_cast<int>(strlen(pwd));
if (!advanced) {
e = ZxcvbnMatch(pwd, nullptr, nullptr);
+ // clang-format off
out << QObject::tr("Length %1").arg(len, 0) << '\t'
<< QObject::tr("Entropy %1").arg(e, 0, 'f', 3) << '\t'
<< QObject::tr("Log10 %1").arg(e * 0.301029996, 0, 'f', 3) << endl;
+ // clang-format on
} else {
int ChkLen = 0;
ZxcMatch_t *info, *p;
@@ -63,10 +65,12 @@ static void estimate(const char* pwd, bool advanced)
m += p->Entrpy;
}
m = e - m;
+ // clang-format off
out << QObject::tr("Length %1").arg(len) << '\t'
<< QObject::tr("Entropy %1").arg(e, 0, 'f', 3) << '\t'
<< QObject::tr("Log10 %1").arg(e * 0.301029996, 0, 'f', 3) << "\n "
<< QObject::tr("Multi-word extra bits %1").arg(m, 0, 'f', 1) << endl;
+ // clang-format on
p = info;
ChkLen = 0;
while (p) {
@@ -132,9 +136,10 @@ static void estimate(const char* pwd, bool advanced)
break;
}
ChkLen += p->Length;
-
+ // clang-format off
out << QObject::tr("Length %1").arg(p->Length) << '\t'
<< QObject::tr("Entropy %1 (%2)").arg(p->Entrpy, 6, 'f', 3).arg(p->Entrpy * 0.301029996, 0, 'f', 2) << '\t';
+ // clang-format on
for (n = 0; n < p->Length; ++n, ++pwd) {
out << *pwd;
}
@@ -143,7 +148,8 @@ static void estimate(const char* pwd, bool advanced)
}
ZxcvbnFreeInfo(info);
if (ChkLen != len) {
- out << QObject::tr("*** Password length (%1) != sum of length of parts (%2) ***").arg(len).arg(ChkLen) << endl;
+ out << QObject::tr("*** Password length (%1) != sum of length of parts (%2) ***").arg(len).arg(ChkLen)
+ << endl;
}
}
}
@@ -156,7 +162,8 @@ int Estimate::execute(const QStringList& arguments)
QCommandLineParser parser;
parser.setApplicationDescription(description);
parser.addPositionalArgument("password", QObject::tr("Password for which to estimate the entropy."), "[password]");
- QCommandLineOption advancedOption(QStringList() << "a" << "advanced",
+ QCommandLineOption advancedOption(QStringList() << "a"
+ << "advanced",
QObject::tr("Perform advanced analysis on the password."));
parser.addOption(advancedOption);
parser.addHelpOption();
diff --git a/src/cli/Extract.cpp b/src/cli/Extract.cpp
index 38ef09db9..0b20b9528 100644
--- a/src/cli/Extract.cpp
+++ b/src/cli/Extract.cpp
@@ -84,7 +84,8 @@ int Extract::execute(const QStringList& arguments)
if (fileKey->type() != FileKey::Hashed) {
err << QObject::tr("WARNING: You are using a legacy key file format which may become\n"
"unsupported in the future.\n\n"
- "Please consider generating a new key file.") << endl;
+ "Please consider generating a new key file.")
+ << endl;
}
// LCOV_EXCL_STOP
diff --git a/src/cli/Generate.cpp b/src/cli/Generate.cpp
index da2deb8d8..adbfc0cc0 100644
--- a/src/cli/Generate.cpp
+++ b/src/cli/Generate.cpp
@@ -43,26 +43,33 @@ int Generate::execute(const QStringList& arguments)
QCommandLineParser parser;
parser.setApplicationDescription(description);
- QCommandLineOption len(QStringList() << "L" << "length",
+ QCommandLineOption len(QStringList() << "L"
+ << "length",
QObject::tr("Length of the generated password"),
QObject::tr("length"));
parser.addOption(len);
- QCommandLineOption lower(QStringList() << "l" << "lower",
+ QCommandLineOption lower(QStringList() << "l"
+ << "lower",
QObject::tr("Use lowercase characters"));
parser.addOption(lower);
- QCommandLineOption upper(QStringList() << "u" << "upper",
+ QCommandLineOption upper(QStringList() << "u"
+ << "upper",
QObject::tr("Use uppercase characters"));
parser.addOption(upper);
- QCommandLineOption numeric(QStringList() << "n" << "numeric",
+ QCommandLineOption numeric(QStringList() << "n"
+ << "numeric",
QObject::tr("Use numbers."));
parser.addOption(numeric);
- QCommandLineOption special(QStringList() << "s" << "special",
+ QCommandLineOption special(QStringList() << "s"
+ << "special",
QObject::tr("Use special characters"));
parser.addOption(special);
- QCommandLineOption extended(QStringList() << "e" << "extended",
+ QCommandLineOption extended(QStringList() << "e"
+ << "extended",
QObject::tr("Use extended ASCII"));
parser.addOption(extended);
- QCommandLineOption exclude(QStringList() << "x" << "exclude",
+ QCommandLineOption exclude(QStringList() << "x"
+ << "exclude",
QObject::tr("Exclude character set"),
QObject::tr("chars"));
parser.addOption(exclude);
diff --git a/src/cli/List.cpp b/src/cli/List.cpp
index f7be0ac72..e4b06f2cc 100644
--- a/src/cli/List.cpp
+++ b/src/cli/List.cpp
@@ -49,7 +49,8 @@ int List::execute(const QStringList& arguments)
parser.addOption(Command::QuietOption);
parser.addOption(Command::KeyFileOption);
- QCommandLineOption recursiveOption(QStringList() << "R" << "recursive",
+ QCommandLineOption recursiveOption(QStringList() << "R"
+ << "recursive",
QObject::tr("Recursively list the elements of the group."));
parser.addOption(recursiveOption);
parser.addHelpOption();
diff --git a/src/cli/Merge.cpp b/src/cli/Merge.cpp
index 17431d62e..58c7965dc 100644
--- a/src/cli/Merge.cpp
+++ b/src/cli/Merge.cpp
@@ -47,12 +47,14 @@ int Merge::execute(const QStringList& arguments)
parser.addPositionalArgument("database2", QObject::tr("Path of the database to merge from."));
parser.addOption(Command::QuietOption);
- QCommandLineOption samePasswordOption(QStringList() << "s" << "same-credentials",
+ QCommandLineOption samePasswordOption(QStringList() << "s"
+ << "same-credentials",
QObject::tr("Use the same credentials for both database files."));
parser.addOption(samePasswordOption);
parser.addOption(Command::KeyFileOption);
- QCommandLineOption keyFileFromOption(QStringList() << "f" << "key-file-from",
+ QCommandLineOption keyFileFromOption(QStringList() << "f"
+ << "key-file-from",
QObject::tr("Key file of the database to merge from."),
QObject::tr("path"));
parser.addOption(keyFileFromOption);
diff --git a/src/cli/Show.cpp b/src/cli/Show.cpp
index 5efae70c5..e900a07b9 100644
--- a/src/cli/Show.cpp
+++ b/src/cli/Show.cpp
@@ -48,11 +48,13 @@ int Show::execute(const QStringList& arguments)
parser.addPositionalArgument("database", QObject::tr("Path of the database."));
parser.addOption(Command::QuietOption);
parser.addOption(Command::KeyFileOption);
- QCommandLineOption totp(QStringList() << "t" << "totp",
+ QCommandLineOption totp(QStringList() << "t"
+ << "totp",
QObject::tr("Show the entry's current TOTP."));
parser.addOption(totp);
QCommandLineOption attributes(
- QStringList() << "a" << "attributes",
+ QStringList() << "a"
+ << "attributes",
QObject::tr(
"Names of the attributes to show. "
"This option can be specified more than once, with each attribute shown one-per-line in the given order. "
diff --git a/src/cli/Utils.cpp b/src/cli/Utils.cpp
index 7359f139c..d78c06074 100644
--- a/src/cli/Utils.cpp
+++ b/src/cli/Utils.cpp
@@ -28,20 +28,20 @@
namespace Utils
{
-/**
- * STDOUT file handle for the CLI.
- */
-FILE* STDOUT = stdout;
+ /**
+ * STDOUT file handle for the CLI.
+ */
+ FILE* STDOUT = stdout;
-/**
- * STDERR file handle for the CLI.
- */
-FILE* STDERR = stderr;
+ /**
+ * STDERR file handle for the CLI.
+ */
+ FILE* STDERR = stderr;
-/**
- * STDIN file handle for the CLI.
- */
-FILE* STDIN = stdin;
+ /**
+ * STDIN file handle for the CLI.
+ */
+ FILE* STDIN = stdin;
/**
* DEVNULL file handle for the CLI.
@@ -56,48 +56,47 @@ FILE* DEVNULL = fopen("/dev/null", "w");
void setStdinEcho(bool enable = true)
{
#ifdef Q_OS_WIN
- HANDLE hIn = GetStdHandle(STD_INPUT_HANDLE);
- DWORD mode;
- GetConsoleMode(hIn, &mode);
-
- if (enable) {
- mode |= ENABLE_ECHO_INPUT;
- } else {
- mode &= ~ENABLE_ECHO_INPUT;
- }
+ HANDLE hIn = GetStdHandle(STD_INPUT_HANDLE);
+ DWORD mode;
+ GetConsoleMode(hIn, &mode);
- SetConsoleMode(hIn, mode);
+ if (enable) {
+ mode |= ENABLE_ECHO_INPUT;
+ } else {
+ mode &= ~ENABLE_ECHO_INPUT;
+ }
+ SetConsoleMode(hIn, mode);
#else
- struct termios t;
- tcgetattr(STDIN_FILENO, &t);
+ struct termios t;
+ tcgetattr(STDIN_FILENO, &t);
- if (enable) {
- t.c_lflag |= ECHO;
- } else {
- t.c_lflag &= ~ECHO;
- }
+ if (enable) {
+ t.c_lflag |= ECHO;
+ } else {
+ t.c_lflag &= ~ECHO;
+ }
- tcsetattr(STDIN_FILENO, TCSANOW, &t);
+ tcsetattr(STDIN_FILENO, TCSANOW, &t);
#endif
-}
-
-namespace Test
-{
-QStringList nextPasswords = {};
+ }
-/**
- * Set the next password returned by \link getPassword() instead of reading it from STDIN.
- * Multiple calls to this method will fill a queue of passwords.
- * This function is intended for testing purposes.
- *
- * @param password password to return next
- */
-void setNextPassword(const QString& password)
-{
- nextPasswords.append(password);
-}
-} // namespace Test
+ namespace Test
+ {
+ QStringList nextPasswords = {};
+
+ /**
+ * Set the next password returned by \link getPassword() instead of reading it from STDIN.
+ * Multiple calls to this method will fill a queue of passwords.
+ * This function is intended for testing purposes.
+ *
+ * @param password password to return next
+ */
+ void setNextPassword(const QString& password)
+ {
+ nextPasswords.append(password);
+ }
+ } // namespace Test
/**
* Read a user password from STDIN or return a password previously
@@ -109,74 +108,74 @@ QString getPassword(FILE* outputDescriptor)
{
TextStream out(outputDescriptor, QIODevice::WriteOnly);
- // return preset password if one is set
- if (!Test::nextPasswords.isEmpty()) {
- auto password = Test::nextPasswords.takeFirst();
- // simulate user entering newline
- out << endl;
- return password;
- }
+ // return preset password if one is set
+ if (!Test::nextPasswords.isEmpty()) {
+ auto password = Test::nextPasswords.takeFirst();
+ // simulate user entering newline
+ out << endl;
+ return password;
+ }
- TextStream in(STDIN, QIODevice::ReadOnly);
+ TextStream in(STDIN, QIODevice::ReadOnly);
- setStdinEcho(false);
- QString line = in.readLine();
- setStdinEcho(true);
- out << endl;
+ setStdinEcho(false);
+ QString line = in.readLine();
+ setStdinEcho(true);
+ out << endl;
- return line;
-}
+ return line;
+ }
-/**
- * A valid and running event loop is needed to use the global QClipboard,
- * so we need to use this from the CLI.
- */
-int clipText(const QString& text)
-{
- TextStream err(Utils::STDERR);
+ /**
+ * A valid and running event loop is needed to use the global QClipboard,
+ * so we need to use this from the CLI.
+ */
+ int clipText(const QString& text)
+ {
+ TextStream err(Utils::STDERR);
- QString programName = "";
- QStringList arguments;
+ QString programName = "";
+ QStringList arguments;
#ifdef Q_OS_UNIX
- programName = "xclip";
- arguments << "-i"
- << "-selection"
- << "clipboard";
+ programName = "xclip";
+ arguments << "-i"
+ << "-selection"
+ << "clipboard";
#endif
#ifdef Q_OS_MACOS
- programName = "pbcopy";
+ programName = "pbcopy";
#endif
#ifdef Q_OS_WIN
- programName = "clip";
+ programName = "clip";
#endif
- if (programName.isEmpty()) {
- err << QObject::tr("No program defined for clipboard manipulation");
- err.flush();
- return EXIT_FAILURE;
- }
-
- auto* clipProcess = new QProcess(nullptr);
- clipProcess->start(programName, arguments);
- clipProcess->waitForStarted();
-
- if (clipProcess->state() != QProcess::Running) {
- err << QObject::tr("Unable to start program %1").arg(programName);
- err.flush();
- return EXIT_FAILURE;
+ if (programName.isEmpty()) {
+ err << QObject::tr("No program defined for clipboard manipulation");
+ err.flush();
+ return EXIT_FAILURE;
+ }
+
+ auto* clipProcess = new QProcess(nullptr);
+ clipProcess->start(programName, arguments);
+ clipProcess->waitForStarted();
+
+ if (clipProcess->state() != QProcess::Running) {
+ err << QObject::tr("Unable to start program %1").arg(programName);
+ err.flush();
+ return EXIT_FAILURE;
+ }
+
+ if (clipProcess->write(text.toLatin1()) == -1) {
+ qDebug("Unable to write to process : %s", qPrintable(clipProcess->errorString()));
+ }
+ clipProcess->waitForBytesWritten();
+ clipProcess->closeWriteChannel();
+ clipProcess->waitForFinished();
+
+ return clipProcess->exitCode();
}
- if (clipProcess->write(text.toLatin1()) == -1) {
- qDebug("Unable to write to process : %s", qPrintable(clipProcess->errorString()));
- }
- clipProcess->waitForBytesWritten();
- clipProcess->closeWriteChannel();
- clipProcess->waitForFinished();
-
- return clipProcess->exitCode();
-}
-
-} // namespace Utils
+} // namespace Utils
diff --git a/src/cli/Utils.h b/src/cli/Utils.h
index 8ea55da1e..28f260381 100644
--- a/src/cli/Utils.h
+++ b/src/cli/Utils.h
@@ -18,24 +18,24 @@
#ifndef KEEPASSXC_UTILS_H
#define KEEPASSXC_UTILS_H
-#include <QtCore/qglobal.h>
#include "cli/TextStream.h"
+#include <QtCore/qglobal.h>
namespace Utils
{
-extern FILE* STDOUT;
-extern FILE* STDERR;
-extern FILE* STDIN;
-extern FILE* DEVNULL;
+ extern FILE* STDOUT;
+ extern FILE* STDERR;
+ extern FILE* STDIN;
+ extern FILE* DEVNULL;
-void setStdinEcho(bool enable);
-QString getPassword(FILE* outputDescriptor = STDOUT);
-int clipText(const QString& text);
+ void setStdinEcho(bool enable);
+ QString getPassword(FILE* outputDescriptor = STDOUT);
+ int clipText(const QString& text);
-namespace Test
-{
-void setNextPassword(const QString& password);
-}
-};
+ namespace Test
+ {
+ void setNextPassword(const QString& password);
+ }
+}; // namespace Utils
#endif // KEEPASSXC_UTILS_H
diff --git a/src/core/AsyncTask.h b/src/core/AsyncTask.h
index 45bb191bc..f74d7c738 100644
--- a/src/core/AsyncTask.h
+++ b/src/core/AsyncTask.h
@@ -13,7 +13,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ */
#ifndef KEEPASSXC_ASYNCTASK_HPP
#define KEEPASSXC_ASYNCTASK_HPP
diff --git a/src/core/Bootstrap.cpp b/src/core/Bootstrap.cpp
index 0610def8b..a62cc5a9b 100644
--- a/src/core/Bootstrap.cpp
+++ b/src/core/Bootstrap.cpp
@@ -26,201 +26,201 @@
namespace Bootstrap
{
-/**
- * When QNetworkAccessManager is instantiated it regularly starts polling
- * all network interfaces to see if anything changes and if so, what. This
- * creates a latency spike every 10 seconds on Mac OS 10.12+ and Windows 7 >=
- * when on a wifi connection.
- * So here we disable it for lack of better measure.
- * This will also cause this message: QObject::startTimer: Timers cannot
- * have negative intervals
- * For more info see:
- * - https://bugreports.qt.io/browse/QTBUG-40332
- * - https://bugreports.qt.io/browse/QTBUG-46015
- */
-static inline void applyEarlyQNetworkAccessManagerWorkaround()
-{
- qputenv("QT_BEARER_POLL_TIMEOUT", QByteArray::number(-1));
-}
+ /**
+ * When QNetworkAccessManager is instantiated it regularly starts polling
+ * all network interfaces to see if anything changes and if so, what. This
+ * creates a latency spike every 10 seconds on Mac OS 10.12+ and Windows 7 >=
+ * when on a wifi connection.
+ * So here we disable it for lack of better measure.
+ * This will also cause this message: QObject::startTimer: Timers cannot
+ * have negative intervals
+ * For more info see:
+ * - https://bugreports.qt.io/browse/QTBUG-40332
+ * - https://bugreports.qt.io/browse/QTBUG-46015
+ */
+ static inline void applyEarlyQNetworkAccessManagerWorkaround()
+ {
+ qputenv("QT_BEARER_POLL_TIMEOUT", QByteArray::number(-1));
+ }
-/**
- * Perform early application bootstrapping such as setting up search paths,
- * configuration OS security properties, and loading translators.
- * A QApplication object has to be instantiated before calling this function.
- */
-void bootstrapApplication()
-{
+ /**
+ * Perform early application bootstrapping such as setting up search paths,
+ * configuration OS security properties, and loading translators.
+ * A QApplication object has to be instantiated before calling this function.
+ */
+ void bootstrapApplication()
+ {
#ifdef QT_NO_DEBUG
- disableCoreDumps();
+ disableCoreDumps();
#endif
- setupSearchPaths();
- applyEarlyQNetworkAccessManagerWorkaround();
- Translator::installTranslators();
+ setupSearchPaths();
+ applyEarlyQNetworkAccessManagerWorkaround();
+ Translator::installTranslators();
#ifdef Q_OS_MACOS
- // Don't show menu icons on OSX
- QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
+ // Don't show menu icons on OSX
+ QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
-}
-
-/**
- * Restore the main window's state after launch
- *
- * @param mainWindow the main window whose state to restore
- */
-void restoreMainWindowState(MainWindow& mainWindow)
-{
- // start minimized if configured
- if (config()->get("GUI/MinimizeOnStartup").toBool()) {
- mainWindow.showMinimized();
- } else {
- mainWindow.bringToFront();
}
- if (config()->get("OpenPreviousDatabasesOnStartup").toBool()) {
- const QStringList fileNames = config()->get("LastOpenedDatabases").toStringList();
- for (const QString& filename : fileNames) {
- if (!filename.isEmpty() && QFile::exists(filename)) {
- mainWindow.openDatabase(filename);
+ /**
+ * Restore the main window's state after launch
+ *
+ * @param mainWindow the main window whose state to restore
+ */
+ void restoreMainWindowState(MainWindow& mainWindow)
+ {
+ // start minimized if configured
+ if (config()->get("GUI/MinimizeOnStartup").toBool()) {
+ mainWindow.showMinimized();
+ } else {
+ mainWindow.bringToFront();
+ }
+
+ if (config()->get("OpenPreviousDatabasesOnStartup").toBool()) {
+ const QStringList fileNames = config()->get("LastOpenedDatabases").toStringList();
+ for (const QString& filename : fileNames) {
+ if (!filename.isEmpty() && QFile::exists(filename)) {
+ mainWindow.openDatabase(filename);
+ }
}
}
}
-}
-// LCOV_EXCL_START
-void disableCoreDumps()
-{
- // default to true
- // there is no point in printing a warning if this is not implemented on the platform
- bool success = true;
+ // LCOV_EXCL_START
+ void disableCoreDumps()
+ {
+ // default to true
+ // there is no point in printing a warning if this is not implemented on the platform
+ bool success = true;
#if defined(HAVE_RLIMIT_CORE)
- struct rlimit limit;
- limit.rlim_cur = 0;
- limit.rlim_max = 0;
- success = success && (setrlimit(RLIMIT_CORE, &limit) == 0);
+ struct rlimit limit;
+ limit.rlim_cur = 0;
+ limit.rlim_max = 0;
+ success = success && (setrlimit(RLIMIT_CORE, &limit) == 0);
#endif
#if defined(HAVE_PR_SET_DUMPABLE)
- success = success && (prctl(PR_SET_DUMPABLE, 0) == 0);
+ success = success && (prctl(PR_SET_DUMPABLE, 0) == 0);
#endif
// Mac OS X
#ifdef HAVE_PT_DENY_ATTACH
- success = success && (ptrace(PT_DENY_ATTACH, 0, 0, 0) == 0);
+ success = success && (ptrace(PT_DENY_ATTACH, 0, 0, 0) == 0);
#endif
#ifdef Q_OS_WIN
- success = success && createWindowsDACL();
+ success = success && createWindowsDACL();
#endif
- if (!success) {
- qWarning("Unable to disable core dumps.");
+ if (!success) {
+ qWarning("Unable to disable core dumps.");
+ }
}
-}
-
-//
-// This function grants the user associated with the process token minimal access rights and
-// denies everything else on Windows. This includes PROCESS_QUERY_INFORMATION and
-// PROCESS_VM_READ access rights that are required for MiniDumpWriteDump() or ReadProcessMemory().
-// We do this using a discretionary access control list (DACL). Effectively this prevents
-// crash dumps and disallows other processes from accessing our memory. This works as long
-// as you do not have admin privileges, since then you are able to grant yourself the
-// SeDebugPrivilege or SeTakeOwnershipPrivilege and circumvent the DACL.
-//
-bool createWindowsDACL()
-{
- bool bSuccess = false;
+
+ //
+ // This function grants the user associated with the process token minimal access rights and
+ // denies everything else on Windows. This includes PROCESS_QUERY_INFORMATION and
+ // PROCESS_VM_READ access rights that are required for MiniDumpWriteDump() or ReadProcessMemory().
+ // We do this using a discretionary access control list (DACL). Effectively this prevents
+ // crash dumps and disallows other processes from accessing our memory. This works as long
+ // as you do not have admin privileges, since then you are able to grant yourself the
+ // SeDebugPrivilege or SeTakeOwnershipPrivilege and circumvent the DACL.
+ //
+ bool createWindowsDACL()
+ {
+ bool bSuccess = false;
#ifdef Q_OS_WIN
- // Process token and user
- HANDLE hToken = nullptr;
- PTOKEN_USER pTokenUser = nullptr;
- DWORD cbBufferSize = 0;
-
- // Access control list
- PACL pACL = nullptr;
- DWORD cbACL = 0;
-
- // Open the access token associated with the calling process
- if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken)) {
- goto Cleanup;
- }
+ // Process token and user
+ HANDLE hToken = nullptr;
+ PTOKEN_USER pTokenUser = nullptr;
+ DWORD cbBufferSize = 0;
+
+ // Access control list
+ PACL pACL = nullptr;
+ DWORD cbACL = 0;
+
+ // Open the access token associated with the calling process
+ if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken)) {
+ goto Cleanup;
+ }
- // Retrieve the token information in a TOKEN_USER structure
- GetTokenInformation(hToken, TokenUser, nullptr, 0, &cbBufferSize);
+ // Retrieve the token information in a TOKEN_USER structure
+ GetTokenInformation(hToken, TokenUser, nullptr, 0, &cbBufferSize);
- pTokenUser = static_cast<PTOKEN_USER>(HeapAlloc(GetProcessHeap(), 0, cbBufferSize));
- if (pTokenUser == nullptr) {
- goto Cleanup;
- }
+ pTokenUser = static_cast<PTOKEN_USER>(HeapAlloc(GetProcessHeap(), 0, cbBufferSize));
+ if (pTokenUser == nullptr) {
+ goto Cleanup;
+ }
- if (!GetTokenInformation(hToken, TokenUser, pTokenUser, cbBufferSize, &cbBufferSize)) {
- goto Cleanup;
- }
+ if (!GetTokenInformation(hToken, TokenUser, pTokenUser, cbBufferSize, &cbBufferSize)) {
+ goto Cleanup;
+ }
- if (!IsValidSid(pTokenUser->User.Sid)) {
- goto Cleanup;
- }
+ if (!IsValidSid(pTokenUser->User.Sid)) {
+ goto Cleanup;
+ }
- // Calculate the amount of memory that must be allocated for the DACL
- cbACL = sizeof(ACL) + sizeof(ACCESS_ALLOWED_ACE) + GetLengthSid(pTokenUser->User.Sid);
+ // Calculate the amount of memory that must be allocated for the DACL
+ cbACL = sizeof(ACL) + sizeof(ACCESS_ALLOWED_ACE) + GetLengthSid(pTokenUser->User.Sid);
- // Create and initialize an ACL
- pACL = static_cast<PACL>(HeapAlloc(GetProcessHeap(), 0, cbACL));
- if (pACL == nullptr) {
- goto Cleanup;
- }
+ // Create and initialize an ACL
+ pACL = static_cast<PACL>(HeapAlloc(GetProcessHeap(), 0, cbACL));
+ if (pACL == nullptr) {
+ goto Cleanup;
+ }
- if (!InitializeAcl(pACL, cbACL, ACL_REVISION)) {
- goto Cleanup;
- }
+ if (!InitializeAcl(pACL, cbACL, ACL_REVISION)) {
+ goto Cleanup;
+ }
- // Add allowed access control entries, everything else is denied
- if (!AddAccessAllowedAce(
- pACL,
- ACL_REVISION,
- SYNCHRONIZE | PROCESS_QUERY_LIMITED_INFORMATION | PROCESS_TERMINATE, // same as protected process
- pTokenUser->User.Sid // pointer to the trustee's SID
- )) {
- goto Cleanup;
- }
+ // Add allowed access control entries, everything else is denied
+ if (!AddAccessAllowedAce(
+ pACL,
+ ACL_REVISION,
+ SYNCHRONIZE | PROCESS_QUERY_LIMITED_INFORMATION | PROCESS_TERMINATE, // same as protected process
+ pTokenUser->User.Sid // pointer to the trustee's SID
+ )) {
+ goto Cleanup;
+ }
- // Set discretionary access control list
- bSuccess = ERROR_SUCCESS
- == SetSecurityInfo(GetCurrentProcess(), // object handle
- SE_KERNEL_OBJECT, // type of object
- DACL_SECURITY_INFORMATION, // change only the objects DACL
- nullptr,
- nullptr, // do not change owner or group
- pACL, // DACL specified
- nullptr // do not change SACL
- );
-
-Cleanup:
-
- if (pACL != nullptr) {
- HeapFree(GetProcessHeap(), 0, pACL);
- }
- if (pTokenUser != nullptr) {
- HeapFree(GetProcessHeap(), 0, pTokenUser);
- }
- if (hToken != nullptr) {
- CloseHandle(hToken);
- }
+ // Set discretionary access control list
+ bSuccess = ERROR_SUCCESS
+ == SetSecurityInfo(GetCurrentProcess(), // object handle
+ SE_KERNEL_OBJECT, // type of object
+ DACL_SECURITY_INFORMATION, // change only the objects DACL
+ nullptr,
+ nullptr, // do not change owner or group
+ pACL, // DACL specified
+ nullptr // do not change SACL
+ );
+
+ Cleanup:
+
+ if (pACL != nullptr) {
+ HeapFree(GetProcessHeap(), 0, pACL);
+ }
+ if (pTokenUser != nullptr) {
+ HeapFree(GetProcessHeap(), 0, pTokenUser);
+ }
+ if (hToken != nullptr) {
+ CloseHandle(hToken);
+ }
#endif
- return bSuccess;
-}
-// LCOV_EXCL_STOP
+ return bSuccess;
+ }
+ // LCOV_EXCL_STOP
-void setupSearchPaths()
-{
+ void setupSearchPaths()
+ {
#ifdef Q_OS_WIN
- // Make sure Windows doesn't load DLLs from the current working directory
- SetDllDirectoryA("");
- SetSearchPathMode(BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE);
+ // Make sure Windows doesn't load DLLs from the current working directory
+ SetDllDirectoryA("");
+ SetSearchPathMode(BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE);
#endif
-}
+ }
-} // namespace Bootstrap
+} // namespace Bootstrap
diff --git a/src/core/Bootstrap.h b/src/core/Bootstrap.h
index 0e9db155a..95158fb8c 100644
--- a/src/core/Bootstrap.h
+++ b/src/core/Bootstrap.h
@@ -15,7 +15,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
#ifndef KEEPASSXC_BOOTSTRAP_H
#define KEEPASSXC_BOOTSTRAP_H
@@ -23,12 +22,11 @@
namespace Bootstrap
{
-void bootstrapApplication();
-void restoreMainWindowState(MainWindow& mainWindow);
-void disableCoreDumps();
-bool createWindowsDACL();
-void setupSearchPaths();
-};
-
+ void bootstrapApplication();
+ void restoreMainWindowState(MainWindow& mainWindow);
+ void disableCoreDumps();
+ bool createWindowsDACL();
+ void setupSearchPaths();
+}; // namespace Bootstrap
-#endif //KEEPASSXC_BOOTSTRAP_H
+#endif // KEEPASSXC_BOOTSTRAP_H
diff --git a/src/core/Config.cpp b/src/core/Config.cpp
index 01497caf9..66591a851 100644
--- a/src/core/Config.cpp
+++ b/src/core/Config.cpp
@@ -84,7 +84,7 @@ void Config::upgrade()
{
for (const auto& setting : deprecationMap.keys()) {
if (m_settings->contains(setting)) {
- if(!deprecationMap.value(setting).isEmpty()) {
+ if (!deprecationMap.value(setting).isEmpty()) {
// Add entry with new name and old entry's value
m_settings->setValue(deprecationMap.value(setting), m_settings->value(setting));
}
diff --git a/src/core/Database.cpp b/src/core/Database.cpp
index 6d475acf9..ff345c84e 100644
--- a/src/core/Database.cpp
+++ b/src/core/Database.cpp
@@ -720,14 +720,15 @@ QSharedPointer<Database> Database::unlockFromStdin(const QString& databaseFilena
QString errorMessage;
// LCOV_EXCL_START
if (!fileKey->load(keyFilename, &errorMessage)) {
- err << QObject::tr("Failed to load key file %1: %2").arg(keyFilename, errorMessage)<< endl;
+ err << QObject::tr("Failed to load key file %1: %2").arg(keyFilename, errorMessage) << endl;
return {};
}
if (fileKey->type() != FileKey::Hashed) {
err << QObject::tr("WARNING: You are using a legacy key file format which may become\n"
"unsupported in the future.\n\n"
- "Please consider generating a new key file.") << endl;
+ "Please consider generating a new key file.")
+ << endl;
}
// LCOV_EXCL_STOP
diff --git a/src/core/Entry.cpp b/src/core/Entry.cpp
index 793a373bb..55f56f583 100644
--- a/src/core/Entry.cpp
+++ b/src/core/Entry.cpp
@@ -657,12 +657,14 @@ Entry* Entry::clone(CloneFlags flags) const
if (flags & CloneUserAsRef) {
// Build the username reference
QString username = "{REF:U@I:" + uuidToHex() + "}";
- entry->m_attributes->set(EntryAttributes::UserNameKey, username.toUpper(), m_attributes->isProtected(EntryAttributes::UserNameKey));
+ entry->m_attributes->set(
+ EntryAttributes::UserNameKey, username.toUpper(), m_attributes->isProtected(EntryAttributes::UserNameKey));
}
if (flags & ClonePassAsRef) {
QString password = "{REF:P@I:" + uuidToHex() + "}";
- entry->m_attributes->set(EntryAttributes::PasswordKey, password.toUpper(), m_attributes->isProtected(EntryAttributes::PasswordKey));
+ entry->m_attributes->set(
+ EntryAttributes::PasswordKey, password.toUpper(), m_attributes->isProtected(EntryAttributes::PasswordKey));
}
entry->m_autoTypeAssociations->copyDataFrom(m_autoTypeAssociations);
@@ -1065,7 +1067,8 @@ QString Entry::resolveUrl(const QString& url) const
// Validate the URL
QUrl tempUrl = QUrl(newUrl);
- if (tempUrl.isValid() && (tempUrl.scheme() == "http" || tempUrl.scheme() == "https" || tempUrl.scheme() == "file")) {
+ if (tempUrl.isValid()
+ && (tempUrl.scheme() == "http" || tempUrl.scheme() == "https" || tempUrl.scheme() == "file")) {
return tempUrl.url();
}
diff --git a/src/core/Entry.h b/src/core/Entry.h
index f6518bdd3..655cc3621 100644
--- a/src/core/Entry.h
+++ b/src/core/Entry.h
@@ -36,7 +36,8 @@
class Database;
class Group;
-namespace Totp {
+namespace Totp
+{
struct Settings;
}
diff --git a/src/core/EntryAttributes.cpp b/src/core/EntryAttributes.cpp
index b9fcd9ac2..fc0793ce8 100644
--- a/src/core/EntryAttributes.cpp
+++ b/src/core/EntryAttributes.cpp
@@ -23,8 +23,8 @@ const QString EntryAttributes::UserNameKey = "UserName";
const QString EntryAttributes::PasswordKey = "Password";
const QString EntryAttributes::URLKey = "URL";
const QString EntryAttributes::NotesKey = "Notes";
-const QStringList EntryAttributes::DefaultAttributes(QStringList() << TitleKey << UserNameKey << PasswordKey << URLKey
- << NotesKey);
+const QStringList EntryAttributes::DefaultAttributes(QStringList()
+ << TitleKey << UserNameKey << PasswordKey << URLKey << NotesKey);
const QString EntryAttributes::WantedFieldGroupName = "WantedField";
const QString EntryAttributes::SearchInGroupName = "SearchIn";
diff --git a/src/core/Group.cpp b/src/core/Group.cpp
index 2051fe437..ec7633b88 100644
--- a/src/core/Group.cpp
+++ b/src/core/Group.cpp
@@ -630,10 +630,12 @@ Entry* Group::findEntryByPathRecursive(const QString& entryPath, const QString&
// Return the first entry that matches the full path OR if there is no leading
// slash, return the first entry title that matches
for (Entry* entry : entries()) {
+ // clang-format off
if (entryPath == (basePath + entry->title())
|| (!entryPath.startsWith("/") && entry->title() == entryPath)) {
return entry;
}
+ // clang-format on
}
for (Group* group : children()) {
@@ -654,9 +656,11 @@ Group* Group::findGroupByPath(const QString& groupPath)
if (groupPath.isEmpty()) {
normalizedGroupPath = QString("/"); // root group
} else {
+ // clang-format off
normalizedGroupPath = (groupPath.startsWith("/") ? "" : "/")
+ groupPath
+ (groupPath.endsWith("/") ? "" : "/");
+ // clang-format on
}
return findGroupByPathRecursive(normalizedGroupPath, "/");
}
@@ -894,6 +898,7 @@ void Group::connectDatabaseSignalsRecursive(Database* db)
}
if (db) {
+ // clang-format off
connect(this, SIGNAL(groupDataChanged(Group*)), db, SIGNAL(groupDataChanged(Group*)));
connect(this, SIGNAL(groupAboutToRemove(Group*)), db, SIGNAL(groupAboutToRemove(Group*)));
connect(this, SIGNAL(groupRemoved()), db, SIGNAL(groupRemoved()));
@@ -902,6 +907,7 @@ void Group::connectDatabaseSignalsRecursive(Database* db)
connect(this, SIGNAL(aboutToMove(Group*,Group*,int)), db, SIGNAL(groupAboutToMove(Group*,Group*,int)));
connect(this, SIGNAL(groupMoved()), db, SIGNAL(groupMoved()));
connect(this, SIGNAL(groupModified()), db, SLOT(markAsModified()));
+ // clang-format on
}
m_db = db;
diff --git a/src/core/InactivityTimer.cpp b/src/core/InactivityTimer.cpp
index 405970cc6..85c58d269 100644
--- a/src/core/InactivityTimer.cpp
+++ b/src/core/InactivityTimer.cpp
@@ -55,12 +55,13 @@ void InactivityTimer::deactivate()
bool InactivityTimer::eventFilter(QObject* watched, QEvent* event)
{
const QEvent::Type type = event->type();
-
+ // clang-format off
if ((type >= QEvent::MouseButtonPress && type <= QEvent::KeyRelease)
|| (type >= QEvent::HoverEnter && type <= QEvent::HoverMove)
|| (type == QEvent::Wheel)) {
m_timer->start();
}
+ // clang-format on
return QObject::eventFilter(watched, event);
}
diff --git a/src/core/Merger.cpp b/src/core/Merger.cpp
index 0da7458ea..cc57ae3b2 100644
--- a/src/core/Merger.cpp
+++ b/src/core/Merger.cpp
@@ -93,7 +93,8 @@ Merger::ChangeList Merger::mergeGroup(const MergeContext& context)
moveEntry(targetEntry, context.m_targetGroup);
} else {
// Entry is already present in the database. Update it.
- const bool locationChanged = targetEntry->timeInfo().locationChanged() < sourceEntry->timeInfo().locationChanged();
+ const bool locationChanged =
+ targetEntry->timeInfo().locationChanged() < sourceEntry->timeInfo().locationChanged();
if (locationChanged && targetEntry->group() != context.m_targetGroup) {
changes << tr("Relocating %1 [%2]").arg(sourceEntry->title(), sourceEntry->uuidToHex());
moveEntry(targetEntry, context.m_targetGroup);
@@ -136,7 +137,8 @@ Merger::ChangeList Merger::mergeGroup(const MergeContext& context)
return changes;
}
-Merger::ChangeList Merger::resolveGroupConflict(const MergeContext& context, const Group* sourceChildGroup, Group* targetChildGroup)
+Merger::ChangeList
+Merger::resolveGroupConflict(const MergeContext& context, const Group* sourceChildGroup, Group* targetChildGroup)
{
Q_UNUSED(context);
ChangeList changes;
@@ -261,10 +263,13 @@ void Merger::eraseGroup(Group* group)
database->setDeletedObjects(deletions);
}
-Merger::ChangeList Merger::resolveEntryConflict_Duplicate(const MergeContext& context, const Entry* sourceEntry, Entry* targetEntry)
+Merger::ChangeList
+Merger::resolveEntryConflict_Duplicate(const MergeContext& context, const Entry* sourceEntry, Entry* targetEntry)
{
ChangeList changes;
- const int comparison = compare(targetEntry->timeInfo().lastModificationTime(), sourceEntry->timeInfo().lastModificationTime(), CompareItemIgnoreMilliseconds);
+ const int comparison = compare(targetEntry->timeInfo().lastModificationTime(),
+ sourceEntry->timeInfo().lastModificationTime(),
+ CompareItemIgnoreMilliseconds);
// if one entry is newer, create a clone and add it to the group
if (comparison < 0) {
Entry* clonedEntry = sourceEntry->clone(Entry::CloneNewUuid | Entry::CloneIncludeHistory);
@@ -280,11 +285,14 @@ Merger::ChangeList Merger::resolveEntryConflict_Duplicate(const MergeContext& co
return changes;
}
-Merger::ChangeList Merger::resolveEntryConflict_KeepLocal(const MergeContext& context, const Entry* sourceEntry, Entry* targetEntry)
+Merger::ChangeList
+Merger::resolveEntryConflict_KeepLocal(const MergeContext& context, const Entry* sourceEntry, Entry* targetEntry)
{
Q_UNUSED(context);
ChangeList changes;
- const int comparison = compare(targetEntry->timeInfo().lastModificationTime(), sourceEntry->timeInfo().lastModificationTime(), CompareItemIgnoreMilliseconds);
+ const int comparison = compare(targetEntry->timeInfo().lastModificationTime(),
+ sourceEntry->timeInfo().lastModificationTime(),
+ CompareItemIgnoreMilliseconds);
if (comparison < 0) {
// we need to make our older entry "newer" than the new entry - therefore
// we just create a new history entry without any changes - this preserves
@@ -293,18 +301,21 @@ Merger::ChangeList Merger::resolveEntryConflict_KeepLocal(const MergeContext& co
// this type of merge changes the database timestamp since reapplying the
// old entry is an active change of the database!
changes << tr("Reapplying older target entry on top of newer source %1 [%2]")
- .arg(targetEntry->title(), targetEntry->uuidToHex());
+ .arg(targetEntry->title(), targetEntry->uuidToHex());
Entry* agedTargetEntry = targetEntry->clone(Entry::CloneNoFlags);
targetEntry->addHistoryItem(agedTargetEntry);
}
return changes;
}
-Merger::ChangeList Merger::resolveEntryConflict_KeepRemote(const MergeContext& context, const Entry* sourceEntry, Entry* targetEntry)
+Merger::ChangeList
+Merger::resolveEntryConflict_KeepRemote(const MergeContext& context, const Entry* sourceEntry, Entry* targetEntry)
{
Q_UNUSED(context);
ChangeList changes;
- const int comparison = compare(targetEntry->timeInfo().lastModificationTime(), sourceEntry->timeInfo().lastModificationTime(), CompareItemIgnoreMilliseconds);
+ const int comparison = compare(targetEntry->timeInfo().lastModificationTime(),
+ sourceEntry->timeInfo().lastModificationTime(),
+ CompareItemIgnoreMilliseconds);
if (comparison > 0) {
// we need to make our older entry "newer" than the new entry - therefore
// we just create a new history entry without any changes - this preserves
@@ -313,7 +324,7 @@ Merger::ChangeList Merger::resolveEntryConflict_KeepRemote(const MergeContext& c
// this type of merge changes the database timestamp since reapplying the
// old entry is an active change of the database!
changes << tr("Reapplying older source entry on top of newer target %1 [%2]")
- .arg(targetEntry->title(), targetEntry->uuidToHex());
+ .arg(targetEntry->title(), targetEntry->uuidToHex());
targetEntry->beginUpdate();
targetEntry->copyDataFrom(sourceEntry);
targetEntry->endUpdate();
@@ -322,13 +333,17 @@ Merger::ChangeList Merger::resolveEntryConflict_KeepRemote(const MergeContext& c
return changes;
}
-
-Merger::ChangeList Merger::resolveEntryConflict_MergeHistories(const MergeContext& context, const Entry* sourceEntry, Entry* targetEntry, Group::MergeMode mergeMethod)
+Merger::ChangeList Merger::resolveEntryConflict_MergeHistories(const MergeContext& context,
+ const Entry* sourceEntry,
+ Entry* targetEntry,
+ Group::MergeMode mergeMethod)
{
Q_UNUSED(context);
ChangeList changes;
- const int comparison = compare(targetEntry->timeInfo().lastModificationTime(), sourceEntry->timeInfo().lastModificationTime(), CompareItemIgnoreMilliseconds);
+ const int comparison = compare(targetEntry->timeInfo().lastModificationTime(),
+ sourceEntry->timeInfo().lastModificationTime(),
+ CompareItemIgnoreMilliseconds);
if (comparison < 0) {
Group* currentGroup = targetEntry->group();
Entry* clonedEntry = sourceEntry->clone(Entry::CloneIncludeHistory);
@@ -347,14 +362,15 @@ Merger::ChangeList Merger::resolveEntryConflict_MergeHistories(const MergeContex
qPrintable(targetEntry->group()->name()));
const bool changed = mergeHistory(sourceEntry, targetEntry, mergeMethod);
if (changed) {
- changes << tr("Synchronizing from older source %1 [%2]").arg(targetEntry->title(), targetEntry->uuidToHex());
+ changes
+ << tr("Synchronizing from older source %1 [%2]").arg(targetEntry->title(), targetEntry->uuidToHex());
}
}
return changes;
}
-
-Merger::ChangeList Merger::resolveEntryConflict(const MergeContext& context, const Entry* sourceEntry, Entry* targetEntry)
+Merger::ChangeList
+Merger::resolveEntryConflict(const MergeContext& context, const Entry* sourceEntry, Entry* targetEntry)
{
ChangeList changes;
// We need to cut off the milliseconds since the persistent format only supports times down to seconds
@@ -395,15 +411,19 @@ bool Merger::mergeHistory(const Entry* sourceEntry, Entry* targetEntry, Group::M
Q_UNUSED(mergeMethod);
const auto targetHistoryItems = targetEntry->historyItems();
const auto sourceHistoryItems = sourceEntry->historyItems();
- const int comparison = compare(sourceEntry->timeInfo().lastModificationTime(), targetEntry->timeInfo().lastModificationTime(), CompareItemIgnoreMilliseconds);
+ const int comparison = compare(sourceEntry->timeInfo().lastModificationTime(),
+ targetEntry->timeInfo().lastModificationTime(),
+ CompareItemIgnoreMilliseconds);
const bool preferLocal = mergeMethod == Group::KeepLocal || comparison < 0;
const bool preferRemote = mergeMethod == Group::KeepRemote || comparison > 0;
QMap<QDateTime, Entry*> merged;
for (Entry* historyItem : targetHistoryItems) {
const QDateTime modificationTime = Clock::serialized(historyItem->timeInfo().lastModificationTime());
- if (merged.contains(modificationTime) && !merged[modificationTime]->equals(historyItem, CompareItemIgnoreMilliseconds)) {
- ::qWarning("Inconsistent history entry of %s[%s] at %s contains conflicting changes - conflict resolution may lose data!",
+ if (merged.contains(modificationTime)
+ && !merged[modificationTime]->equals(historyItem, CompareItemIgnoreMilliseconds)) {
+ ::qWarning("Inconsistent history entry of %s[%s] at %s contains conflicting changes - conflict resolution "
+ "may lose data!",
qPrintable(sourceEntry->title()),
qPrintable(sourceEntry->uuidToHex()),
qPrintable(modificationTime.toString("yyyy-MM-dd HH-mm-ss-zzz")));
@@ -413,8 +433,10 @@ bool Merger::mergeHistory(const Entry* sourceEntry, Entry* targetEntry, Group::M
for (Entry* historyItem : sourceHistoryItems) {
// Items with same modification-time changes will be regarded as same (like KeePass2)
const QDateTime modificationTime = Clock::serialized(historyItem->timeInfo().lastModificationTime());
- if (merged.contains(modificationTime) && !merged[modificationTime]->equals(historyItem, CompareItemIgnoreMilliseconds)) {
- ::qWarning("History entry of %s[%s] at %s contains conflicting changes - conflict resolution may lose data!",
+ if (merged.contains(modificationTime)
+ && !merged[modificationTime]->equals(historyItem, CompareItemIgnoreMilliseconds)) {
+ ::qWarning(
+ "History entry of %s[%s] at %s contains conflicting changes - conflict resolution may lose data!",
qPrintable(sourceEntry->title()),
qPrintable(sourceEntry->uuidToHex()),
qPrintable(modificationTime.toString("yyyy-MM-dd HH-mm-ss-zzz")));
@@ -430,7 +452,9 @@ bool Merger::mergeHistory(const Entry* sourceEntry, Entry* targetEntry, Group::M
const QDateTime targetModificationTime = Clock::serialized(targetEntry->timeInfo().lastModificationTime());
const QDateTime sourceModificationTime = Clock::serialized(sourceEntry->timeInfo().lastModificationTime());
- if (targetModificationTime == sourceModificationTime && !targetEntry->equals(sourceEntry, CompareItemIgnoreMilliseconds | CompareItemIgnoreHistory | CompareItemIgnoreLocation)) {
+ if (targetModificationTime == sourceModificationTime
+ && !targetEntry->equals(sourceEntry,
+ CompareItemIgnoreMilliseconds | CompareItemIgnoreHistory | CompareItemIgnoreLocation)) {
::qWarning("Entry of %s[%s] contains conflicting changes - conflict resolution may lose data!",
qPrintable(sourceEntry->title()),
qPrintable(sourceEntry->uuidToHex()));
diff --git a/src/core/Merger.h b/src/core/Merger.h
index 1f16fe026..03a47a27f 100644
--- a/src/core/Merger.h
+++ b/src/core/Merger.h
@@ -55,14 +55,22 @@ private:
bool mergeHistory(const Entry* sourceEntry, Entry* targetEntry, Group::MergeMode mergeMethod);
void moveEntry(Entry* entry, Group* targetGroup);
void moveGroup(Group* group, Group* targetGroup);
- void eraseEntry(Entry* entry); // remove an entry without a trace in the deletedObjects - needed for elemination cloned entries
- void eraseGroup(Group* group); // remove an entry without a trace in the deletedObjects - needed for elemination cloned entries
+ // remove an entry without a trace in the deletedObjects - needed for elemination cloned entries
+ void eraseEntry(Entry* entry);
+ // remove an entry without a trace in the deletedObjects - needed for elemination cloned entries
+ void eraseGroup(Group* group);
ChangeList resolveEntryConflict(const MergeContext& context, const Entry* existingEntry, Entry* otherEntry);
ChangeList resolveGroupConflict(const MergeContext& context, const Group* existingGroup, Group* otherGroup);
- Merger::ChangeList resolveEntryConflict_Duplicate(const MergeContext& context, const Entry* sourceEntry, Entry* targetEntry);
- Merger::ChangeList resolveEntryConflict_KeepLocal(const MergeContext& context, const Entry* sourceEntry, Entry* targetEntry);
- Merger::ChangeList resolveEntryConflict_KeepRemote(const MergeContext& context, const Entry* sourceEntry, Entry* targetEntry);
- Merger::ChangeList resolveEntryConflict_MergeHistories(const MergeContext& context, const Entry* sourceEntry, Entry* targetEntry, Group::MergeMode mergeMethod);
+ Merger::ChangeList
+ resolveEntryConflict_Duplicate(const MergeContext& context, const Entry* sourceEntry, Entry* targetEntry);
+ Merger::ChangeList
+ resolveEntryConflict_KeepLocal(const MergeContext& context, const Entry* sourceEntry, Entry* targetEntry);
+ Merger::ChangeList
+ resolveEntryConflict_KeepRemote(const MergeContext& context, const Entry* sourceEntry, Entry* targetEntry);
+ Merger::ChangeList resolveEntryConflict_MergeHistories(const MergeContext& context,
+ const Entry* sourceEntry,
+ Entry* targetEntry,
+ Group::MergeMode mergeMethod);
private:
MergeContext m_context;
diff --git a/src/core/Metadata.cpp b/src/core/Metadata.cpp
index 40bf52775..45010a4ff 100644
--- a/src/core/Metadata.cpp
+++ b/src/core/Metadata.cpp
@@ -429,7 +429,7 @@ void Metadata::removeCustomIcon(const QUuid& uuid)
emit metadataModified();
}
-QUuid Metadata::findCustomIcon(const QImage &candidate)
+QUuid Metadata::findCustomIcon(const QImage& candidate)
{
QByteArray hash = hashImage(candidate);
return m_customIconsHashes.value(hash, QUuid());
diff --git a/src/core/OSEventFilter.h b/src/core/OSEventFilter.h
index 1dca5392e..a27ade713 100644
--- a/src/core/OSEventFilter.h
+++ b/src/core/OSEventFilter.h
@@ -9,6 +9,7 @@ class OSEventFilter : public QAbstractNativeEventFilter
public:
OSEventFilter();
bool nativeEventFilter(const QByteArray& eventType, void* message, long* result) override;
+
private:
Q_DISABLE_COPY(OSEventFilter)
};
diff --git a/src/core/PasswordGenerator.cpp b/src/core/PasswordGenerator.cpp
index 69a0dfb3e..1132582d6 100644
--- a/src/core/PasswordGenerator.cpp
+++ b/src/core/PasswordGenerator.cpp
@@ -124,7 +124,6 @@ bool PasswordGenerator::isValid() const
}
return !passwordGroups().isEmpty();
-
}
QVector<PasswordGroup> PasswordGenerator::passwordGroups() const
diff --git a/src/core/Tools.cpp b/src/core/Tools.cpp
index 362cfa937..673e6a604 100644
--- a/src/core/Tools.cpp
+++ b/src/core/Tools.cpp
@@ -22,14 +22,12 @@
#include "core/Translator.h"
#include <QCoreApplication>
+#include <QElapsedTimer>
#include <QIODevice>
#include <QImageReader>
#include <QLocale>
-#include <QStringList>
#include <QRegularExpression>
-
-#include <QElapsedTimer>
-
+#include <QStringList>
#include <cctype>
#ifdef Q_OS_WIN
@@ -59,147 +57,145 @@
namespace Tools
{
-QString humanReadableFileSize(qint64 bytes, quint32 precision)
-{
- constexpr auto kibibyte = 1024;
- double size = bytes;
-
- QStringList units = QStringList() << "B"
- << "KiB"
- << "MiB"
- << "GiB";
- int i = 0;
- int maxI = units.size() - 1;
-
- while ((size >= kibibyte) && (i < maxI)) {
- size /= kibibyte;
- i++;
- }
-
- return QString("%1 %2").arg(QLocale().toString(size, 'f', precision), units.at(i));
-}
+ QString humanReadableFileSize(qint64 bytes, quint32 precision)
+ {
+ constexpr auto kibibyte = 1024;
+ double size = bytes;
+
+ QStringList units = QStringList() << "B"
+ << "KiB"
+ << "MiB"
+ << "GiB";
+ int i = 0;
+ int maxI = units.size() - 1;
+
+ while ((size >= kibibyte) && (i < maxI)) {
+ size /= kibibyte;
+ i++;
+ }
-bool readFromDevice(QIODevice* device, QByteArray& data, int size)
-{
- QByteArray buffer;
- buffer.resize(size);
-
- qint64 readResult = device->read(buffer.data(), size);
- if (readResult == -1) {
- return false;
- } else {
- buffer.resize(readResult);
- data = buffer;
- return true;
+ return QString("%1 %2").arg(QLocale().toString(size, 'f', precision), units.at(i));
}
-}
-bool readAllFromDevice(QIODevice* device, QByteArray& data)
-{
- QByteArray result;
- qint64 readBytes = 0;
- qint64 readResult;
- do {
- result.resize(result.size() + 16384);
- readResult = device->read(result.data() + readBytes, result.size() - readBytes);
- if (readResult > 0) {
- readBytes += readResult;
+ bool readFromDevice(QIODevice* device, QByteArray& data, int size)
+ {
+ QByteArray buffer;
+ buffer.resize(size);
+
+ qint64 readResult = device->read(buffer.data(), size);
+ if (readResult == -1) {
+ return false;
+ } else {
+ buffer.resize(readResult);
+ data = buffer;
+ return true;
}
}
- while (readResult > 0);
- if (readResult == -1) {
- return false;
- } else {
- result.resize(static_cast<int>(readBytes));
- data = result;
- return true;
+ bool readAllFromDevice(QIODevice* device, QByteArray& data)
+ {
+ QByteArray result;
+ qint64 readBytes = 0;
+ qint64 readResult;
+ do {
+ result.resize(result.size() + 16384);
+ readResult = device->read(result.data() + readBytes, result.size() - readBytes);
+ if (readResult > 0) {
+ readBytes += readResult;
+ }
+ } while (readResult > 0);
+
+ if (readResult == -1) {
+ return false;
+ } else {
+ result.resize(static_cast<int>(readBytes));
+ data = result;
+ return true;
+ }
}
-}
-QString imageReaderFilter()
-{
- const QList<QByteArray> formats = QImageReader::supportedImageFormats();
- QStringList formatsStringList;
+ QString imageReaderFilter()
+ {
+ const QList<QByteArray> formats = QImageReader::supportedImageFormats();
+ QStringList formatsStringList;
- for (const QByteArray& format : formats) {
- for (char codePoint : format) {
- if (!QChar(codePoint).isLetterOrNumber()) {
- continue;
+ for (const QByteArray& format : formats) {
+ for (char codePoint : format) {
+ if (!QChar(codePoint).isLetterOrNumber()) {
+ continue;
+ }
}
+
+ formatsStringList.append("*." + QString::fromLatin1(format).toLower());
}
- formatsStringList.append("*." + QString::fromLatin1(format).toLower());
+ return formatsStringList.join(" ");
}
- return formatsStringList.join(" ");
-}
-
-bool isHex(const QByteArray& ba)
-{
- for (const unsigned char c : ba) {
- if (!std::isxdigit(c)) {
- return false;
+ bool isHex(const QByteArray& ba)
+ {
+ for (const unsigned char c : ba) {
+ if (!std::isxdigit(c)) {
+ return false;
+ }
}
+
+ return true;
}
- return true;
-}
+ bool isBase64(const QByteArray& ba)
+ {
+ constexpr auto pattern = R"(^(?:[a-z0-9+]{4})*(?:[a-z0-9+]{3}=|[a-z0-9+]{2}==)?$)";
+ QRegExp regexp(pattern, Qt::CaseInsensitive, QRegExp::RegExp2);
-bool isBase64(const QByteArray& ba)
-{
- constexpr auto pattern = R"(^(?:[a-z0-9+]{4})*(?:[a-z0-9+]{3}=|[a-z0-9+]{2}==)?$)";
- QRegExp regexp(pattern, Qt::CaseInsensitive, QRegExp::RegExp2);
+ QString base64 = QString::fromLatin1(ba.constData(), ba.size());
- QString base64 = QString::fromLatin1(ba.constData(), ba.size());
+ return regexp.exactMatch(base64);
+ }
- return regexp.exactMatch(base64);
-}
+ void sleep(int ms)
+ {
+ Q_ASSERT(ms >= 0);
-void sleep(int ms)
-{
- Q_ASSERT(ms >= 0);
-
- if (ms == 0) {
- return;
- }
+ if (ms == 0) {
+ return;
+ }
#ifdef Q_OS_WIN
- Sleep(uint(ms));
+ Sleep(uint(ms));
#else
- timespec ts;
- ts.tv_sec = ms/1000;
- ts.tv_nsec = (ms%1000)*1000*1000;
- nanosleep(&ts, nullptr);
+ timespec ts;
+ ts.tv_sec = ms / 1000;
+ ts.tv_nsec = (ms % 1000) * 1000 * 1000;
+ nanosleep(&ts, nullptr);
#endif
-}
-
-void wait(int ms)
-{
- Q_ASSERT(ms >= 0);
-
- if (ms == 0) {
- return;
}
- QElapsedTimer timer;
- timer.start();
+ void wait(int ms)
+ {
+ Q_ASSERT(ms >= 0);
- if (ms <= 50) {
- QCoreApplication::processEvents(QEventLoop::AllEvents, ms);
- sleep(qMax(ms - static_cast<int>(timer.elapsed()), 0));
- } else {
- int timeLeft;
- do {
- timeLeft = ms - timer.elapsed();
- if (timeLeft > 0) {
- QCoreApplication::processEvents(QEventLoop::AllEvents, timeLeft);
- sleep(10);
- }
+ if (ms == 0) {
+ return;
+ }
+
+ QElapsedTimer timer;
+ timer.start();
+
+ if (ms <= 50) {
+ QCoreApplication::processEvents(QEventLoop::AllEvents, ms);
+ sleep(qMax(ms - static_cast<int>(timer.elapsed()), 0));
+ } else {
+ int timeLeft;
+ do {
+ timeLeft = ms - timer.elapsed();
+ if (timeLeft > 0) {
+ QCoreApplication::processEvents(QEventLoop::AllEvents, timeLeft);
+ sleep(10);
+ }
+ } while (!timer.hasExpired(ms));
}
- while (!timer.hasExpired(ms));
}
-}
// Escape common regex symbols except for *, ?, and |
auto regexEscape = QRegularExpression(R"re(([-[\]{}()+.,\\\/^$#]))re");
diff --git a/src/core/Tools.h b/src/core/Tools.h
index 37214f069..984bab491 100644
--- a/src/core/Tools.h
+++ b/src/core/Tools.h
@@ -31,28 +31,28 @@ class QRegularExpression;
namespace Tools
{
-QString humanReadableFileSize(qint64 bytes, quint32 precision = 2);
-bool readFromDevice(QIODevice* device, QByteArray& data, int size = 16384);
-bool readAllFromDevice(QIODevice* device, QByteArray& data);
-QString imageReaderFilter();
-bool isHex(const QByteArray& ba);
-bool isBase64(const QByteArray& ba);
-void sleep(int ms);
-void wait(int ms);
-QRegularExpression convertToRegex(const QString& string, bool useWildcards = false, bool exactMatch = false,
- bool caseSensitive = false);
-
-template <typename RandomAccessIterator, typename T>
-RandomAccessIterator binaryFind(RandomAccessIterator begin, RandomAccessIterator end, const T& value)
-{
- RandomAccessIterator it = std::lower_bound(begin, end, value);
-
- if ((it == end) || (value < *it)) {
- return end;
- } else {
- return it;
+ QString humanReadableFileSize(qint64 bytes, quint32 precision = 2);
+ bool readFromDevice(QIODevice* device, QByteArray& data, int size = 16384);
+ bool readAllFromDevice(QIODevice* device, QByteArray& data);
+ QString imageReaderFilter();
+ bool isHex(const QByteArray& ba);
+ bool isBase64(const QByteArray& ba);
+ void sleep(int ms);
+ void wait(int ms);
+ QRegularExpression convertToRegex(const QString& string, bool useWildcards = false,
+ bool exactMatch = false, bool caseSensitive = false);
+
+ template <typename RandomAccessIterator, typename T>
+ RandomAccessIterator binaryFind(RandomAccessIterator begin, RandomAccessIterator end, const T& value)
+ {
+ RandomAccessIterator it = std::lower_bound(begin, end, value);
+
+ if ((it == end) || (value < *it)) {
+ return end;
+ } else {
+ return it;
+ }
}
-}
} // namespace Tools
diff --git a/src/crypto/Crypto.cpp b/src/crypto/Crypto.cpp
index fffcddfbd..ab97322ca 100644
--- a/src/crypto/Crypto.cpp
+++ b/src/crypto/Crypto.cpp
@@ -144,8 +144,9 @@ bool Crypto::testSha512()
QByteArray sha512Test =
CryptoHash::hash("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", CryptoHash::Sha512);
- if (sha512Test != QByteArray::fromHex("204a8fc6dda82f0a0ced7beb8e08a41657c16ef468b228a8279be331a703c33596fd15c13b1b"
- "07f9aa1d3bea57789ca031ad85c7a71dd70354ec631238ca3445")) {
+ if (sha512Test
+ != QByteArray::fromHex("204a8fc6dda82f0a0ced7beb8e08a41657c16ef468b228a8279be331a703c33596fd15c13b1b"
+ "07f9aa1d3bea57789ca031ad85c7a71dd70354ec631238ca3445")) {
raiseError("SHA-512 mismatch.");
return false;
}
diff --git a/src/crypto/SymmetricCipher.cpp b/src/crypto/SymmetricCipher.cpp
index 10077e7e5..3637161ee 100644
--- a/src/crypto/SymmetricCipher.cpp
+++ b/src/crypto/SymmetricCipher.cpp
@@ -1,19 +1,19 @@
/*
-* Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 or (at your option)
-* version 3 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include "SymmetricCipher.h"
diff --git a/src/crypto/SymmetricCipher.h b/src/crypto/SymmetricCipher.h
index ede5ab1a4..e0e91aff1 100644
--- a/src/crypto/SymmetricCipher.h
+++ b/src/crypto/SymmetricCipher.h
@@ -1,19 +1,19 @@
/*
-* Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 or (at your option)
-* version 3 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef KEEPASSX_SYMMETRICCIPHER_H
#define KEEPASSX_SYMMETRICCIPHER_H
diff --git a/src/crypto/SymmetricCipherBackend.h b/src/crypto/SymmetricCipherBackend.h
index 27a39177e..781e33484 100644
--- a/src/crypto/SymmetricCipherBackend.h
+++ b/src/crypto/SymmetricCipherBackend.h
@@ -1,19 +1,19 @@
/*
-* Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 or (at your option)
-* version 3 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef KEEPASSX_SYMMETRICCIPHERBACKEND_H
#define KEEPASSX_SYMMETRICCIPHERBACKEND_H
diff --git a/src/crypto/SymmetricCipherGcrypt.cpp b/src/crypto/SymmetricCipherGcrypt.cpp
index e3bc88cbf..8466954d6 100644
--- a/src/crypto/SymmetricCipherGcrypt.cpp
+++ b/src/crypto/SymmetricCipherGcrypt.cpp
@@ -1,19 +1,19 @@
/*
-* Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 or (at your option)
-* version 3 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include "SymmetricCipherGcrypt.h"
diff --git a/src/crypto/SymmetricCipherGcrypt.h b/src/crypto/SymmetricCipherGcrypt.h
index 6f806b90b..20feca10a 100644
--- a/src/crypto/SymmetricCipherGcrypt.h
+++ b/src/crypto/SymmetricCipherGcrypt.h
@@ -1,19 +1,19 @@
/*
-* Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 or (at your option)
-* version 3 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef KEEPASSX_SYMMETRICCIPHERGCRYPT_H
#define KEEPASSX_SYMMETRICCIPHERGCRYPT_H
diff --git a/src/crypto/kdf/Argon2Kdf.h b/src/crypto/kdf/Argon2Kdf.h
index 2f029a570..73b7f8529 100644
--- a/src/crypto/kdf/Argon2Kdf.h
+++ b/src/crypto/kdf/Argon2Kdf.h
@@ -46,12 +46,12 @@ protected:
private:
Q_REQUIRED_RESULT static bool transformKeyRaw(const QByteArray& key,
- const QByteArray& seed,
- quint32 version,
- quint32 rounds,
- quint64 memory,
- quint32 parallelism,
- QByteArray& result);
+ const QByteArray& seed,
+ quint32 version,
+ quint32 rounds,
+ quint64 memory,
+ quint32 parallelism,
+ QByteArray& result);
};
#endif // KEEPASSX_ARGON2KDF_H
diff --git a/src/crypto/kdf/Kdf.h b/src/crypto/kdf/Kdf.h
index 1dff11067..36b4772f2 100644
--- a/src/crypto/kdf/Kdf.h
+++ b/src/crypto/kdf/Kdf.h
@@ -18,8 +18,8 @@
#ifndef KEEPASSX_KDF_H
#define KEEPASSX_KDF_H
-#include <QVariant>
#include <QUuid>
+#include <QVariant>
#define KDF_DEFAULT_SEED_SIZE 32
#define KDF_DEFAULT_ROUNDS 1000000ull
diff --git a/src/format/Kdbx3Reader.cpp b/src/format/Kdbx3Reader.cpp
index 2ef6820ca..4fec74718 100644
--- a/src/format/Kdbx3Reader.cpp
+++ b/src/format/Kdbx3Reader.cpp
@@ -42,8 +42,7 @@ bool Kdbx3Reader::readDatabaseImpl(QIODevice* device,
// check if all required headers were present
if (m_masterSeed.isEmpty() || m_encryptionIV.isEmpty() || m_streamStartBytes.isEmpty()
- || m_protectedStreamKey.isEmpty()
- || db->cipher().isNull()) {
+ || m_protectedStreamKey.isEmpty() || db->cipher().isNull()) {
raiseError(tr("missing database headers"));
return false;
}
diff --git a/src/format/Kdbx3Writer.cpp b/src/format/Kdbx3Writer.cpp
index 20af01406..b2de41f44 100644
--- a/src/format/Kdbx3Writer.cpp
+++ b/src/format/Kdbx3Writer.cpp
@@ -66,9 +66,10 @@ bool Kdbx3Writer::writeDatabase(QIODevice* device, Database* db)
writeMagicNumbers(&header, KeePass2::SIGNATURE_1, KeePass2::SIGNATURE_2, KeePass2::FILE_VERSION_3_1);
CHECK_RETURN_FALSE(writeHeaderField<quint16>(&header, KeePass2::HeaderFieldID::CipherID, db->cipher().toRfc4122()));
- CHECK_RETURN_FALSE(writeHeaderField<quint16>(&header, KeePass2::HeaderFieldID::CompressionFlags,
- Endian::sizedIntToBytes<qint32>(db->compressionAlgorithm(),
- KeePass2::BYTEORDER)));
+ CHECK_RETURN_FALSE(
+ writeHeaderField<quint16>(&header,
+ KeePass2::HeaderFieldID::CompressionFlags,
+ Endian::sizedIntToBytes<qint32>(db->compressionAlgorithm(), KeePass2::BYTEORDER)));
auto kdf = db->kdf();
CHECK_RETURN_FALSE(writeHeaderField<quint16>(&header, KeePass2::HeaderFieldID::MasterSeed, masterSeed));
CHECK_RETURN_FALSE(writeHeaderField<quint16>(&header, KeePass2::HeaderFieldID::TransformSeed, kdf->seed()));
diff --git a/src/format/Kdbx4Writer.cpp b/src/format/Kdbx4Writer.cpp
index a73cbd83a..33c0024ed 100644
--- a/src/format/Kdbx4Writer.cpp
+++ b/src/format/Kdbx4Writer.cpp
@@ -72,10 +72,12 @@ bool Kdbx4Writer::writeDatabase(QIODevice* device, Database* db)
writeMagicNumbers(&header, KeePass2::SIGNATURE_1, KeePass2::SIGNATURE_2, KeePass2::FILE_VERSION_4);
- CHECK_RETURN_FALSE(writeHeaderField<quint32>(&header, KeePass2::HeaderFieldID::CipherID, db->cipher().toRfc4122()));
- CHECK_RETURN_FALSE(writeHeaderField<quint32>(&header, KeePass2::HeaderFieldID::CompressionFlags,
- Endian::sizedIntToBytes(static_cast<int>(db->compressionAlgorithm()),
- KeePass2::BYTEORDER)));
+ CHECK_RETURN_FALSE(
+ writeHeaderField<quint32>(&header, KeePass2::HeaderFieldID::CipherID, db->cipher().toRfc4122()));
+ CHECK_RETURN_FALSE(writeHeaderField<quint32>(
+ &header,
+ KeePass2::HeaderFieldID::CompressionFlags,
+ Endian::sizedIntToBytes(static_cast<int>(db->compressionAlgorithm()), KeePass2::BYTEORDER)));
CHECK_RETURN_FALSE(writeHeaderField<quint32>(&header, KeePass2::HeaderFieldID::MasterSeed, masterSeed));
CHECK_RETURN_FALSE(writeHeaderField<quint32>(&header, KeePass2::HeaderFieldID::EncryptionIV, encryptionIV));
diff --git a/src/format/KdbxXmlReader.cpp b/src/format/KdbxXmlReader.cpp
index b64c28a22..163a9fa9d 100644
--- a/src/format/KdbxXmlReader.cpp
+++ b/src/format/KdbxXmlReader.cpp
@@ -44,7 +44,7 @@ KdbxXmlReader::KdbxXmlReader(quint32 version)
* @param version KDBX version
* @param binaryPool binary pool
*/
-KdbxXmlReader::KdbxXmlReader(quint32 version, QHash<QString, QByteArray> binaryPool)
+KdbxXmlReader::KdbxXmlReader(quint32 version, QHash<QString, QByteArray> binaryPool)
: m_kdbxVersion(version)
, m_binaryPool(std::move(binaryPool))
{
diff --git a/src/format/KdbxXmlReader.h b/src/format/KdbxXmlReader.h
index dab6fc639..2ec9c9f66 100644
--- a/src/format/KdbxXmlReader.h
+++ b/src/format/KdbxXmlReader.h
@@ -21,7 +21,6 @@
#include "core/Database.h"
#include "core/Metadata.h"
#include "core/TimeInfo.h"
-#include "core/Database.h"
#include <QCoreApplication>
#include <QPair>
@@ -42,7 +41,7 @@ class KdbxXmlReader
public:
explicit KdbxXmlReader(quint32 version);
- explicit KdbxXmlReader(quint32 version, QHash<QString, QByteArray> binaryPool);
+ explicit KdbxXmlReader(quint32 version, QHash<QString, QByteArray> binaryPool);
virtual ~KdbxXmlReader() = default;
virtual QSharedPointer<Database> readDatabase(const QString& filename);
diff --git a/src/format/KdbxXmlWriter.cpp b/src/format/KdbxXmlWriter.cpp
index 6bc4be51e..a95a60091 100644
--- a/src/format/KdbxXmlWriter.cpp
+++ b/src/format/KdbxXmlWriter.cpp
@@ -356,12 +356,14 @@ void KdbxXmlWriter::writeEntry(const Entry* entry)
for (const QString& key : attributesKeyList) {
m_xml.writeStartElement("String");
+ // clang-format off
bool protect =
(((key == "Title") && m_meta->protectTitle()) || ((key == "UserName") && m_meta->protectUsername())
|| ((key == "Password") && m_meta->protectPassword())
|| ((key == "URL") && m_meta->protectUrl())
|| ((key == "Notes") && m_meta->protectNotes())
|| entry->attributes()->isProtected(key));
+ // clang-format on
writeString("Key", key);
diff --git a/src/format/KeePass1.h b/src/format/KeePass1.h
index fa220da03..caddee441 100644
--- a/src/format/KeePass1.h
+++ b/src/format/KeePass1.h
@@ -1,19 +1,19 @@
/*
-* Copyright (C) 2012 Felix Geyer <debfx@fobos.de>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 or (at your option)
-* version 3 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2012 Felix Geyer <debfx@fobos.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef KEEPASSX_KEEPASS1_H
#define KEEPASSX_KEEPASS1_H
@@ -35,6 +35,6 @@ namespace KeePass1
Rijndael = 2,
Twofish = 8
};
-}
+} // namespace KeePass1
#endif // KEEPASSX_KEEPASS1_H
diff --git a/src/format/KeePass2.cpp b/src/format/KeePass2.cpp
index 639255d27..fbc393030 100644
--- a/src/format/KeePass2.cpp
+++ b/src/format/KeePass2.cpp
@@ -23,14 +23,14 @@
#define UUID_LENGTH 16
-const QUuid KeePass2::CIPHER_AES128 = QUuid("61ab05a1-9464-41c3-8d74-3a563df8dd35");
-const QUuid KeePass2::CIPHER_AES256 = QUuid("31c1f2e6-bf71-4350-be58-05216afc5aff");
-const QUuid KeePass2::CIPHER_TWOFISH = QUuid("ad68f29f-576f-4bb9-a36a-d47af965346c");
+const QUuid KeePass2::CIPHER_AES128 = QUuid("61ab05a1-9464-41c3-8d74-3a563df8dd35");
+const QUuid KeePass2::CIPHER_AES256 = QUuid("31c1f2e6-bf71-4350-be58-05216afc5aff");
+const QUuid KeePass2::CIPHER_TWOFISH = QUuid("ad68f29f-576f-4bb9-a36a-d47af965346c");
const QUuid KeePass2::CIPHER_CHACHA20 = QUuid("d6038a2b-8b6f-4cb5-a524-339a31dbb59a");
-const QUuid KeePass2::KDF_AES_KDBX3 = QUuid("c9d9f39a-628a-4460-bf74-0d08c18a4fea");
-const QUuid KeePass2::KDF_AES_KDBX4 = QUuid("7c02bb82-79a7-4ac0-927d-114a00648238");
-const QUuid KeePass2::KDF_ARGON2 = QUuid("ef636ddf-8c29-444b-91f7-a9a403e30a0c");
+const QUuid KeePass2::KDF_AES_KDBX3 = QUuid("c9d9f39a-628a-4460-bf74-0d08c18a4fea");
+const QUuid KeePass2::KDF_AES_KDBX4 = QUuid("7c02bb82-79a7-4ac0-927d-114a00648238");
+const QUuid KeePass2::KDF_ARGON2 = QUuid("ef636ddf-8c29-444b-91f7-a9a403e30a0c");
const QByteArray KeePass2::INNER_STREAM_SALSA20_IV("\xe8\x30\x09\x4b\x97\x20\x5d\x2a");
@@ -50,14 +50,12 @@ const QString KeePass2::KDFPARAM_ARGON2_ASSOCDATA("A");
const QList<QPair<QUuid, QString>> KeePass2::CIPHERS{
qMakePair(KeePass2::CIPHER_AES256, QObject::tr("AES: 256-bit")),
qMakePair(KeePass2::CIPHER_TWOFISH, QObject::tr("Twofish: 256-bit")),
- qMakePair(KeePass2::CIPHER_CHACHA20, QObject::tr("ChaCha20: 256-bit"))
-};
+ qMakePair(KeePass2::CIPHER_CHACHA20, QObject::tr("ChaCha20: 256-bit"))};
const QList<QPair<QUuid, QString>> KeePass2::KDFS{
qMakePair(KeePass2::KDF_ARGON2, QObject::tr("Argon2 (KDBX 4 – recommended)")),
qMakePair(KeePass2::KDF_AES_KDBX4, QObject::tr("AES-KDF (KDBX 4)")),
- qMakePair(KeePass2::KDF_AES_KDBX3, QObject::tr("AES-KDF (KDBX 3.1)"))
-};
+ qMakePair(KeePass2::KDF_AES_KDBX3, QObject::tr("AES-KDF (KDBX 3.1)"))};
QByteArray KeePass2::hmacKey(const QByteArray& masterSeed, const QByteArray& transformedMasterKey)
{
diff --git a/src/format/KeePass2.h b/src/format/KeePass2.h
index 195ce8c2b..d18db3578 100644
--- a/src/format/KeePass2.h
+++ b/src/format/KeePass2.h
@@ -21,9 +21,9 @@
#include <QList>
#include <QMap>
#include <QSharedPointer>
+#include <QUuid>
#include <QVariantMap>
#include <QtGlobal>
-#include <QUuid>
#include "crypto/SymmetricCipher.h"
#include "crypto/kdf/Kdf.h"
@@ -46,14 +46,14 @@ namespace KeePass2
const QSysInfo::Endian BYTEORDER = QSysInfo::LittleEndian;
-extern const QUuid CIPHER_AES128;
-extern const QUuid CIPHER_AES256;
-extern const QUuid CIPHER_TWOFISH;
-extern const QUuid CIPHER_CHACHA20;
+ extern const QUuid CIPHER_AES128;
+ extern const QUuid CIPHER_AES256;
+ extern const QUuid CIPHER_TWOFISH;
+ extern const QUuid CIPHER_CHACHA20;
-extern const QUuid KDF_AES_KDBX3;
-extern const QUuid KDF_AES_KDBX4;
-extern const QUuid KDF_ARGON2;
+ extern const QUuid KDF_AES_KDBX3;
+ extern const QUuid KDF_AES_KDBX4;
+ extern const QUuid KDF_ARGON2;
extern const QByteArray INNER_STREAM_SALSA20_IV;
@@ -68,8 +68,8 @@ extern const QUuid KDF_ARGON2;
extern const QString KDFPARAM_ARGON2_SECRET;
extern const QString KDFPARAM_ARGON2_ASSOCDATA;
-extern const QList<QPair<QUuid, QString>> CIPHERS;
-extern const QList<QPair<QUuid, QString>> KDFS;
+ extern const QList<QPair<QUuid, QString>> CIPHERS;
+ extern const QList<QPair<QUuid, QString>> KDFS;
enum class HeaderFieldID
{
@@ -126,11 +126,11 @@ extern const QList<QPair<QUuid, QString>> KDFS;
ByteArray = 0x42
};
-QByteArray hmacKey(const QByteArray& masterSeed, const QByteArray& transformedMasterKey);
-QSharedPointer<Kdf> kdfFromParameters(const QVariantMap& p);
-QVariantMap kdfToParameters(const QSharedPointer<Kdf>& kdf);
-QSharedPointer<Kdf> uuidToKdf(const QUuid& uuid);
-ProtectedStreamAlgo idToProtectedStreamAlgo(quint32 id);
+ QByteArray hmacKey(const QByteArray& masterSeed, const QByteArray& transformedMasterKey);
+ QSharedPointer<Kdf> kdfFromParameters(const QVariantMap& p);
+ QVariantMap kdfToParameters(const QSharedPointer<Kdf>& kdf);
+ QSharedPointer<Kdf> uuidToKdf(const QUuid& uuid);
+ ProtectedStreamAlgo idToProtectedStreamAlgo(quint32 id);
} // namespace KeePass2
diff --git a/src/gui/AboutDialog.cpp b/src/gui/AboutDialog.cpp
index 483e4dd2b..48546edb4 100644
--- a/src/gui/AboutDialog.cpp
+++ b/src/gui/AboutDialog.cpp
@@ -64,10 +64,9 @@ AboutDialog::AboutDialog(QWidget* parent)
debugInfo.append(tr("Distribution: %1").arg(KEEPASSXC_DIST_TYPE).append("\n"));
#endif
- debugInfo.append("\n").append(QString("%1\n- Qt %2\n- %3\n\n")
- .arg(tr("Libraries:"),
- QString::fromLocal8Bit(qVersion()),
- Crypto::backendVersion()));
+ debugInfo.append("\n").append(
+ QString("%1\n- Qt %2\n- %3\n\n")
+ .arg(tr("Libraries:"), QString::fromLocal8Bit(qVersion()), Crypto::backendVersion()));
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
debugInfo.append(tr("Operating system: %1\nCPU architecture: %2\nKernel: %3 %4")
diff --git a/src/gui/ApplicationSettingsWidget.h b/src/gui/ApplicationSettingsWidget.h
index 5fedabfcd..f596b52c5 100644
--- a/src/gui/ApplicationSettingsWidget.h
+++ b/src/gui/ApplicationSettingsWidget.h
@@ -25,7 +25,7 @@ namespace Ui
{
class ApplicationSettingsWidgetGeneral;
class ApplicationSettingsWidgetSecurity;
-}
+} // namespace Ui
class ISettingsPage
{
diff --git a/src/gui/CategoryListWidget.cpp b/src/gui/CategoryListWidget.cpp
index 50b02da81..c57b19bc0 100644
--- a/src/gui/CategoryListWidget.cpp
+++ b/src/gui/CategoryListWidget.cpp
@@ -38,8 +38,9 @@ CategoryListWidget::CategoryListWidget(QWidget* parent)
connect(m_ui->scrollUp, SIGNAL(clicked()), SLOT(scrollCategoriesUp()));
connect(m_ui->scrollDown, SIGNAL(clicked()), SLOT(scrollCategoriesDown()));
connect(m_ui->categoryList->verticalScrollBar(), SIGNAL(valueChanged(int)), SLOT(updateCategoryScrollButtons()));
- connect(
- m_ui->categoryList->verticalScrollBar(), SIGNAL(rangeChanged(int,int)), SLOT(updateCategoryScrollButtons()));
+ // clang-format off
+ connect(m_ui->categoryList->verticalScrollBar(), SIGNAL(rangeChanged(int,int)), SLOT(updateCategoryScrollButtons()));
+ // clang-format on
}
CategoryListWidget::~CategoryListWidget()
diff --git a/src/gui/DatabaseOpenWidget.cpp b/src/gui/DatabaseOpenWidget.cpp
index b3427dc49..9c496aa31 100644
--- a/src/gui/DatabaseOpenWidget.cpp
+++ b/src/gui/DatabaseOpenWidget.cpp
@@ -105,9 +105,11 @@ void DatabaseOpenWidget::showEvent(QShowEvent* event)
#ifdef WITH_XC_YUBIKEY
// showEvent() may be called twice, so make sure we are only polling once
if (!m_yubiKeyBeingPolled) {
+ // clang-format off
connect(YubiKey::instance(), SIGNAL(detected(int,bool)), SLOT(yubikeyDetected(int,bool)), Qt::QueuedConnection);
connect(YubiKey::instance(), SIGNAL(detectComplete()), SLOT(yubikeyDetectComplete()), Qt::QueuedConnection);
connect(YubiKey::instance(), SIGNAL(notFound()), SLOT(noYubikeyFound()), Qt::QueuedConnection);
+ // clang-format on
pollYubikey();
m_yubiKeyBeingPolled = true;
@@ -190,7 +192,7 @@ void DatabaseOpenWidget::openDatabase()
}
if (!m_ui->editPassword->isPasswordVisible()) {
- m_ui->editPassword->setShowPassword(false);
+ m_ui->editPassword->setShowPassword(false);
}
QCoreApplication::processEvents();
diff --git a/src/gui/DatabaseTabWidget.cpp b/src/gui/DatabaseTabWidget.cpp
index c7d752bd2..b45c5a8a5 100644
--- a/src/gui/DatabaseTabWidget.cpp
+++ b/src/gui/DatabaseTabWidget.cpp
@@ -94,10 +94,12 @@ QSharedPointer<Database> DatabaseTabWidget::execNewDatabaseWizard()
Q_ASSERT(db->key());
Q_ASSERT(db->kdf());
if (!db->key() || !db->kdf()) {
- MessageBox::critical(this, tr("Database creation error"),
- tr("The created database has no key or KDF, refusing to save it.\n"
- "This is definitely a bug, please report it to the developers."),
- QMessageBox::Ok, QMessageBox::Ok);
+ MessageBox::critical(this,
+ tr("Database creation error"),
+ tr("The created database has no key or KDF, refusing to save it.\n"
+ "This is definitely a bug, please report it to the developers."),
+ QMessageBox::Ok,
+ QMessageBox::Ok);
return {};
}
@@ -216,7 +218,7 @@ void DatabaseTabWidget::mergeDatabase()
auto dbWidget = currentDatabaseWidget();
if (dbWidget && !dbWidget->isLocked()) {
QString filter = QString("%1 (*.kdbx);;%2 (*)").arg(tr("KeePass 2 Database"), tr("All files"));
- const QString fileName = fileDialog()->getOpenFileName(this, tr("Merge database"), "", filter);
+ const QString fileName = fileDialog()->getOpenFileName(this, tr("Merge database"), QString(), filter);
if (!fileName.isEmpty()) {
mergeDatabase(fileName);
}
diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp
index 389d6fc4c..234f7e042 100644
--- a/src/gui/DatabaseWidget.cpp
+++ b/src/gui/DatabaseWidget.cpp
@@ -50,8 +50,8 @@
#include "gui/EntryPreviewWidget.h"
#include "gui/KeePass1OpenWidget.h"
#include "gui/MessageBox.h"
-#include "gui/TotpSetupDialog.h"
#include "gui/TotpDialog.h"
+#include "gui/TotpSetupDialog.h"
#include "gui/TotpExportSettingsDialog.h"
#include "gui/entry/EditEntryWidget.h"
#include "gui/entry/EntryView.h"
@@ -155,6 +155,7 @@ DatabaseWidget::DatabaseWidget(QSharedPointer<Database> db, QWidget* parent)
addChildWidget(m_csvImportWizard);
addChildWidget(m_keepass1OpenWidget);
+ // clang-format off
connect(m_mainSplitter, SIGNAL(splitterMoved(int,int)), SIGNAL(mainSplitterSizesChanged()));
connect(m_previewSplitter, SIGNAL(splitterMoved(int,int)), SIGNAL(previewSplitterSizesChanged()));
connect(this, SIGNAL(currentModeChanged(DatabaseWidget::Mode)), m_previewView, SLOT(setDatabaseMode(DatabaseWidget::Mode)));
@@ -177,7 +178,8 @@ DatabaseWidget::DatabaseWidget(QSharedPointer<Database> db, QWidget* parent)
connect(&m_fileWatchTimer, SIGNAL(timeout()), this, SLOT(reloadDatabaseFile()));
connect(&m_fileWatchUnblockTimer, SIGNAL(timeout()), this, SLOT(unblockAutoReload()));
connect(this, SIGNAL(currentChanged(int)), this, SLOT(emitCurrentModeChanged()));
-
+ // clang-format on
+
connectDatabaseSignals();
m_fileWatchTimer.setSingleShot(true);
diff --git a/src/gui/EditWidget.cpp b/src/gui/EditWidget.cpp
index 66038282d..6a5765933 100644
--- a/src/gui/EditWidget.cpp
+++ b/src/gui/EditWidget.cpp
@@ -18,6 +18,7 @@
#include "EditWidget.h"
#include "ui_EditWidget.h"
+
#include <QPushButton>
#include <QScrollArea>
diff --git a/src/gui/EditWidgetIcons.cpp b/src/gui/EditWidgetIcons.cpp
index 5d1a5f901..abb65c00d 100644
--- a/src/gui/EditWidgetIcons.cpp
+++ b/src/gui/EditWidgetIcons.cpp
@@ -31,6 +31,7 @@
#ifdef WITH_XC_NETWORKING
#include <QtNetwork>
+#include <QNetworkAccessManager>
#endif
IconStruct::IconStruct()
@@ -44,6 +45,7 @@ EditWidgetIcons::EditWidgetIcons(QWidget* parent)
, m_ui(new Ui::EditWidgetIcons())
, m_db(nullptr)
#ifdef WITH_XC_NETWORKING
+ , m_netMgr(new QNetworkAccessManager(this))
, m_reply(nullptr)
#endif
, m_defaultIconModel(new DefaultIconModel(this))
@@ -54,6 +56,7 @@ EditWidgetIcons::EditWidgetIcons(QWidget* parent)
m_ui->defaultIconsView->setModel(m_defaultIconModel);
m_ui->customIconsView->setModel(m_customIconModel);
+ // clang-format off
connect(m_ui->defaultIconsView, SIGNAL(clicked(QModelIndex)), this, SLOT(updateRadioButtonDefaultIcons()));
connect(m_ui->customIconsView, SIGNAL(clicked(QModelIndex)), this, SLOT(updateRadioButtonCustomIcons()));
connect(m_ui->defaultIconsRadio, SIGNAL(toggled(bool)), this, SLOT(updateWidgetsDefaultIcons(bool)));
@@ -64,14 +67,11 @@ EditWidgetIcons::EditWidgetIcons(QWidget* parent)
connect(m_ui->defaultIconsRadio, SIGNAL(toggled(bool)), this, SIGNAL(widgetUpdated()));
connect(m_ui->defaultIconsRadio, SIGNAL(toggled(bool)), this, SIGNAL(widgetUpdated()));
- connect(m_ui->defaultIconsView->selectionModel(),
- SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
- this,
- SIGNAL(widgetUpdated()));
- connect(m_ui->customIconsView->selectionModel(),
- SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
- this,
- SIGNAL(widgetUpdated()));
+ connect(m_ui->defaultIconsView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
+ this, SIGNAL(widgetUpdated()));
+ connect(m_ui->customIconsView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
+ this, SIGNAL(widgetUpdated()));
+ // clang-format on
m_ui->faviconButton->setVisible(false);
m_ui->addButton->setEnabled(true);
@@ -156,7 +156,8 @@ void EditWidgetIcons::setUrl(const QString& url)
}
#ifdef WITH_XC_NETWORKING
-namespace {
+namespace
+{
// Try to get the 2nd level domain of the host part of a QUrl. For example,
// "foo.bar.example.com" would become "example.com", and "foo.bar.example.co.uk"
// would become "example.co.uk".
@@ -177,13 +178,13 @@ namespace {
return url;
}
- QUrl getRedirectTarget(QNetworkReply *reply)
+ QUrl getRedirectTarget(QNetworkReply* reply)
{
QVariant var = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
QUrl url = convertVariantToUrl(var);
return url;
}
-}
+} // namespace
#endif
void EditWidgetIcons::downloadFavicon()
@@ -264,9 +265,10 @@ void EditWidgetIcons::fetchFinished()
return;
} else {
if (!fallbackEnabled) {
- emit messageEditEntry(tr("Unable to fetch favicon.") + "\n" +
- tr("Hint: You can enable DuckDuckGo as a fallback under Tools>Settings>Security"),
- MessageWidget::Error);
+ emit messageEditEntry(
+ tr("Unable to fetch favicon.") + "\n"
+ + tr("Hint: You can enable DuckDuckGo as a fallback under Tools>Settings>Security"),
+ MessageWidget::Error);
} else {
emit messageEditEntry(tr("Unable to fetch favicon."), MessageWidget::Error);
}
@@ -294,7 +296,7 @@ void EditWidgetIcons::startFetchFavicon(const QUrl& url)
QNetworkRequest request(url);
- m_reply = m_netMgr.get(request);
+ m_reply = m_netMgr->get(request);
connect(m_reply, &QNetworkReply::finished, this, &EditWidgetIcons::fetchFinished);
connect(m_reply, &QIODevice::readyRead, this, &EditWidgetIcons::fetchReadyRead);
#else
@@ -339,8 +341,9 @@ void EditWidgetIcons::addCustomIconFromFile()
if (!errornames.empty()) {
// Show the first 8 icons that failed to load
errornames = errornames.mid(0, 8);
- emit messageEditEntry(msg + "\n" + tr("The following icon(s) failed:", "", errornames.size()) +
- "\n" + errornames.join("\n"), MessageWidget::Error);
+ emit messageEditEntry(msg + "\n" + tr("The following icon(s) failed:", "", errornames.size()) + "\n"
+ + errornames.join("\n"),
+ MessageWidget::Error);
} else if (numloaded > 0) {
emit messageEditEntry(msg, MessageWidget::Positive);
} else {
diff --git a/src/gui/EditWidgetIcons.h b/src/gui/EditWidgetIcons.h
index 677cbebef..5c02f31a1 100644
--- a/src/gui/EditWidgetIcons.h
+++ b/src/gui/EditWidgetIcons.h
@@ -21,9 +21,8 @@
#include <QSet>
#include <QUrl>
-#include <QWidget>
-#include <QNetworkAccessManager>
#include <QUuid>
+#include <QWidget>
#include "config-keepassx.h"
#include "core/Global.h"
@@ -33,6 +32,7 @@ class Database;
class DefaultIconModel;
class CustomIconModel;
#ifdef WITH_XC_NETWORKING
+class QNetworkAccessManager;
class QNetworkReply;
#endif
@@ -95,8 +95,8 @@ private:
QUrl m_fetchUrl;
QList<QUrl> m_urlsToTry;
QByteArray m_bytesReceived;
- QNetworkAccessManager m_netMgr;
- QNetworkReply *m_reply;
+ QNetworkAccessManager* m_netMgr;
+ QNetworkReply* m_reply;
int m_redirects;
#endif
DefaultIconModel* const m_defaultIconModel;
diff --git a/src/gui/EditWidgetProperties.cpp b/src/gui/EditWidgetProperties.cpp
index b2de9d778..bc0f6e164 100644
--- a/src/gui/EditWidgetProperties.cpp
+++ b/src/gui/EditWidgetProperties.cpp
@@ -16,11 +16,11 @@
*/
#include "EditWidgetProperties.h"
-
-#include <QUuid>
+#include "ui_EditWidgetProperties.h"
#include "MessageBox.h"
-#include "ui_EditWidgetProperties.h"
+
+#include <QUuid>
EditWidgetProperties::EditWidgetProperties(QWidget* parent)
: QWidget(parent)
@@ -32,9 +32,11 @@ EditWidgetProperties::EditWidgetProperties(QWidget* parent)
m_ui->removeCustomDataButton->setEnabled(false);
m_ui->customDataTable->setModel(m_customDataModel);
+ // clang-format off
connect(m_ui->customDataTable->selectionModel(),
SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
SLOT(toggleRemoveButton(QItemSelection)));
+ // clang-format on
connect(m_ui->removeCustomDataButton, SIGNAL(clicked()), SLOT(removeSelectedPluginData()));
}
@@ -66,12 +68,13 @@ const CustomData* EditWidgetProperties::customData() const
void EditWidgetProperties::removeSelectedPluginData()
{
- if (QMessageBox::Yes != MessageBox::question(this,
- tr("Delete plugin data?"),
- tr("Do you really want to delete the selected plugin data?\n"
- "This may cause the affected plugins to malfunction."),
- QMessageBox::Yes | QMessageBox::Cancel,
- QMessageBox::Cancel)) {
+ if (QMessageBox::Yes
+ != MessageBox::question(this,
+ tr("Delete plugin data?"),
+ tr("Do you really want to delete the selected plugin data?\n"
+ "This may cause the affected plugins to malfunction."),
+ QMessageBox::Yes | QMessageBox::Cancel,
+ QMessageBox::Cancel)) {
return;
}
@@ -97,8 +100,8 @@ void EditWidgetProperties::updateModel()
m_customDataModel->setHorizontalHeaderLabels({tr("Key"), tr("Value")});
for (const QString& key : m_customData->keys()) {
- m_customDataModel->appendRow(QList<QStandardItem*>() << new QStandardItem(key)
- << new QStandardItem(m_customData->value(key)));
+ m_customDataModel->appendRow(QList<QStandardItem*>()
+ << new QStandardItem(key) << new QStandardItem(m_customData->value(key)));
}
m_ui->removeCustomDataButton->setEnabled(false);
diff --git a/src/gui/KeePass1OpenWidget.cpp b/src/gui/KeePass1OpenWidget.cpp
index d033979b8..834425ec1 100644
--- a/src/gui/KeePass1OpenWidget.cpp
+++ b/src/gui/KeePass1OpenWidget.cpp
@@ -16,6 +16,7 @@
*/
#include "KeePass1OpenWidget.h"
+#include "ui_DatabaseOpenWidget.h"
#include <QFile>
#include <QFileInfo>
@@ -24,7 +25,6 @@
#include "core/Metadata.h"
#include "format/KeePass1Reader.h"
#include "gui/MessageBox.h"
-#include "ui_DatabaseOpenWidget.h"
KeePass1OpenWidget::KeePass1OpenWidget(QWidget* parent)
: DatabaseOpenWidget(parent)
diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp
index 1cd700b43..55c261858 100644
--- a/src/gui/MainWindow.cpp
+++ b/src/gui/MainWindow.cpp
@@ -20,10 +20,10 @@
#include "ui_MainWindow.h"
#include <QCloseEvent>
+#include <QDesktopServices>
#include <QMimeData>
#include <QShortcut>
#include <QTimer>
-#include <QDesktopServices>
#include "config-keepassx.h"
@@ -56,8 +56,8 @@
#include <QtDBus/QtDBus>
#endif
-#include "gui/PasswordGeneratorWidget.h"
#include "gui/ApplicationSettingsWidget.h"
+#include "gui/PasswordGeneratorWidget.h"
#include "touchid/TouchID.h"
@@ -67,7 +67,8 @@ class BrowserPlugin : public ISettingsPage
public:
BrowserPlugin(DatabaseTabWidget* tabWidget)
{
- m_nativeMessagingHost = QSharedPointer<NativeMessagingHost>(new NativeMessagingHost(tabWidget, browserSettings()->isEnabled()));
+ m_nativeMessagingHost =
+ QSharedPointer<NativeMessagingHost>(new NativeMessagingHost(tabWidget, browserSettings()->isEnabled()));
}
~BrowserPlugin()
@@ -105,8 +106,8 @@ public:
}
}
- private:
- QSharedPointer<NativeMessagingHost> m_nativeMessagingHost;
+private:
+ QSharedPointer<NativeMessagingHost> m_nativeMessagingHost;
};
#endif
@@ -346,11 +347,13 @@ MainWindow::MainWindow()
#ifdef Q_OS_MACOS
setUnifiedTitleAndToolBarOnMac(true);
#endif
-
+ // clang-format off
connect(m_ui->tabWidget,
SIGNAL(messageGlobal(QString,MessageWidget::MessageType)),
this,
SLOT(displayGlobalMessage(QString,MessageWidget::MessageType)));
+ // clang-format on
+
connect(m_ui->tabWidget, SIGNAL(messageDismissGlobal()), this, SLOT(hideGlobalMessage()));
m_screenLockListener = new ScreenLockListener(this);
@@ -368,13 +371,15 @@ MainWindow::MainWindow()
tr("WARNING: You are using an unstable build of KeePassXC!\n"
"There is a high risk of corruption, maintain a backup of your databases.\n"
"This version is not meant for production use."),
- MessageWidget::Warning, -1);
+ MessageWidget::Warning,
+ -1);
#elif (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0) && QT_VERSION < QT_VERSION_CHECK(5, 6, 0))
if (!config()->get("QtErrorMessageShown", false).toBool()) {
m_ui->globalMessageWidget->showMessage(
tr("WARNING: Your Qt version may cause KeePassXC to crash with an On-Screen Keyboard!\n"
"We recommend you use the AppImage available on our downloads page."),
- MessageWidget::Warning, -1);
+ MessageWidget::Warning,
+ -1);
config()->set("QtErrorMessageShown", true);
}
#endif
@@ -671,10 +676,10 @@ void MainWindow::switchToSettings(bool enabled)
void MainWindow::switchToPasswordGen(bool enabled)
{
if (enabled) {
- m_ui->passwordGeneratorWidget->loadSettings();
- m_ui->passwordGeneratorWidget->regeneratePassword();
- m_ui->passwordGeneratorWidget->setStandaloneMode(true);
- m_ui->stackedWidget->setCurrentIndex(PasswordGeneratorScreen);
+ m_ui->passwordGeneratorWidget->loadSettings();
+ m_ui->passwordGeneratorWidget->regeneratePassword();
+ m_ui->passwordGeneratorWidget->setStandaloneMode(true);
+ m_ui->stackedWidget->setCurrentIndex(PasswordGeneratorScreen);
} else {
m_ui->passwordGeneratorWidget->saveSettings();
switchToDatabases();
diff --git a/src/gui/PasswordEdit.cpp b/src/gui/PasswordEdit.cpp
index 6ec044f9e..e341eddd4 100644
--- a/src/gui/PasswordEdit.cpp
+++ b/src/gui/PasswordEdit.cpp
@@ -71,8 +71,9 @@ void PasswordEdit::setShowPassword(bool show)
emit showPasswordChanged(show);
}
-bool PasswordEdit::isPasswordVisible() const {
- return isEnabled();
+bool PasswordEdit::isPasswordVisible() const
+{
+ return isEnabled();
}
bool PasswordEdit::passwordsEqual() const
diff --git a/src/gui/PasswordGeneratorWidget.cpp b/src/gui/PasswordGeneratorWidget.cpp
index 048c39542..80ea007aa 100644
--- a/src/gui/PasswordGeneratorWidget.cpp
+++ b/src/gui/PasswordGeneratorWidget.cpp
@@ -338,10 +338,8 @@ void PasswordGeneratorWidget::selectSimpleMode()
m_ui->checkBoxLower->setChecked(m_ui->checkBoxLowerAdv->isChecked());
m_ui->checkBoxNumbers->setChecked(m_ui->checkBoxNumbersAdv->isChecked());
m_ui->checkBoxSpecialChars->setChecked(m_ui->checkBoxBraces->isChecked() | m_ui->checkBoxPunctuation->isChecked()
- | m_ui->checkBoxQuotes->isChecked()
- | m_ui->checkBoxMath->isChecked()
- | m_ui->checkBoxDashes->isChecked()
- | m_ui->checkBoxLogograms->isChecked());
+ | m_ui->checkBoxQuotes->isChecked() | m_ui->checkBoxMath->isChecked()
+ | m_ui->checkBoxDashes->isChecked() | m_ui->checkBoxLogograms->isChecked());
m_ui->checkBoxExtASCII->setChecked(m_ui->checkBoxExtASCIIAdv->isChecked());
m_ui->simpleBar->show();
}
diff --git a/src/gui/TotpSetupDialog.cpp b/src/gui/TotpSetupDialog.cpp
index babeb7840..ebbcbc9fe 100644
--- a/src/gui/TotpSetupDialog.cpp
+++ b/src/gui/TotpSetupDialog.cpp
@@ -17,9 +17,10 @@
*/
#include "TotpSetupDialog.h"
-#include "totp/totp.h"
#include "ui_TotpSetupDialog.h"
+#include "totp/totp.h"
+
TotpSetupDialog::TotpSetupDialog(QWidget* parent, Entry* entry)
: QDialog(parent)
, m_ui(new Ui::TotpSetupDialog())
diff --git a/src/gui/csvImport/CsvImportWidget.cpp b/src/gui/csvImport/CsvImportWidget.cpp
index 3b623f73d..19b5732bc 100644
--- a/src/gui/csvImport/CsvImportWidget.cpp
+++ b/src/gui/csvImport/CsvImportWidget.cpp
@@ -40,7 +40,7 @@ CsvImportWidget::CsvImportWidget(QWidget* parent)
, m_columnHeader(QStringList() << QObject::tr("Group") << QObject::tr("Title") << QObject::tr("Username")
<< QObject::tr("Password") << QObject::tr("URL") << QObject::tr("Notes")
<< QObject::tr("Last Modified") << QObject::tr("Created")
- /* << QObject::tr("Future field1") */ )
+ /* << QObject::tr("Future field1") */)
{
m_ui->setupUi(this);
@@ -87,9 +87,11 @@ CsvImportWidget::CsvImportWidget(QWidget* parent)
m_combos.append(combo);
combo->setModel(m_comboModel);
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
- connect(combo, QOverload<int>::of(&QComboBox::currentIndexChanged), [=]{ comboChanged(combo, i); });
+ connect(combo, QOverload<int>::of(&QComboBox::currentIndexChanged), [=] { comboChanged(combo, i); });
#else
- connect(combo, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=]{ comboChanged(combo, i); });
+ connect(combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [=] {
+ comboChanged(combo, i);
+ });
#endif
// layout labels and combo fields in column-first order
diff --git a/src/gui/csvImport/CsvImportWizard.cpp b/src/gui/csvImport/CsvImportWizard.cpp
index 9b255f941..356435ba9 100644
--- a/src/gui/csvImport/CsvImportWizard.cpp
+++ b/src/gui/csvImport/CsvImportWizard.cpp
@@ -42,7 +42,6 @@ void CsvImportWizard::load(const QString& filename, Database* database)
m_parse->load(filename, database);
}
-
void CsvImportWizard::parseFinished(bool accepted)
{
emit importFinished(accepted);
diff --git a/src/gui/dbsettings/DatabaseSettingsDialog.cpp b/src/gui/dbsettings/DatabaseSettingsDialog.cpp
index 75a3fb5ef..b35059ee1 100644
--- a/src/gui/dbsettings/DatabaseSettingsDialog.cpp
+++ b/src/gui/dbsettings/DatabaseSettingsDialog.cpp
@@ -18,16 +18,17 @@
#include "DatabaseSettingsDialog.h"
#include "ui_DatabaseSettingsDialog.h"
-#include "DatabaseSettingsWidgetGeneral.h"
+
#include "DatabaseSettingsWidgetEncryption.h"
+#include "DatabaseSettingsWidgetGeneral.h"
#include "DatabaseSettingsWidgetMasterKey.h"
#ifdef WITH_XC_BROWSER
#include "DatabaseSettingsWidgetBrowser.h"
#endif
#include "core/Config.h"
-#include "core/FilePath.h"
#include "core/Database.h"
+#include "core/FilePath.h"
#include "touchid/TouchID.h"
DatabaseSettingsDialog::DatabaseSettingsDialog(QWidget* parent)
@@ -57,12 +58,13 @@ DatabaseSettingsDialog::DatabaseSettingsDialog(QWidget* parent)
m_ui->stackedWidget->setCurrentIndex(0);
m_securityTabWidget->setCurrentIndex(0);
- connect(m_securityTabWidget, SIGNAL(currentChanged(int)), SLOT(pageChanged()));
+ connect(m_securityTabWidget, SIGNAL(currentChanged(int)), SLOT(pageChanged()));
connect(m_ui->categoryList, SIGNAL(categoryChanged(int)), m_ui->stackedWidget, SLOT(setCurrentIndex(int)));
connect(m_ui->advancedSettingsToggle, SIGNAL(toggled(bool)), SLOT(toggleAdvancedMode(bool)));
#ifdef WITH_XC_BROWSER
- m_ui->categoryList->addCategory(tr("Browser Integration"), FilePath::instance()->icon("apps", "internet-web-browser"));
+ m_ui->categoryList->addCategory(tr("Browser Integration"),
+ FilePath::instance()->icon("apps", "internet-web-browser"));
m_ui->stackedWidget->addWidget(m_browserWidget);
#endif
diff --git a/src/gui/dbsettings/DatabaseSettingsDialog.h b/src/gui/dbsettings/DatabaseSettingsDialog.h
index 41fc508a9..dff8c0e3a 100644
--- a/src/gui/dbsettings/DatabaseSettingsDialog.h
+++ b/src/gui/dbsettings/DatabaseSettingsDialog.h
@@ -18,8 +18,8 @@
#ifndef KEEPASSX_DATABASESETTINGSWIDGET_H
#define KEEPASSX_DATABASESETTINGSWIDGET_H
-#include "gui/DialogyWidget.h"
#include "config-keepassx.h"
+#include "gui/DialogyWidget.h"
#include <QPointer>
#include <QScopedPointer>
diff --git a/src/gui/dbsettings/DatabaseSettingsWidget.cpp b/src/gui/dbsettings/DatabaseSettingsWidget.cpp
index 67b3ef375..7b438cc33 100644
--- a/src/gui/dbsettings/DatabaseSettingsWidget.cpp
+++ b/src/gui/dbsettings/DatabaseSettingsWidget.cpp
@@ -18,8 +18,8 @@
#include "DatabaseSettingsWidget.h"
#include "core/Database.h"
-#include <QWidget>
#include <QTimer>
+#include <QWidget>
DatabaseSettingsWidget::DatabaseSettingsWidget(QWidget* parent)
: SettingsWidget(parent)
diff --git a/src/gui/dbsettings/DatabaseSettingsWidget.h b/src/gui/dbsettings/DatabaseSettingsWidget.h
index 6d58ddeb7..5a6e5c069 100644
--- a/src/gui/dbsettings/DatabaseSettingsWidget.h
+++ b/src/gui/dbsettings/DatabaseSettingsWidget.h
@@ -48,4 +48,4 @@ protected:
QSharedPointer<Database> m_db;
};
-#endif //KEEPASSXC_DATABASESETTINGSWIDGET_H
+#endif // KEEPASSXC_DATABASESETTINGSWIDGET_H
diff --git a/src/gui/dbsettings/DatabaseSettingsWidgetBrowser.cpp b/src/gui/dbsettings/DatabaseSettingsWidgetBrowser.cpp
index a91744cdb..9f2714ea3 100644
--- a/src/gui/dbsettings/DatabaseSettingsWidgetBrowser.cpp
+++ b/src/gui/dbsettings/DatabaseSettingsWidgetBrowser.cpp
@@ -17,18 +17,21 @@
*/
#include "DatabaseSettingsWidgetBrowser.h"
+#include "ui_DatabaseSettingsWidgetBrowser.h"
+
#include <QProgressDialog>
+
+#include "browser/BrowserSettings.h"
#include "core/Clock.h"
#include "core/Database.h"
#include "core/Entry.h"
#include "core/Group.h"
#include "core/Metadata.h"
#include "gui/MessageBox.h"
-#include "browser/BrowserSettings.h"
-#include "ui_DatabaseSettingsWidgetBrowser.h"
DatabaseSettingsWidgetBrowser::DatabaseSettingsWidgetBrowser(QWidget* parent)
- : DatabaseSettingsWidget(parent), m_ui(new Ui::DatabaseSettingsWidgetBrowser())
+ : DatabaseSettingsWidget(parent)
+ , m_ui(new Ui::DatabaseSettingsWidgetBrowser())
, m_customData(new CustomData(this))
, m_customDataModel(new QStandardItemModel(this))
, m_browserService(nullptr)
@@ -38,8 +41,13 @@ DatabaseSettingsWidgetBrowser::DatabaseSettingsWidgetBrowser(QWidget* parent)
m_ui->customDataTable->setModel(m_customDataModel);
settingsWarning();
- connect(m_ui->customDataTable->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
+
+ // clang-format off
+ connect(m_ui->customDataTable->selectionModel(),
+ SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
SLOT(toggleRemoveButton(QItemSelection)));
+ // clang-format on
+
connect(m_ui->removeCustomDataButton, SIGNAL(clicked()), SLOT(removeSelectedKey()));
connect(m_ui->convertToCustomData, SIGNAL(clicked()), this, SLOT(convertAttributesToCustomData()));
connect(m_ui->convertToCustomData, SIGNAL(clicked()), this, SLOT(updateSharedKeyList()));
@@ -83,11 +91,13 @@ bool DatabaseSettingsWidgetBrowser::save()
void DatabaseSettingsWidgetBrowser::removeSelectedKey()
{
- if (QMessageBox::Yes != MessageBox::question(this,
- tr("Delete the selected key?"),
- tr("Do you really want to delete the selected key?\n"
- "This may prevent connection to the browser plugin."),
- QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel)) {
+ if (QMessageBox::Yes
+ != MessageBox::question(this,
+ tr("Delete the selected key?"),
+ tr("Do you really want to delete the selected key?\n"
+ "This may prevent connection to the browser plugin."),
+ QMessageBox::Yes | QMessageBox::Cancel,
+ QMessageBox::Cancel)) {
return;
}
@@ -116,9 +126,8 @@ void DatabaseSettingsWidgetBrowser::updateModel()
if (key.startsWith(BrowserService::ASSOCIATE_KEY_PREFIX)) {
QString strippedKey = key;
strippedKey.remove(BrowserService::ASSOCIATE_KEY_PREFIX);
- m_customDataModel->appendRow(QList<QStandardItem*>()
- << new QStandardItem(strippedKey)
- << new QStandardItem(customData()->value(key)));
+ m_customDataModel->appendRow(QList<QStandardItem*>() << new QStandardItem(strippedKey)
+ << new QStandardItem(customData()->value(key)));
}
}
@@ -132,7 +141,8 @@ void DatabaseSettingsWidgetBrowser::settingsWarning()
m_ui->removeSharedEncryptionKeys->setEnabled(false);
m_ui->removeStoredPermissions->setEnabled(false);
m_ui->customDataTable->setEnabled(false);
- m_ui->warningWidget->showMessage(tr("Enable Browser Integration to access these settings."), MessageWidget::Warning);
+ m_ui->warningWidget->showMessage(tr("Enable Browser Integration to access these settings."),
+ MessageWidget::Warning);
m_ui->warningWidget->setCloseButtonVisible(false);
m_ui->warningWidget->setAutoHideTimeout(-1);
} else {
@@ -146,11 +156,13 @@ void DatabaseSettingsWidgetBrowser::settingsWarning()
void DatabaseSettingsWidgetBrowser::removeSharedEncryptionKeys()
{
- if (QMessageBox::Yes != MessageBox::question(this,
- tr("Disconnect all browsers"),
- tr("Do you really want to disconnect all browsers?\n"
- "This may prevent connection to the browser plugin."),
- QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel)) {
+ if (QMessageBox::Yes
+ != MessageBox::question(this,
+ tr("Disconnect all browsers"),
+ tr("Do you really want to disconnect all browsers?\n"
+ "This may prevent connection to the browser plugin."),
+ QMessageBox::Yes | QMessageBox::Cancel,
+ QMessageBox::Cancel)) {
return;
}
@@ -182,11 +194,13 @@ void DatabaseSettingsWidgetBrowser::removeSharedEncryptionKeys()
void DatabaseSettingsWidgetBrowser::removeStoredPermissions()
{
- if (QMessageBox::Yes != MessageBox::question(this,
- tr("Forget all site-specific settings on entries"),
- tr("Do you really want forget all site-specific settings on every entry?\n"
- "Permissions to access entries will be revoked."),
- QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel)) {
+ if (QMessageBox::Yes
+ != MessageBox::question(this,
+ tr("Forget all site-specific settings on entries"),
+ tr("Do you really want forget all site-specific settings on every entry?\n"
+ "Permissions to access entries will be revoked."),
+ QMessageBox::Yes | QMessageBox::Cancel,
+ QMessageBox::Cancel)) {
return;
}
@@ -226,11 +240,14 @@ void DatabaseSettingsWidgetBrowser::removeStoredPermissions()
void DatabaseSettingsWidgetBrowser::convertAttributesToCustomData()
{
- if (QMessageBox::Yes != MessageBox::question(this,
- tr("Move KeePassHTTP attributes to custom data"),
- tr("Do you really want to move all legacy browser integration data to the latest standard?\n"
- "This is necessary to maintain compatibility with the browser plugin."),
- QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel)) {
+ if (QMessageBox::Yes
+ != MessageBox::question(
+ this,
+ tr("Move KeePassHTTP attributes to custom data"),
+ tr("Do you really want to move all legacy browser integration data to the latest standard?\n"
+ "This is necessary to maintain compatibility with the browser plugin."),
+ QMessageBox::Yes | QMessageBox::Cancel,
+ QMessageBox::Cancel)) {
return;
}
@@ -242,4 +259,3 @@ void DatabaseSettingsWidgetBrowser::updateSharedKeyList()
{
updateModel();
}
-
diff --git a/src/gui/dbsettings/DatabaseSettingsWidgetBrowser.h b/src/gui/dbsettings/DatabaseSettingsWidgetBrowser.h
index 0c56ede57..d9d9885ca 100644
--- a/src/gui/dbsettings/DatabaseSettingsWidgetBrowser.h
+++ b/src/gui/dbsettings/DatabaseSettingsWidgetBrowser.h
@@ -21,18 +21,19 @@
#include "DatabaseSettingsWidget.h"
+#include "browser/BrowserService.h"
+#include "core/CustomData.h"
+#include "gui/DatabaseTabWidget.h"
+
+#include <QItemSelection>
#include <QPointer>
#include <QScopedPointer>
#include <QStandardItemModel>
-#include <QItemSelection>
-#include "core/CustomData.h"
-#include "gui/DatabaseTabWidget.h"
-#include "browser/BrowserService.h"
class Database;
namespace Ui
{
-class DatabaseSettingsWidgetBrowser;
+ class DatabaseSettingsWidgetBrowser;
}
class DatabaseSettingsWidgetBrowser : public DatabaseSettingsWidget
@@ -45,7 +46,10 @@ public:
~DatabaseSettingsWidgetBrowser() override;
CustomData* customData() const;
- inline bool hasAdvancedMode() const override { return false; }
+ inline bool hasAdvancedMode() const override
+ {
+ return false;
+ }
public slots:
void initialize() override;
@@ -75,4 +79,4 @@ private:
BrowserService m_browserService;
};
-#endif //KEEPASSXC_DATABASESETTINGSWIDGETBROWSER_H
+#endif // KEEPASSXC_DATABASESETTINGSWIDGETBROWSER_H
diff --git a/src/gui/dbsettings/DatabaseSettingsWidgetEncryption.cpp b/src/gui/dbsettings/DatabaseSettingsWidgetEncryption.cpp
index 63a1ccef8..f6ed2f577 100644
--- a/src/gui/dbsettings/DatabaseSettingsWidgetEncryption.cpp
+++ b/src/gui/dbsettings/DatabaseSettingsWidgetEncryption.cpp
@@ -17,13 +17,14 @@
#include "DatabaseSettingsWidgetEncryption.h"
#include "ui_DatabaseSettingsWidgetEncryption.h"
+
+#include "core/AsyncTask.h"
#include "core/Database.h"
-#include "core/Metadata.h"
#include "core/Global.h"
-#include "core/AsyncTask.h"
-#include "gui/MessageBox.h"
+#include "core/Metadata.h"
#include "crypto/kdf/Argon2Kdf.h"
#include "format/KeePass2.h"
+#include "gui/MessageBox.h"
#include <QApplication>
#include <QPushButton>
@@ -260,7 +261,7 @@ bool DatabaseSettingsWidgetEncryption::save()
return false;
}
} else if ((kdf->uuid() == KeePass2::KDF_AES_KDBX3 || kdf->uuid() == KeePass2::KDF_AES_KDBX4)
- && m_ui->transformRoundsSpinBox->value() < 100000) {
+ && m_ui->transformRoundsSpinBox->value() < 100000) {
QMessageBox warning;
warning.setIcon(QMessageBox::Warning);
warning.setWindowTitle(tr("Number of rounds too low", "Key transformation rounds"));
@@ -394,7 +395,7 @@ void DatabaseSettingsWidgetEncryption::updateFormatCompatibility(int index, bool
m_ui->compatibilitySelection->blockSignals(block);
}
- if (retransform) {
+ if (retransform) {
QUuid kdfUuid(m_ui->compatibilitySelection->itemData(index).toByteArray());
auto kdf = KeePass2::uuidToKdf(kdfUuid);
m_db->setKdf(kdf);
diff --git a/src/gui/dbsettings/DatabaseSettingsWidgetEncryption.h b/src/gui/dbsettings/DatabaseSettingsWidgetEncryption.h
index 8b1e42e13..986a33b6a 100644
--- a/src/gui/dbsettings/DatabaseSettingsWidgetEncryption.h
+++ b/src/gui/dbsettings/DatabaseSettingsWidgetEncryption.h
@@ -26,10 +26,10 @@
class Database;
namespace Ui
{
-class DatabaseSettingsWidgetEncryption;
+ class DatabaseSettingsWidgetEncryption;
}
-class DatabaseSettingsWidgetEncryption: public DatabaseSettingsWidget
+class DatabaseSettingsWidgetEncryption : public DatabaseSettingsWidget
{
Q_OBJECT
@@ -38,7 +38,10 @@ public:
Q_DISABLE_COPY(DatabaseSettingsWidgetEncryption);
~DatabaseSettingsWidgetEncryption() override;
- inline bool hasAdvancedMode() const override { return true; }
+ inline bool hasAdvancedMode() const override
+ {
+ return true;
+ }
void setAdvancedMode(bool advanced) override;
public slots:
@@ -64,7 +67,11 @@ private slots:
void markDirty();
private:
- enum FormatSelection { KDBX4, KDBX3 };
+ enum FormatSelection
+ {
+ KDBX4,
+ KDBX3
+ };
static const char* CD_DECRYPTION_TIME_PREFERENCE_KEY;
bool m_isDirty = false;
@@ -72,4 +79,4 @@ private:
const QScopedPointer<Ui::DatabaseSettingsWidgetEncryption> m_ui;
};
-#endif //KEEPASSXC_DATABASESETTINGSWIDGETENCRYPTION_H
+#endif // KEEPASSXC_DATABASESETTINGSWIDGETENCRYPTION_H
diff --git a/src/gui/dbsettings/DatabaseSettingsWidgetGeneral.cpp b/src/gui/dbsettings/DatabaseSettingsWidgetGeneral.cpp
index c8d71762d..b96016fdc 100644
--- a/src/gui/dbsettings/DatabaseSettingsWidgetGeneral.cpp
+++ b/src/gui/dbsettings/DatabaseSettingsWidgetGeneral.cpp
@@ -17,6 +17,7 @@
#include "DatabaseSettingsWidgetGeneral.h"
#include "ui_DatabaseSettingsWidgetGeneral.h"
+
#include "core/Clock.h"
#include "core/Database.h"
#include "core/Entry.h"
@@ -24,7 +25,8 @@
#include "core/Metadata.h"
DatabaseSettingsWidgetGeneral::DatabaseSettingsWidgetGeneral(QWidget* parent)
- : DatabaseSettingsWidget(parent), m_ui(new Ui::DatabaseSettingsWidgetGeneral())
+ : DatabaseSettingsWidget(parent)
+ , m_ui(new Ui::DatabaseSettingsWidgetGeneral())
{
m_ui->setupUi(this);
@@ -53,7 +55,7 @@ void DatabaseSettingsWidgetGeneral::initialize()
m_ui->historyMaxItemsSpinBox->setValue(Metadata::DefaultHistoryMaxItems);
m_ui->historyMaxItemsCheckBox->setChecked(false);
}
- int historyMaxSizeMiB = qRound(meta->historyMaxSize()/qreal(1048576));
+ int historyMaxSizeMiB = qRound(meta->historyMaxSize() / qreal(1048576));
if (historyMaxSizeMiB > 0) {
m_ui->historyMaxSizeSpinBox->setValue(historyMaxSizeMiB);
m_ui->historyMaxSizeCheckBox->setChecked(true);
@@ -100,7 +102,7 @@ bool DatabaseSettingsWidgetGeneral::save()
int historyMaxSize;
if (m_ui->historyMaxSizeCheckBox->isChecked()) {
- historyMaxSize = m_ui->historyMaxSizeSpinBox->value()*1048576;
+ historyMaxSize = m_ui->historyMaxSizeSpinBox->value() * 1048576;
} else {
historyMaxSize = -1;
}
diff --git a/src/gui/dbsettings/DatabaseSettingsWidgetGeneral.h b/src/gui/dbsettings/DatabaseSettingsWidgetGeneral.h
index 009b6b643..7fe65d9ab 100644
--- a/src/gui/dbsettings/DatabaseSettingsWidgetGeneral.h
+++ b/src/gui/dbsettings/DatabaseSettingsWidgetGeneral.h
@@ -26,7 +26,7 @@
class Database;
namespace Ui
{
-class DatabaseSettingsWidgetGeneral;
+ class DatabaseSettingsWidgetGeneral;
}
class DatabaseSettingsWidgetGeneral : public DatabaseSettingsWidget
@@ -38,7 +38,10 @@ public:
Q_DISABLE_COPY(DatabaseSettingsWidgetGeneral);
~DatabaseSettingsWidgetGeneral() override;
- inline bool hasAdvancedMode() const override { return false; }
+ inline bool hasAdvancedMode() const override
+ {
+ return false;
+ }
public slots:
void initialize() override;
@@ -51,4 +54,4 @@ protected:
const QScopedPointer<Ui::DatabaseSettingsWidgetGeneral> m_ui;
};
-#endif //KEEPASSXC_DATABASESETTINGSWIDGETGENERAL_H
+#endif // KEEPASSXC_DATABASESETTINGSWIDGETGENERAL_H
diff --git a/src/gui/dbsettings/DatabaseSettingsWidgetMasterKey.cpp b/src/gui/dbsettings/DatabaseSettingsWidgetMasterKey.cpp
index 3cc37accb..b1f07211e 100644
--- a/src/gui/dbsettings/DatabaseSettingsWidgetMasterKey.cpp
+++ b/src/gui/dbsettings/DatabaseSettingsWidgetMasterKey.cpp
@@ -16,18 +16,19 @@
*/
#include "DatabaseSettingsWidgetMasterKey.h"
+
#include "core/Database.h"
-#include "keys/PasswordKey.h"
-#include "keys/FileKey.h"
-#include "keys/YkChallengeResponseKey.h"
#include "gui/MessageBox.h"
-#include "gui/masterkey/PasswordEditWidget.h"
#include "gui/masterkey/KeyFileEditWidget.h"
+#include "gui/masterkey/PasswordEditWidget.h"
#include "gui/masterkey/YubiKeyEditWidget.h"
+#include "keys/FileKey.h"
+#include "keys/PasswordKey.h"
+#include "keys/YkChallengeResponseKey.h"
-#include <QVBoxLayout>
-#include <QSpacerItem>
#include <QPushButton>
+#include <QSpacerItem>
+#include <QVBoxLayout>
DatabaseSettingsWidgetMasterKey::DatabaseSettingsWidgetMasterKey(QWidget* parent)
: DatabaseSettingsWidget(parent)
@@ -82,7 +83,7 @@ void DatabaseSettingsWidgetMasterKey::load(QSharedPointer<Database> db)
bool isDirty = false;
bool hasAdditionalKeys = false;
- for (const auto& key: m_db->key()->keys()) {
+ for (const auto& key : m_db->key()->keys()) {
if (key->uuid() == PasswordKey::UUID) {
m_passwordEditWidget->setComponentAdded(true);
} else if (key->uuid() == FileKey::UUID) {
@@ -92,7 +93,7 @@ void DatabaseSettingsWidgetMasterKey::load(QSharedPointer<Database> db)
}
#ifdef WITH_XC_YUBIKEY
- for (const auto& key: m_db->key()->challengeResponseKeys()) {
+ for (const auto& key : m_db->key()->challengeResponseKeys()) {
if (key->uuid() == YkChallengeResponseKey::UUID) {
m_yubiKeyEditWidget->setComponentAdded(true);
hasAdditionalKeys = true;
@@ -128,7 +129,7 @@ bool DatabaseSettingsWidgetMasterKey::save()
m_isDirty |= (m_yubiKeyEditWidget->visiblePage() == KeyComponentWidget::Page::Edit);
#endif
- if (m_db->key() && ! m_db->key()->keys().isEmpty() && !m_isDirty) {
+ if (m_db->key() && !m_db->key()->keys().isEmpty() && !m_isDirty) {
// key unchanged
return true;
}
@@ -139,7 +140,7 @@ bool DatabaseSettingsWidgetMasterKey::save()
QSharedPointer<Key> fileKey;
QSharedPointer<ChallengeResponseKey> ykCrKey;
- for (const auto& key: m_db->key()->keys()) {
+ for (const auto& key : m_db->key()->keys()) {
if (key->uuid() == PasswordKey::UUID) {
passwordKey = key;
} else if (key->uuid() == FileKey::UUID) {
@@ -147,7 +148,7 @@ bool DatabaseSettingsWidgetMasterKey::save()
}
}
- for (const auto& key: m_db->key()->challengeResponseKeys()) {
+ for (const auto& key : m_db->key()->challengeResponseKeys()) {
if (key->uuid() == YkChallengeResponseKey::UUID) {
ykCrKey = key;
}
@@ -168,18 +169,22 @@ bool DatabaseSettingsWidgetMasterKey::save()
#endif
if (newKey->keys().isEmpty() && newKey->challengeResponseKeys().isEmpty()) {
- MessageBox::critical(this, tr("No encryption key added"),
+ MessageBox::critical(this,
+ tr("No encryption key added"),
tr("You must add at least one encryption key to secure your database!"),
- QMessageBox::Ok, QMessageBox::Ok);
+ QMessageBox::Ok,
+ QMessageBox::Ok);
return false;
}
if (m_passwordEditWidget->visiblePage() == KeyComponentWidget::AddNew) {
- auto answer = MessageBox::warning(this, tr("No password set"),
+ auto answer = MessageBox::warning(this,
+ tr("No password set"),
tr("WARNING! You have not set a password. Using a database without "
"a password is strongly discouraged!\n\n"
"Are you sure you want to continue without a password?"),
- QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel);
+ QMessageBox::Yes | QMessageBox::Cancel,
+ QMessageBox::Cancel);
if (answer != QMessageBox::Yes) {
return false;
}
@@ -210,7 +215,8 @@ void DatabaseSettingsWidgetMasterKey::setAdditionalKeyOptionsVisible(bool show)
}
bool DatabaseSettingsWidgetMasterKey::addToCompositeKey(KeyComponentWidget* widget,
- QSharedPointer<CompositeKey>& newKey, QSharedPointer<Key>& oldKey)
+ QSharedPointer<CompositeKey>& newKey,
+ QSharedPointer<Key>& oldKey)
{
if (widget->visiblePage() == KeyComponentWidget::Edit) {
QString error = tr("Unknown error");
@@ -226,7 +232,8 @@ bool DatabaseSettingsWidgetMasterKey::addToCompositeKey(KeyComponentWidget* widg
}
bool DatabaseSettingsWidgetMasterKey::addToCompositeKey(KeyComponentWidget* widget,
- QSharedPointer<CompositeKey>& newKey, QSharedPointer<ChallengeResponseKey>& oldKey)
+ QSharedPointer<CompositeKey>& newKey,
+ QSharedPointer<ChallengeResponseKey>& oldKey)
{
if (widget->visiblePage() == KeyComponentWidget::Edit) {
QString error = tr("Unknown error");
diff --git a/src/gui/dbsettings/DatabaseSettingsWidgetMasterKey.h b/src/gui/dbsettings/DatabaseSettingsWidgetMasterKey.h
index 7ab0b085f..1a3d6ed3f 100644
--- a/src/gui/dbsettings/DatabaseSettingsWidgetMasterKey.h
+++ b/src/gui/dbsettings/DatabaseSettingsWidgetMasterKey.h
@@ -18,8 +18,9 @@
#ifndef KEEPASSXC_DATABASESETTINGSPAGECHANGEMASTERKEY_H
#define KEEPASSXC_DATABASESETTINGSPAGECHANGEMASTERKEY_H
-#include "config-keepassx.h"
#include "DatabaseSettingsWidget.h"
+#include "config-keepassx.h"
+
#include <QPointer>
class Database;
@@ -32,7 +33,7 @@ class KeyFileEditWidget;
class YubiKeyEditWidget;
class QPushButton;
-class DatabaseSettingsWidgetMasterKey: public DatabaseSettingsWidget
+class DatabaseSettingsWidgetMasterKey : public DatabaseSettingsWidget
{
Q_OBJECT
@@ -43,7 +44,10 @@ public:
void load(QSharedPointer<Database> db) override;
- inline bool hasAdvancedMode() const override { return false; }
+ inline bool hasAdvancedMode() const override
+ {
+ return false;
+ }
public slots:
void initialize() override;
@@ -58,9 +62,12 @@ private slots:
private:
void setAdditionalKeyOptionsVisible(bool show);
+ // clang-format off
bool addToCompositeKey(KeyComponentWidget* widget,
QSharedPointer<CompositeKey>& newKey,
QSharedPointer<Key>& oldKey);
+ // clang-format on
+
bool addToCompositeKey(KeyComponentWidget* widget,
QSharedPointer<CompositeKey>& newKey,
QSharedPointer<ChallengeResponseKey>& oldKey);
@@ -75,4 +82,4 @@ private:
#endif
};
-#endif //KEEPASSXC_DATABASESETTINGSPAGECHANGEMASTERKEY_H
+#endif // KEEPASSXC_DATABASESETTINGSPAGECHANGEMASTERKEY_H
diff --git a/src/gui/dbsettings/DatabaseSettingsWidgetMetaDataSimple.cpp b/src/gui/dbsettings/DatabaseSettingsWidgetMetaDataSimple.cpp
index 6805d7b65..0a1dccb5f 100644
--- a/src/gui/dbsettings/DatabaseSettingsWidgetMetaDataSimple.cpp
+++ b/src/gui/dbsettings/DatabaseSettingsWidgetMetaDataSimple.cpp
@@ -17,6 +17,7 @@
#include "DatabaseSettingsWidgetMetaDataSimple.h"
#include "ui_DatabaseSettingsWidgetMetaDataSimple.h"
+
#include "core/Database.h"
#include "core/Metadata.h"
diff --git a/src/gui/dbsettings/DatabaseSettingsWidgetMetaDataSimple.h b/src/gui/dbsettings/DatabaseSettingsWidgetMetaDataSimple.h
index bc32c1ee0..c357305d8 100644
--- a/src/gui/dbsettings/DatabaseSettingsWidgetMetaDataSimple.h
+++ b/src/gui/dbsettings/DatabaseSettingsWidgetMetaDataSimple.h
@@ -26,19 +26,22 @@
class Database;
namespace Ui
{
-class DatabaseSettingsWidgetMetaDataSimple;
+ class DatabaseSettingsWidgetMetaDataSimple;
}
class DatabaseSettingWidgetMetaData : public DatabaseSettingsWidget
{
-Q_OBJECT
+ Q_OBJECT
public:
explicit DatabaseSettingWidgetMetaData(QWidget* parent = nullptr);
Q_DISABLE_COPY(DatabaseSettingWidgetMetaData);
~DatabaseSettingWidgetMetaData() override;
- inline bool hasAdvancedMode() const override { return false; }
+ inline bool hasAdvancedMode() const override
+ {
+ return false;
+ }
public slots:
void initialize() override;
@@ -52,4 +55,4 @@ private:
const QScopedPointer<Ui::DatabaseSettingsWidgetMetaDataSimple> m_ui;
};
-#endif //KEEPASSXC_DATABASESETTINGSWIDGEMETADATA_H
+#endif // KEEPASSXC_DATABASESETTINGSWIDGEMETADATA_H
diff --git a/src/gui/entry/AutoTypeMatchView.cpp b/src/gui/entry/AutoTypeMatchView.cpp
index 087f2cc64..9c4e81d92 100644
--- a/src/gui/entry/AutoTypeMatchView.cpp
+++ b/src/gui/entry/AutoTypeMatchView.cpp
@@ -18,11 +18,11 @@
#include "AutoTypeMatchView.h"
+#include "gui/SortFilterHideProxyModel.h"
+
#include <QHeaderView>
#include <QKeyEvent>
-#include "gui/SortFilterHideProxyModel.h"
-
AutoTypeMatchView::AutoTypeMatchView(QWidget* parent)
: QTreeView(parent)
, m_model(new AutoTypeMatchModel(this))
@@ -43,8 +43,10 @@ AutoTypeMatchView::AutoTypeMatchView(QWidget* parent)
header()->setDefaultSectionSize(150);
connect(this, SIGNAL(doubleClicked(QModelIndex)), SLOT(emitMatchActivated(QModelIndex)));
+ // clang-format off
connect(
selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SIGNAL(matchSelectionChanged()));
+ // clang-format on
}
void AutoTypeMatchView::keyPressEvent(QKeyEvent* event)
diff --git a/src/gui/entry/EditEntryWidget.cpp b/src/gui/entry/EditEntryWidget.cpp
index 75e5294ba..335ac1aa4 100644
--- a/src/gui/entry/EditEntryWidget.cpp
+++ b/src/gui/entry/EditEntryWidget.cpp
@@ -102,9 +102,12 @@ EditEntryWidget::EditEntryWidget(QWidget* parent)
connect(this, SIGNAL(accepted()), SLOT(acceptEntry()));
connect(this, SIGNAL(rejected()), SLOT(cancel()));
connect(this, SIGNAL(apply()), SLOT(commitEntry()));
+ // clang-format off
connect(m_iconsWidget,
SIGNAL(messageEditEntry(QString,MessageWidget::MessageType)),
SLOT(showMessage(QString,MessageWidget::MessageType)));
+ // clang-format on
+
connect(m_iconsWidget, SIGNAL(messageEditEntryDismiss()), SLOT(hideMessage()));
m_mainUi->passwordGenerator->layout()->setContentsMargins(0, 0, 0, 0);
@@ -166,6 +169,8 @@ void EditEntryWidget::setupAdvanced()
m_attributesModel->setEntryAttributes(m_entryAttributes);
m_advancedUi->attributesView->setModel(m_attributesModel);
+
+ // clang-format off
connect(m_advancedUi->addAttributeButton, SIGNAL(clicked()), SLOT(insertAttribute()));
connect(m_advancedUi->editAttributeButton, SIGNAL(clicked()), SLOT(editCurrentAttribute()));
connect(m_advancedUi->removeAttributeButton, SIGNAL(clicked()), SLOT(removeCurrentAttribute()));
@@ -176,6 +181,7 @@ void EditEntryWidget::setupAdvanced()
SLOT(updateCurrentAttribute()));
connect(m_advancedUi->fgColorButton, SIGNAL(clicked()), SLOT(pickColor()));
connect(m_advancedUi->bgColorButton, SIGNAL(clicked()), SLOT(pickColor()));
+ // clang-format on
}
void EditEntryWidget::setupIcon()
@@ -193,26 +199,27 @@ void EditEntryWidget::setupAutoType()
m_autoTypeAssocModel->setAutoTypeAssociations(m_autoTypeAssoc);
m_autoTypeUi->assocView->setModel(m_autoTypeAssocModel);
m_autoTypeUi->assocView->setColumnHidden(1, true);
+
+ // clang-format off
connect(m_autoTypeUi->enableButton, SIGNAL(toggled(bool)), SLOT(updateAutoTypeEnabled()));
- connect(
- m_autoTypeUi->customSequenceButton, SIGNAL(toggled(bool)), m_autoTypeUi->sequenceEdit, SLOT(setEnabled(bool)));
- connect(m_autoTypeUi->customWindowSequenceButton,
- SIGNAL(toggled(bool)),
- m_autoTypeUi->windowSequenceEdit,
- SLOT(setEnabled(bool)));
+ connect(m_autoTypeUi->customSequenceButton, SIGNAL(toggled(bool)),
+ m_autoTypeUi->sequenceEdit, SLOT(setEnabled(bool)));
+ connect(m_autoTypeUi->customWindowSequenceButton, SIGNAL(toggled(bool)),
+ m_autoTypeUi->windowSequenceEdit, SLOT(setEnabled(bool)));
connect(m_autoTypeUi->assocAddButton, SIGNAL(clicked()), SLOT(insertAutoTypeAssoc()));
connect(m_autoTypeUi->assocRemoveButton, SIGNAL(clicked()), SLOT(removeAutoTypeAssoc()));
connect(m_autoTypeUi->assocView->selectionModel(),
SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
SLOT(updateAutoTypeEnabled()));
- connect(m_autoTypeAssocModel, SIGNAL(modelReset()), SLOT(updateAutoTypeEnabled()));
connect(m_autoTypeUi->assocView->selectionModel(),
SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
SLOT(loadCurrentAssoc(QModelIndex)));
+ connect(m_autoTypeAssocModel, SIGNAL(modelReset()), SLOT(updateAutoTypeEnabled()));
connect(m_autoTypeAssocModel, SIGNAL(modelReset()), SLOT(clearCurrentAssoc()));
connect(m_autoTypeUi->windowTitleCombo, SIGNAL(editTextChanged(QString)), SLOT(applyCurrentAssoc()));
connect(m_autoTypeUi->customWindowSequenceButton, SIGNAL(toggled(bool)), SLOT(applyCurrentAssoc()));
connect(m_autoTypeUi->windowSequenceEdit, SIGNAL(textChanged(QString)), SLOT(applyCurrentAssoc()));
+ // clang-format on
}
void EditEntryWidget::setupProperties()
@@ -234,14 +241,17 @@ void EditEntryWidget::setupHistory()
m_historyUi->historyView->setModel(m_sortModel);
m_historyUi->historyView->setRootIsDecorated(false);
+ // clang-format off
connect(m_historyUi->historyView, SIGNAL(activated(QModelIndex)), SLOT(histEntryActivated(QModelIndex)));
connect(m_historyUi->historyView->selectionModel(),
SIGNAL(currentChanged(QModelIndex,QModelIndex)),
SLOT(updateHistoryButtons(QModelIndex,QModelIndex)));
+
connect(m_historyUi->showButton, SIGNAL(clicked()), SLOT(showHistoryEntry()));
connect(m_historyUi->restoreButton, SIGNAL(clicked()), SLOT(restoreHistoryEntry()));
connect(m_historyUi->deleteButton, SIGNAL(clicked()), SLOT(deleteHistoryEntry()));
connect(m_historyUi->deleteAllButton, SIGNAL(clicked()), SLOT(deleteAllHistoryEntries()));
+ // clang-format on
}
void EditEntryWidget::setupEntryUpdate()
@@ -253,7 +263,7 @@ void EditEntryWidget::setupEntryUpdate()
connect(m_mainUi->passwordRepeatEdit, SIGNAL(textChanged(QString)), this, SLOT(setUnsavedChanges()));
connect(m_mainUi->urlEdit, SIGNAL(textChanged(QString)), this, SLOT(setUnsavedChanges()));
#ifdef WITH_XC_NETWORKING
- connect(m_mainUi->urlEdit, SIGNAL(textChanged(const QString&)), this, SLOT(updateFaviconButtonEnable(const QString&)));
+ connect(m_mainUi->urlEdit, SIGNAL(textChanged(QString&)), this, SLOT(updateFaviconButtonEnable(QString&)));
#endif
connect(m_mainUi->expireCheck, SIGNAL(stateChanged(int)), this, SLOT(setUnsavedChanges()));
connect(m_mainUi->notesEnabled, SIGNAL(stateChanged(int)), this, SLOT(setUnsavedChanges()));
@@ -280,7 +290,7 @@ void EditEntryWidget::setupEntryUpdate()
connect(m_autoTypeUi->windowTitleCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setUnsavedChanges()));
connect(m_autoTypeUi->windowTitleCombo, SIGNAL(editTextChanged(QString)), this, SLOT(setUnsavedChanges()));
-// Properties and History tabs don't need extra connections
+ // Properties and History tabs don't need extra connections
#ifdef WITH_XC_SSHAGENT
// SSH Agent tab
@@ -288,13 +298,12 @@ void EditEntryWidget::setupEntryUpdate()
connect(m_sshAgentUi->attachmentRadioButton, SIGNAL(toggled(bool)), this, SLOT(setUnsavedChanges()));
connect(m_sshAgentUi->externalFileRadioButton, SIGNAL(toggled(bool)), this, SLOT(setUnsavedChanges()));
connect(m_sshAgentUi->attachmentComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setUnsavedChanges()));
- connect(
- m_sshAgentUi->attachmentComboBox, SIGNAL(editTextChanged(QString)), this, SLOT(setUnsavedChanges()));
+ connect(m_sshAgentUi->attachmentComboBox, SIGNAL(editTextChanged(QString)), this, SLOT(setUnsavedChanges()));
connect(m_sshAgentUi->externalFileEdit, SIGNAL(textChanged(QString)), this, SLOT(setUnsavedChanges()));
connect(m_sshAgentUi->addKeyToAgentCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setUnsavedChanges()));
connect(m_sshAgentUi->removeKeyFromAgentCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setUnsavedChanges()));
- connect(
- m_sshAgentUi->requireUserConfirmationCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setUnsavedChanges()));
+ connect(m_sshAgentUi->requireUserConfirmationCheckBox, SIGNAL(stateChanged(int)),
+ this, SLOT(setUnsavedChanges()));
connect(m_sshAgentUi->lifetimeCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setUnsavedChanges()));
connect(m_sshAgentUi->lifetimeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setUnsavedChanges()));
}
@@ -427,11 +436,8 @@ void EditEntryWidget::updateSSHAgentKeyInfo()
}
if (!key.fingerprint().isEmpty()) {
- m_sshAgentUi->fingerprintTextLabel->setText(
- key.fingerprint(QCryptographicHash::Md5) +
- "\n" +
- key.fingerprint(QCryptographicHash::Sha256)
- );
+ m_sshAgentUi->fingerprintTextLabel->setText(key.fingerprint(QCryptographicHash::Md5) + "\n"
+ + key.fingerprint(QCryptographicHash::Sha256));
} else {
m_sshAgentUi->fingerprintTextLabel->setText(tr("(encrypted)"));
}
@@ -613,11 +619,8 @@ void EditEntryWidget::decryptPrivateKey()
m_sshAgentUi->commentTextLabel->setText(tr("n/a"));
}
- m_sshAgentUi->fingerprintTextLabel->setText(
- key.fingerprint(QCryptographicHash::Md5) +
- "\n" +
- key.fingerprint(QCryptographicHash::Sha256)
- );
+ m_sshAgentUi->fingerprintTextLabel->setText(key.fingerprint(QCryptographicHash::Md5) + "\n"
+ + key.fingerprint(QCryptographicHash::Sha256));
m_sshAgentUi->publicKeyEdit->document()->setPlainText(key.publicKey());
m_sshAgentUi->copyToClipboardButton->setEnabled(true);
}
diff --git a/src/gui/entry/EditEntryWidget.h b/src/gui/entry/EditEntryWidget.h
index b0f5d8c94..9473f76ac 100644
--- a/src/gui/entry/EditEntryWidget.h
+++ b/src/gui/entry/EditEntryWidget.h
@@ -19,6 +19,7 @@
#ifndef KEEPASSX_EDITENTRYWIDGET_H
#define KEEPASSX_EDITENTRYWIDGET_H
+#include <QButtonGroup>
#include <QModelIndex>
#include <QScopedPointer>
#include <QButtonGroup>
@@ -52,7 +53,7 @@ namespace Ui
class EditEntryWidgetMain;
class EditEntryWidgetHistory;
class EditWidget;
-}
+} // namespace Ui
class EditEntryWidget : public EditWidget
{
diff --git a/src/gui/entry/EntryAttachmentsWidget.cpp b/src/gui/entry/EntryAttachmentsWidget.cpp
index 6f42a1994..e7a72c51e 100644
--- a/src/gui/entry/EntryAttachmentsWidget.cpp
+++ b/src/gui/entry/EntryAttachmentsWidget.cpp
@@ -43,9 +43,12 @@ EntryAttachmentsWidget::EntryAttachmentsWidget(QWidget* parent)
connect(this, SIGNAL(readOnlyChanged(bool)), SLOT(updateButtonsEnabled()));
connect(m_attachmentsModel, SIGNAL(modelReset()), SLOT(updateButtonsEnabled()));
+
+ // clang-format off
connect(m_ui->attachmentsView->selectionModel(),
SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
SLOT(updateButtonsEnabled()));
+ // clang-format on
connect(m_ui->attachmentsView, SIGNAL(doubleClicked(QModelIndex)), SLOT(openAttachment(QModelIndex)));
connect(m_ui->saveAttachmentButton, SIGNAL(clicked()), SLOT(saveSelectedAttachments()));
diff --git a/src/gui/entry/EntryAttributesModel.cpp b/src/gui/entry/EntryAttributesModel.cpp
index 373fcc6c7..bfdb592cd 100644
--- a/src/gui/entry/EntryAttributesModel.cpp
+++ b/src/gui/entry/EntryAttributesModel.cpp
@@ -46,9 +46,15 @@ void EntryAttributesModel::setEntryAttributes(EntryAttributes* entryAttributes)
connect(m_entryAttributes, SIGNAL(added(QString)), SLOT(attributeAdd()));
connect(m_entryAttributes, SIGNAL(aboutToBeRemoved(QString)), SLOT(attributeAboutToRemove(QString)));
connect(m_entryAttributes, SIGNAL(removed(QString)), SLOT(attributeRemove()));
+ // clang-format off
connect(
m_entryAttributes, SIGNAL(aboutToRename(QString,QString)), SLOT(attributeAboutToRename(QString,QString)));
+ // clang-format on
+
+ // clang-format off
connect(m_entryAttributes, SIGNAL(renamed(QString,QString)), SLOT(attributeRename(QString,QString)));
+ // clang-format on
+
connect(m_entryAttributes, SIGNAL(aboutToBeReset()), SLOT(aboutToReset()));
connect(m_entryAttributes, SIGNAL(reset()), SLOT(reset()));
}
diff --git a/src/gui/entry/EntryView.cpp b/src/gui/entry/EntryView.cpp
index fa237163e..0a620a687 100644
--- a/src/gui/entry/EntryView.cpp
+++ b/src/gui/entry/EntryView.cpp
@@ -49,10 +49,12 @@ EntryView::EntryView(QWidget* parent)
// QAbstractItemView::startDrag() uses this property as the default drag action
setDefaultDropAction(Qt::MoveAction);
+ // clang-format off
connect(this, SIGNAL(doubleClicked(QModelIndex)), SLOT(emitEntryActivated(QModelIndex)));
connect(selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SLOT(emitEntrySelectionChanged()));
connect(m_model, SIGNAL(usernamesHiddenChanged()), SIGNAL(viewStateChanged()));
connect(m_model, SIGNAL(passwordsHiddenChanged()), SIGNAL(viewStateChanged()));
+ // clang-format on
m_headerMenu = new QMenu(this);
m_headerMenu->setTitle(tr("Customize View"));
@@ -93,10 +95,21 @@ EntryView::EntryView(QWidget* parent)
header()->setContextMenuPolicy(Qt::CustomContextMenu);
connect(header(), SIGNAL(customContextMenuRequested(QPoint)), SLOT(showHeaderMenu(QPoint)));
+ // clang-format off
connect(header(), SIGNAL(sectionCountChanged(int,int)), SIGNAL(viewStateChanged()));
+ // clang-format on
+
+ // clang-format off
connect(header(), SIGNAL(sectionMoved(int,int,int)), SIGNAL(viewStateChanged()));
+ // clang-format on
+
+ // clang-format off
connect(header(), SIGNAL(sectionResized(int,int,int)), SIGNAL(viewStateChanged()));
+ // clang-format on
+
+ // clang-format off
connect(header(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), SIGNAL(viewStateChanged()));
+ // clang-format on
resetFixedColumns();
diff --git a/src/gui/group/EditGroupWidget.cpp b/src/gui/group/EditGroupWidget.cpp
index 5143f4fc1..ec0b604a4 100644
--- a/src/gui/group/EditGroupWidget.cpp
+++ b/src/gui/group/EditGroupWidget.cpp
@@ -47,9 +47,12 @@ EditGroupWidget::EditGroupWidget(QWidget* parent)
connect(this, SIGNAL(accepted()), SLOT(save()));
connect(this, SIGNAL(rejected()), SLOT(cancel()));
+ // clang-format off
connect(m_editGroupWidgetIcons,
SIGNAL(messageEditEntry(QString,MessageWidget::MessageType)),
SLOT(showMessage(QString,MessageWidget::MessageType)));
+ // clang-format on
+
connect(m_editGroupWidgetIcons, SIGNAL(messageEditEntryDismiss()), SLOT(hideMessage()));
}
diff --git a/src/gui/group/EditGroupWidget.h b/src/gui/group/EditGroupWidget.h
index 992af0072..f229e4594 100644
--- a/src/gui/group/EditGroupWidget.h
+++ b/src/gui/group/EditGroupWidget.h
@@ -31,7 +31,7 @@ namespace Ui
{
class EditGroupWidgetMain;
class EditWidget;
-}
+} // namespace Ui
class EditGroupWidget : public EditWidget
{
diff --git a/src/gui/group/GroupModel.cpp b/src/gui/group/GroupModel.cpp
index bb579be03..da84e3d69 100644
--- a/src/gui/group/GroupModel.cpp
+++ b/src/gui/group/GroupModel.cpp
@@ -39,6 +39,7 @@ void GroupModel::changeDatabase(Database* newDb)
m_db = newDb;
+ // clang-format off
connect(m_db, SIGNAL(groupDataChanged(Group*)), SLOT(groupDataChanged(Group*)));
connect(m_db, SIGNAL(groupAboutToAdd(Group*,int)), SLOT(groupAboutToAdd(Group*,int)));
connect(m_db, SIGNAL(groupAdded()), SLOT(groupAdded()));
@@ -46,6 +47,7 @@ void GroupModel::changeDatabase(Database* newDb)
connect(m_db, SIGNAL(groupRemoved()), SLOT(groupRemoved()));
connect(m_db, SIGNAL(groupAboutToMove(Group*,Group*,int)), SLOT(groupAboutToMove(Group*,Group*,int)));
connect(m_db, SIGNAL(groupMoved()), SLOT(groupMoved()));
+ // clang-format on
endResetModel();
}
diff --git a/src/gui/group/GroupView.cpp b/src/gui/group/GroupView.cpp
index 5d7cba96a..567048631 100644
--- a/src/gui/group/GroupView.cpp
+++ b/src/gui/group/GroupView.cpp
@@ -34,11 +34,13 @@ GroupView::GroupView(Database* db, QWidget* parent)
setHeaderHidden(true);
setUniformRowHeights(true);
+ // clang-format off
connect(this, SIGNAL(expanded(QModelIndex)), SLOT(expandedChanged(QModelIndex)));
connect(this, SIGNAL(collapsed(QModelIndex)), SLOT(expandedChanged(QModelIndex)));
connect(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), SLOT(syncExpandedState(QModelIndex,int,int)));
connect(m_model, SIGNAL(modelReset()), SLOT(modelReset()));
connect(selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), SLOT(emitGroupChanged()));
+ // clang-format on
modelReset();
diff --git a/src/gui/masterkey/KeyComponentWidget.cpp b/src/gui/masterkey/KeyComponentWidget.cpp
index 72367ecbe..7d795aca1 100644
--- a/src/gui/masterkey/KeyComponentWidget.cpp
+++ b/src/gui/masterkey/KeyComponentWidget.cpp
@@ -17,6 +17,7 @@
#include "KeyComponentWidget.h"
#include "ui_KeyComponentWidget.h"
+
#include <QStackedWidget>
#include <QTimer>
@@ -124,7 +125,8 @@ void KeyComponentWidget::updateComponentName(const QString& name)
m_ui->addButton->setText(tr("Add %1", "Add a key component").arg(name));
m_ui->changeButton->setText(tr("Change %1", "Change a key component").arg(name));
m_ui->removeButton->setText(tr("Remove %1", "Remove a key component").arg(name));
- m_ui->changeOrRemoveLabel->setText(tr("%1 set, click to change or remove", "Change or remove a key component").arg(name));
+ m_ui->changeOrRemoveLabel->setText(
+ tr("%1 set, click to change or remove", "Change or remove a key component").arg(name));
}
void KeyComponentWidget::updateComponentDescription(const QString& description)
diff --git a/src/gui/masterkey/KeyComponentWidget.h b/src/gui/masterkey/KeyComponentWidget.h
index 5d5188d6e..cf2ae4947 100644
--- a/src/gui/masterkey/KeyComponentWidget.h
+++ b/src/gui/masterkey/KeyComponentWidget.h
@@ -18,12 +18,12 @@
#ifndef KEEPASSXC_KEYCOMPONENTWIDGET_H
#define KEEPASSXC_KEYCOMPONENTWIDGET_H
-#include <QWidget>
#include <QScopedPointer>
+#include <QWidget>
namespace Ui
{
-class KeyComponentWidget;
+ class KeyComponentWidget;
}
class CompositeKey;
class QStackedWidget;
@@ -31,12 +31,14 @@ class QStackedWidget;
class KeyComponentWidget : public QWidget
{
Q_OBJECT
+ // clang-format off
Q_PROPERTY(QString componentName READ m_componentName READ componentName
WRITE setComponentName NOTIFY nameChanged)
Q_PROPERTY(QString componentDescription READ m_componentDescription READ componentDescription
WRITE setComponentDescription NOTIFY descriptionChanged)
Q_PROPERTY(bool componentAdded READ m_isComponentAdded READ componentAdded
WRITE setComponentAdded NOTIFY componentAddChanged)
+ // clang-format on
public:
enum Page
@@ -127,4 +129,4 @@ private:
const QScopedPointer<Ui::KeyComponentWidget> m_ui;
};
-#endif //KEEPASSXC_KEYCOMPONENTWIDGET_H
+#endif // KEEPASSXC_KEYCOMPONENTWIDGET_H
diff --git a/src/gui/masterkey/KeyFileEditWidget.cpp b/src/gui/masterkey/KeyFileEditWidget.cpp
index c694e2c5a..ff56f2cb4 100644
--- a/src/gui/masterkey/KeyFileEditWidget.cpp
+++ b/src/gui/masterkey/KeyFileEditWidget.cpp
@@ -17,8 +17,9 @@
#include "KeyFileEditWidget.h"
#include "ui_KeyFileEditWidget.h"
-#include "gui/MainWindow.h"
+
#include "gui/FileDialog.h"
+#include "gui/MainWindow.h"
#include "gui/MessageBox.h"
#include "keys/CompositeKey.h"
#include "keys/FileKey.h"
@@ -100,8 +101,10 @@ void KeyFileEditWidget::createKeyFile()
QString errorMsg;
bool created = FileKey::create(fileName, &errorMsg);
if (!created) {
- MessageBox::critical(getMainWindow(), tr("Error creating key file"),
- tr("Unable to create key file: %1").arg(errorMsg), QMessageBox::Button::Ok);
+ MessageBox::critical(getMainWindow(),
+ tr("Error creating key file"),
+ tr("Unable to create key file: %1").arg(errorMsg),
+ QMessageBox::Button::Ok);
} else {
m_compUi->keyFileCombo->setEditText(fileName);
}
diff --git a/src/gui/masterkey/KeyFileEditWidget.h b/src/gui/masterkey/KeyFileEditWidget.h
index aa6c71a58..76cb31fa4 100644
--- a/src/gui/masterkey/KeyFileEditWidget.h
+++ b/src/gui/masterkey/KeyFileEditWidget.h
@@ -23,12 +23,12 @@
namespace Ui
{
-class KeyFileEditWidget;
+ class KeyFileEditWidget;
}
class KeyFileEditWidget : public KeyComponentWidget
{
-Q_OBJECT
+ Q_OBJECT
public:
explicit KeyFileEditWidget(QWidget* parent = nullptr);
@@ -51,4 +51,4 @@ private:
QPointer<QWidget> m_compEditWidget;
};
-#endif //KEEPASSXC_KEYFILEEDITWIDGET_H
+#endif // KEEPASSXC_KEYFILEEDITWIDGET_H
diff --git a/src/gui/masterkey/PasswordEditWidget.cpp b/src/gui/masterkey/PasswordEditWidget.cpp
index 4006a0b1e..d9d293c43 100644
--- a/src/gui/masterkey/PasswordEditWidget.cpp
+++ b/src/gui/masterkey/PasswordEditWidget.cpp
@@ -17,10 +17,11 @@
#include "PasswordEditWidget.h"
#include "ui_PasswordEditWidget.h"
+
#include "core/FilePath.h"
#include "gui/PasswordGeneratorWidget.h"
-#include "keys/PasswordKey.h"
#include "keys/CompositeKey.h"
+#include "keys/PasswordKey.h"
#include <QDialog>
@@ -67,7 +68,10 @@ QWidget* PasswordEditWidget::componentEditWidget()
m_compUi->passwordGeneratorButton->setIcon(filePath()->icon("actions", "password-generator", false));
m_compUi->repeatPasswordEdit->enableVerifyMode(m_compUi->enterPasswordEdit);
- connect(m_compUi->togglePasswordButton, SIGNAL(toggled(bool)), m_compUi->enterPasswordEdit, SLOT(setShowPassword(bool)));
+ connect(m_compUi->togglePasswordButton,
+ SIGNAL(toggled(bool)),
+ m_compUi->enterPasswordEdit,
+ SLOT(setShowPassword(bool)));
connect(m_compUi->passwordGeneratorButton, SIGNAL(clicked(bool)), SLOT(showPasswordGenerator()));
return m_compEditWidget;
diff --git a/src/gui/masterkey/PasswordEditWidget.h b/src/gui/masterkey/PasswordEditWidget.h
index ac10c5122..eefe8855e 100644
--- a/src/gui/masterkey/PasswordEditWidget.h
+++ b/src/gui/masterkey/PasswordEditWidget.h
@@ -23,7 +23,7 @@
namespace Ui
{
-class PasswordEditWidget;
+ class PasswordEditWidget;
}
class PasswordEditWidget : public KeyComponentWidget
@@ -53,4 +53,4 @@ private:
QPointer<QWidget> m_compEditWidget;
};
-#endif //KEEPASSXC_PASSWORDEDITWIDGET_H
+#endif // KEEPASSXC_PASSWORDEDITWIDGET_H
diff --git a/src/gui/masterkey/YubiKeyEditWidget.cpp b/src/gui/masterkey/YubiKeyEditWidget.cpp
index 27e0a4cf0..96b06833d 100644
--- a/src/gui/masterkey/YubiKeyEditWidget.cpp
+++ b/src/gui/masterkey/YubiKeyEditWidget.cpp
@@ -17,11 +17,12 @@
#include "YubiKeyEditWidget.h"
#include "ui_YubiKeyEditWidget.h"
-#include "gui/MessageBox.h"
+
+#include "config-keepassx.h"
#include "gui/MainWindow.h"
+#include "gui/MessageBox.h"
#include "keys/CompositeKey.h"
#include "keys/YkChallengeResponseKey.h"
-#include "config-keepassx.h"
#include <QtConcurrent>
@@ -30,10 +31,11 @@ YubiKeyEditWidget::YubiKeyEditWidget(QWidget* parent)
, m_compUi(new Ui::YubiKeyEditWidget())
{
setComponentName(tr("YubiKey Challenge-Response"));
- setComponentDescription(tr("<p>If you own a <a href=\"https://www.yubico.com/\">YubiKey</a>, you can use it "
- "for additional security.</p><p>The YubiKey requires one of its slots to be programmed as "
- "<a href=\"https://www.yubico.com/products/services-software/personalization-tools/challenge-response/\">"
- "HMAC-SHA1 Challenge-Response</a>.</p>"));
+ setComponentDescription(
+ tr("<p>If you own a <a href=\"https://www.yubico.com/\">YubiKey</a>, you can use it "
+ "for additional security.</p><p>The YubiKey requires one of its slots to be programmed as "
+ "<a href=\"https://www.yubico.com/products/services-software/personalization-tools/challenge-response/\">"
+ "HMAC-SHA1 Challenge-Response</a>.</p>"));
}
YubiKeyEditWidget::~YubiKeyEditWidget()
@@ -75,7 +77,10 @@ QWidget* YubiKeyEditWidget::componentEditWidget()
#ifdef WITH_XC_YUBIKEY
connect(m_compUi->buttonRedetectYubikey, SIGNAL(clicked()), SLOT(pollYubikey()));
+ // clang-format off
connect(YubiKey::instance(), SIGNAL(detected(int,bool)), SLOT(yubikeyDetected(int,bool)), Qt::QueuedConnection);
+ // clang-format on
+
connect(YubiKey::instance(), SIGNAL(notFound()), SLOT(noYubikeyFound()), Qt::QueuedConnection);
pollYubikey();
diff --git a/src/gui/masterkey/YubiKeyEditWidget.h b/src/gui/masterkey/YubiKeyEditWidget.h
index 82fc8b35a..8d7498034 100644
--- a/src/gui/masterkey/YubiKeyEditWidget.h
+++ b/src/gui/masterkey/YubiKeyEditWidget.h
@@ -23,7 +23,7 @@
namespace Ui
{
-class YubiKeyEditWidget;
+ class YubiKeyEditWidget;
}
class YkChallengeResponseKey;
@@ -57,4 +57,4 @@ private:
bool m_isDetected = false;
};
-#endif //KEEPASSXC_YUBIKEYEDITWIDGET_H
+#endif // KEEPASSXC_YUBIKEYEDITWIDGET_H
diff --git a/src/gui/settings/SettingsWidget.h b/src/gui/settings/SettingsWidget.h
index 4630a776e..8c55c5221 100644
--- a/src/gui/settings/SettingsWidget.h
+++ b/src/gui/settings/SettingsWidget.h
@@ -62,7 +62,7 @@ public slots:
/**
* Discard settings.
*/
- virtual void discard() {};
+ virtual void discard(){};
signals:
void editFinished(bool saved);
@@ -72,4 +72,4 @@ private:
bool m_advancedMode = false;
};
-#endif //KEEPASSXC_SETTINGSWIDGET_H
+#endif // KEEPASSXC_SETTINGSWIDGET_H
diff --git a/src/gui/wizard/NewDatabaseWizard.cpp b/src/gui/wizard/NewDatabaseWizard.cpp
index 004d92f31..be5277ac5 100644
--- a/src/gui/wizard/NewDatabaseWizard.cpp
+++ b/src/gui/wizard/NewDatabaseWizard.cpp
@@ -16,14 +16,14 @@
*/
#include "NewDatabaseWizard.h"
-#include "NewDatabaseWizardPageMetaData.h"
#include "NewDatabaseWizardPageEncryption.h"
#include "NewDatabaseWizardPageMasterKey.h"
+#include "NewDatabaseWizardPageMetaData.h"
-#include "core/Global.h"
#include "core/Database.h"
-#include "core/Group.h"
#include "core/FilePath.h"
+#include "core/Global.h"
+#include "core/Group.h"
#include "format/KeePass2.h"
#include <QVBoxLayout>
@@ -35,11 +35,13 @@ NewDatabaseWizard::NewDatabaseWizard(QWidget* parent)
setWizardStyle(QWizard::MacStyle);
setOption(QWizard::WizardOption::HaveHelpButton, false);
+ // clang-format off
m_pages << new NewDatabaseWizardPageMetaData()
<< new NewDatabaseWizardPageEncryption()
<< new NewDatabaseWizardPageMasterKey();
+ // clang-format on
- for (const auto& page: asConst(m_pages)) {
+ for (const auto& page : asConst(m_pages)) {
addPage(page);
}
diff --git a/src/gui/wizard/NewDatabaseWizard.h b/src/gui/wizard/NewDatabaseWizard.h
index 802dc061e..fd18f7b22 100644
--- a/src/gui/wizard/NewDatabaseWizard.h
+++ b/src/gui/wizard/NewDatabaseWizard.h
@@ -30,7 +30,7 @@ class NewDatabaseWizardPage;
*/
class NewDatabaseWizard : public QWizard
{
-Q_OBJECT
+ Q_OBJECT
public:
explicit NewDatabaseWizard(QWidget* parent = nullptr);
@@ -47,4 +47,4 @@ private:
QList<QPointer<NewDatabaseWizardPage>> m_pages;
};
-#endif //KEEPASSXC_NEWDATABASEWIZARD_H
+#endif // KEEPASSXC_NEWDATABASEWIZARD_H
diff --git a/src/gui/wizard/NewDatabaseWizardPage.cpp b/src/gui/wizard/NewDatabaseWizardPage.cpp
index b49b7b384..5b64a6b3d 100644
--- a/src/gui/wizard/NewDatabaseWizardPage.cpp
+++ b/src/gui/wizard/NewDatabaseWizardPage.cpp
@@ -19,6 +19,7 @@
#include "NewDatabaseWizardPage.h"
#include "ui_NewDatabaseWizardPage.h"
+
#include "core/Database.h"
#include "gui/dbsettings/DatabaseSettingsWidget.h"
diff --git a/src/gui/wizard/NewDatabaseWizardPage.h b/src/gui/wizard/NewDatabaseWizardPage.h
index 785527e23..ea5158a00 100644
--- a/src/gui/wizard/NewDatabaseWizardPage.h
+++ b/src/gui/wizard/NewDatabaseWizardPage.h
@@ -26,7 +26,7 @@ class Database;
class DatabaseSettingsWidget;
namespace Ui
{
-class NewDatabaseWizardPage;
+ class NewDatabaseWizardPage;
}
/**
@@ -34,7 +34,7 @@ class NewDatabaseWizardPage;
*/
class NewDatabaseWizardPage : public QWizardPage
{
-Q_OBJECT
+ Q_OBJECT
public:
explicit NewDatabaseWizardPage(QWidget* parent = nullptr);
@@ -58,4 +58,4 @@ protected:
const QScopedPointer<Ui::NewDatabaseWizardPage> m_ui;
};
-#endif //KEEPASSXC_NEWDATABASEWIZARDPAGE_H
+#endif // KEEPASSXC_NEWDATABASEWIZARDPAGE_H
diff --git a/src/gui/wizard/NewDatabaseWizardPageEncryption.h b/src/gui/wizard/NewDatabaseWizardPageEncryption.h
index c10e84dba..af22851ff 100644
--- a/src/gui/wizard/NewDatabaseWizardPageEncryption.h
+++ b/src/gui/wizard/NewDatabaseWizardPageEncryption.h
@@ -22,7 +22,7 @@
class NewDatabaseWizardPageEncryption : public NewDatabaseWizardPage
{
-Q_OBJECT
+ Q_OBJECT
public:
explicit NewDatabaseWizardPageEncryption(QWidget* parent = nullptr);
@@ -30,4 +30,4 @@ public:
~NewDatabaseWizardPageEncryption() override;
};
-#endif //KEEPASSXC_NEWDATABASEWIZARDPAGEENCRYPTION_H
+#endif // KEEPASSXC_NEWDATABASEWIZARDPAGEENCRYPTION_H
diff --git a/src/gui/wizard/NewDatabaseWizardPageMasterKey.h b/src/gui/wizard/NewDatabaseWizardPageMasterKey.h
index c6fa53cea..3b5072846 100644
--- a/src/gui/wizard/NewDatabaseWizardPageMasterKey.h
+++ b/src/gui/wizard/NewDatabaseWizardPageMasterKey.h
@@ -22,7 +22,7 @@
class NewDatabaseWizardPageMasterKey : public NewDatabaseWizardPage
{
-Q_OBJECT
+ Q_OBJECT
public:
explicit NewDatabaseWizardPageMasterKey(QWidget* parent = nullptr);
@@ -33,4 +33,4 @@ private slots:
void updateWindowSize();
};
-#endif //KEEPASSXC_NEWDATABASEWIZARDPAGEMASTERKEY_H
+#endif // KEEPASSXC_NEWDATABASEWIZARDPAGEMASTERKEY_H
diff --git a/src/gui/wizard/NewDatabaseWizardPageMetaData.h b/src/gui/wizard/NewDatabaseWizardPageMetaData.h
index 44e8f1941..01b6fc47c 100644
--- a/src/gui/wizard/NewDatabaseWizardPageMetaData.h
+++ b/src/gui/wizard/NewDatabaseWizardPageMetaData.h
@@ -27,7 +27,7 @@ class Database;
class NewDatabaseWizardPageMetaData : public NewDatabaseWizardPage
{
-Q_OBJECT
+ Q_OBJECT
public:
explicit NewDatabaseWizardPageMetaData(QWidget* parent = nullptr);
@@ -35,4 +35,4 @@ public:
~NewDatabaseWizardPageMetaData() override;
};
-#endif //KEEPASSXC_NEWDATABASEWIZARDPAGEMETADATA_H
+#endif // KEEPASSXC_NEWDATABASEWIZARDPAGEMETADATA_H
diff --git a/src/keys/ChallengeResponseKey.h b/src/keys/ChallengeResponseKey.h
index 2f7e7f4ca..8d1fa5774 100644
--- a/src/keys/ChallengeResponseKey.h
+++ b/src/keys/ChallengeResponseKey.h
@@ -1,20 +1,20 @@
/*
-* Copyright (C) 2014 Kyle Manna <kyle@kylemanna.com>
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 or (at your option)
-* version 3 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2014 Kyle Manna <kyle@kylemanna.com>
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef KEEPASSX_CHALLENGE_RESPONSE_KEY_H
#define KEEPASSX_CHALLENGE_RESPONSE_KEY_H
@@ -25,9 +25,14 @@
class ChallengeResponseKey
{
public:
- explicit ChallengeResponseKey(const QUuid& uuid) : m_uuid(uuid) {}
+ explicit ChallengeResponseKey(const QUuid& uuid)
+ : m_uuid(uuid)
+ {
+ }
Q_DISABLE_COPY(ChallengeResponseKey);
- virtual ~ChallengeResponseKey() {}
+ virtual ~ChallengeResponseKey()
+ {
+ }
virtual QByteArray rawKey() const = 0;
virtual bool challenge(const QByteArray& challenge) = 0;
virtual QUuid uuid() const
diff --git a/src/keys/CompositeKey.cpp b/src/keys/CompositeKey.cpp
index 10e86318b..3eb4691cd 100644
--- a/src/keys/CompositeKey.cpp
+++ b/src/keys/CompositeKey.cpp
@@ -1,20 +1,20 @@
/*
-* Copyright (C) 2018 KeePassXC Team <team@keepassxc.org>
-* Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 or (at your option)
-* version 3 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2018 KeePassXC Team <team@keepassxc.org>
+ * Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include "CompositeKey.h"
#include <QFile>
diff --git a/src/keys/CompositeKey.h b/src/keys/CompositeKey.h
index f32f3a1a1..c0c77f2f4 100644
--- a/src/keys/CompositeKey.h
+++ b/src/keys/CompositeKey.h
@@ -1,20 +1,20 @@
/*
-* Copyright (C) 2018 KeePassXC Team <team@keepassxc.org>
-* Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 or (at your option)
-* version 3 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2018 KeePassXC Team <team@keepassxc.org>
+ * Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef KEEPASSX_COMPOSITEKEY_H
#define KEEPASSX_COMPOSITEKEY_H
@@ -45,7 +45,7 @@ public:
void addKey(const QSharedPointer<Key>& key);
const QList<QSharedPointer<Key>>& keys() const;
- void addChallengeResponseKey(const QSharedPointer<ChallengeResponseKey>& key);\
+ void addChallengeResponseKey(const QSharedPointer<ChallengeResponseKey>& key);
const QList<QSharedPointer<ChallengeResponseKey>>& challengeResponseKeys() const;
private:
diff --git a/src/keys/FileKey.cpp b/src/keys/FileKey.cpp
index 6751b7877..9d1e8f50f 100644
--- a/src/keys/FileKey.cpp
+++ b/src/keys/FileKey.cpp
@@ -1,20 +1,20 @@
/*
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-* Copyright (C) 2011 Felix Geyer <debfx@fobos.de>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 or (at your option)
-* version 3 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ * Copyright (C) 2011 Felix Geyer <debfx@fobos.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include "FileKey.h"
diff --git a/src/keys/FileKey.h b/src/keys/FileKey.h
index 295fe5565..d7486467b 100644
--- a/src/keys/FileKey.h
+++ b/src/keys/FileKey.h
@@ -1,20 +1,20 @@
/*
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-* Copyright (C) 2011 Felix Geyer <debfx@fobos.de>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 or (at your option)
-* version 3 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ * Copyright (C) 2011 Felix Geyer <debfx@fobos.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef KEEPASSX_FILEKEY_H
#define KEEPASSX_FILEKEY_H
diff --git a/src/keys/Key.h b/src/keys/Key.h
index db7864ec3..985f383d2 100644
--- a/src/keys/Key.h
+++ b/src/keys/Key.h
@@ -1,20 +1,20 @@
/*
-* Copyright (C) 2018 KeePassXC Team <team@keepassxc.org>
-* Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 or (at your option)
-* version 3 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2018 KeePassXC Team <team@keepassxc.org>
+ * Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef KEEPASSX_KEY_H
#define KEEPASSX_KEY_H
@@ -25,7 +25,8 @@
class Key
{
public:
- explicit Key(const QUuid& uuid) : m_uuid(uuid) {};
+ explicit Key(const QUuid& uuid)
+ : m_uuid(uuid){};
Q_DISABLE_COPY(Key);
virtual ~Key() = default;
virtual QByteArray rawKey() const = 0;
diff --git a/src/keys/PasswordKey.cpp b/src/keys/PasswordKey.cpp
index 9fecc7637..35ecb9989 100644
--- a/src/keys/PasswordKey.cpp
+++ b/src/keys/PasswordKey.cpp
@@ -1,19 +1,19 @@
/*
-* Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 or (at your option)
-* version 3 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include "PasswordKey.h"
diff --git a/src/keys/PasswordKey.h b/src/keys/PasswordKey.h
index 46c47e6d3..68ab79895 100644
--- a/src/keys/PasswordKey.h
+++ b/src/keys/PasswordKey.h
@@ -1,25 +1,25 @@
/*
-* Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 or (at your option)
-* version 3 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef KEEPASSX_PASSWORDKEY_H
#define KEEPASSX_PASSWORDKEY_H
-#include <QString>
#include <QSharedPointer>
+#include <QString>
#include "keys/Key.h"
@@ -34,6 +34,7 @@ public:
void setPassword(const QString& password);
static QSharedPointer<PasswordKey> fromRawKey(const QByteArray& rawKey);
+
private:
QByteArray m_key;
};
diff --git a/src/keys/YkChallengeResponseKey.cpp b/src/keys/YkChallengeResponseKey.cpp
index 830e0c0e0..ee413aeac 100644
--- a/src/keys/YkChallengeResponseKey.cpp
+++ b/src/keys/YkChallengeResponseKey.cpp
@@ -1,20 +1,21 @@
/*
-* Copyright (C) 2014 Kyle Manna <kyle@kylemanna.com>
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 or (at your option)
-* version 3 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2014 Kyle Manna <kyle@kylemanna.com>
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
#include "keys/YkChallengeResponseKey.h"
#include "keys/drivers/YubiKey.h"
diff --git a/src/keys/YkChallengeResponseKey.h b/src/keys/YkChallengeResponseKey.h
index fccd90811..b8467e7a6 100644
--- a/src/keys/YkChallengeResponseKey.h
+++ b/src/keys/YkChallengeResponseKey.h
@@ -13,7 +13,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ */
#ifndef KEEPASSX_YK_CHALLENGERESPONSEKEY_H
#define KEEPASSX_YK_CHALLENGERESPONSEKEY_H
diff --git a/src/keys/drivers/YubiKey.cpp b/src/keys/drivers/YubiKey.cpp
index bd09fb9f6..6a9843b44 100644
--- a/src/keys/drivers/YubiKey.cpp
+++ b/src/keys/drivers/YubiKey.cpp
@@ -1,20 +1,20 @@
/*
-* Copyright (C) 2014 Kyle Manna <kyle@kylemanna.com>
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 or (at your option)
-* version 3 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2014 Kyle Manna <kyle@kylemanna.com>
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include <stdio.h>
diff --git a/src/keys/drivers/YubiKey.h b/src/keys/drivers/YubiKey.h
index 14cb43394..420e650b5 100644
--- a/src/keys/drivers/YubiKey.h
+++ b/src/keys/drivers/YubiKey.h
@@ -1,20 +1,20 @@
/*
-* Copyright (C) 2014 Kyle Manna <kyle@kylemanna.com>
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 or (at your option)
-* version 3 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2014 Kyle Manna <kyle@kylemanna.com>
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef KEEPASSX_YUBIKEY_H
#define KEEPASSX_YUBIKEY_H
diff --git a/src/keys/drivers/YubiKeyStub.cpp b/src/keys/drivers/YubiKeyStub.cpp
index 3cff04965..f0647ab8a 100644
--- a/src/keys/drivers/YubiKeyStub.cpp
+++ b/src/keys/drivers/YubiKeyStub.cpp
@@ -1,20 +1,20 @@
/*
-* Copyright (C) 2014 Kyle Manna <kyle@kylemanna.com>
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 or (at your option)
-* version 3 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2014 Kyle Manna <kyle@kylemanna.com>
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include <stdio.h>
diff --git a/src/main.cpp b/src/main.cpp
index c811fe62c..81192f977 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -16,19 +16,19 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <QCommandLineParser>
#include <QFile>
#include <QTextStream>
-#include <QCommandLineParser>
+#include "cli/Utils.h"
#include "config-keepassx.h"
#include "core/Bootstrap.h"
-#include "core/Tools.h"
#include "core/Config.h"
+#include "core/Tools.h"
#include "crypto/Crypto.h"
#include "gui/Application.h"
#include "gui/MainWindow.h"
#include "gui/MessageBox.h"
-#include "cli/Utils.h"
#if defined(WITH_ASAN) && defined(WITH_LSAN)
#include <sanitizer/lsan_interface.h>
@@ -58,19 +58,24 @@ int main(int argc, char** argv)
Bootstrap::bootstrapApplication();
QCommandLineParser parser;
- parser.setApplicationDescription(QCoreApplication::translate("main", "KeePassXC - cross-platform password manager"));
- parser.addPositionalArgument("filename",
- QCoreApplication::translate("main", "filenames of the password databases to open (*.kdbx)"), "[filename(s)]");
+ parser.setApplicationDescription(
+ QCoreApplication::translate("main", "KeePassXC - cross-platform password manager"));
+ parser.addPositionalArgument(
+ "filename",
+ QCoreApplication::translate("main", "filenames of the password databases to open (*.kdbx)"),
+ "[filename(s)]");
QCommandLineOption configOption(
"config", QCoreApplication::translate("main", "path to a custom config file"), "config");
QCommandLineOption keyfileOption(
"keyfile", QCoreApplication::translate("main", "key file of the database"), "keyfile");
QCommandLineOption pwstdinOption("pw-stdin",
- QCoreApplication::translate("main", "read password of the database from stdin"));
+ QCoreApplication::translate("main", "read password of the database from stdin"));
// This is needed under Windows where clients send --parent-window parameter with Native Messaging connect method
- QCommandLineOption parentWindowOption(
- QStringList() << "pw" << "parent-window", QCoreApplication::translate("main", "Parent window handle"), "handle");
+ QCommandLineOption parentWindowOption(QStringList() << "pw"
+ << "parent-window",
+ QCoreApplication::translate("main", "Parent window handle"),
+ "handle");
QCommandLineOption helpOption = parser.addHelpOption();
QCommandLineOption versionOption = parser.addVersionOption();
@@ -80,19 +85,21 @@ int main(int argc, char** argv)
parser.addOption(parentWindowOption);
parser.process(app);
-
+
// Don't try and do anything with the application if we're only showing the help / version
if (parser.isSet(versionOption) || parser.isSet(helpOption)) {
return 0;
}
-
+
const QStringList fileNames = parser.positionalArguments();
if (app.isAlreadyRunning()) {
if (!fileNames.isEmpty()) {
app.sendFileNamesToRunningInstance(fileNames);
}
- qWarning() << QCoreApplication::translate("Main", "Another instance of KeePassXC is already running.").toUtf8().constData();
+ qWarning() << QCoreApplication::translate("Main", "Another instance of KeePassXC is already running.")
+ .toUtf8()
+ .constData();
return 0;
}
diff --git a/src/proxy/NativeMessagingHost.cpp b/src/proxy/NativeMessagingHost.cpp
index 0f9d82eaa..60f5d79ed 100644
--- a/src/proxy/NativeMessagingHost.cpp
+++ b/src/proxy/NativeMessagingHost.cpp
@@ -1,19 +1,19 @@
/*
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include "NativeMessagingHost.h"
#include <QCoreApplication>
@@ -22,12 +22,13 @@
#include <Winsock2.h>
#endif
-NativeMessagingHost::NativeMessagingHost() : NativeMessagingBase(true)
+NativeMessagingHost::NativeMessagingHost()
+ : NativeMessagingBase(true)
{
m_localSocket = new QLocalSocket();
m_localSocket->connectToServer(getLocalServerPath());
m_localSocket->setReadBufferSize(NATIVE_MSG_MAX_LENGTH);
-
+
int socketDesc = m_localSocket->socketDescriptor();
if (socketDesc) {
int max = NATIVE_MSG_MAX_LENGTH;
@@ -101,7 +102,7 @@ bool NativeMessagingHost::readStdIn(const quint32 length)
m_localSocket->write(arr.constData(), arr.length());
m_localSocket->flush();
}
-
+
return true;
}
diff --git a/src/proxy/NativeMessagingHost.h b/src/proxy/NativeMessagingHost.h
index 67fd5e531..083e12d48 100644
--- a/src/proxy/NativeMessagingHost.h
+++ b/src/proxy/NativeMessagingHost.h
@@ -1,19 +1,19 @@
/*
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef NATIVEMESSAGINGHOST_H
#define NATIVEMESSAGINGHOST_H
diff --git a/src/proxy/keepassxc-proxy.cpp b/src/proxy/keepassxc-proxy.cpp
index d75f841c0..0d0fbfb23 100644
--- a/src/proxy/keepassxc-proxy.cpp
+++ b/src/proxy/keepassxc-proxy.cpp
@@ -1,20 +1,20 @@
/*
-* Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include "NativeMessagingHost.h"
#include <QCoreApplication>
diff --git a/src/sshagent/ASN1Key.cpp b/src/sshagent/ASN1Key.cpp
index dc6da2adc..7d71d81a1 100644
--- a/src/sshagent/ASN1Key.cpp
+++ b/src/sshagent/ASN1Key.cpp
@@ -112,7 +112,7 @@ namespace
return QByteArray::fromHex(QString(iqmp_hex).toLatin1());
}
-}
+} // namespace
bool ASN1Key::parseDSA(QByteArray& ba, OpenSSHKey& key)
{
diff --git a/src/sshagent/ASN1Key.h b/src/sshagent/ASN1Key.h
index 59f8d4e81..5e235fb0d 100644
--- a/src/sshagent/ASN1Key.h
+++ b/src/sshagent/ASN1Key.h
@@ -26,6 +26,6 @@ namespace ASN1Key
{
bool parseDSA(QByteArray& ba, OpenSSHKey& key);
bool parseRSA(QByteArray& ba, OpenSSHKey& key);
-}
+} // namespace ASN1Key
#endif // ASN1KEY_H
diff --git a/src/sshagent/AgentSettingsPage.h b/src/sshagent/AgentSettingsPage.h
index 09d898048..015dfb9ac 100644
--- a/src/sshagent/AgentSettingsPage.h
+++ b/src/sshagent/AgentSettingsPage.h
@@ -19,8 +19,8 @@
#ifndef AGENTSETTINGSPAGE_H
#define AGENTSETTINGSPAGE_H
-#include "gui/DatabaseTabWidget.h"
#include "gui/ApplicationSettingsWidget.h"
+#include "gui/DatabaseTabWidget.h"
class AgentSettingsPage : public ISettingsPage
{
diff --git a/src/sshagent/AgentSettingsWidget.cpp b/src/sshagent/AgentSettingsWidget.cpp
index 10a09f9da..6d69e4b61 100644
--- a/src/sshagent/AgentSettingsWidget.cpp
+++ b/src/sshagent/AgentSettingsWidget.cpp
@@ -17,9 +17,10 @@
*/
#include "AgentSettingsWidget.h"
-#include "core/Config.h"
#include "ui_AgentSettingsWidget.h"
+#include "core/Config.h"
+
AgentSettingsWidget::AgentSettingsWidget(QWidget* parent)
: QWidget(parent)
, m_ui(new Ui::AgentSettingsWidget())
diff --git a/src/sshagent/KeeAgentSettings.cpp b/src/sshagent/KeeAgentSettings.cpp
index ac6a381bf..8c2278005 100644
--- a/src/sshagent/KeeAgentSettings.cpp
+++ b/src/sshagent/KeeAgentSettings.cpp
@@ -34,6 +34,7 @@ KeeAgentSettings::KeeAgentSettings()
bool KeeAgentSettings::operator==(KeeAgentSettings& other)
{
+ // clang-format off
return (m_allowUseOfSshKey == other.m_allowUseOfSshKey && m_addAtDatabaseOpen == other.m_addAtDatabaseOpen
&& m_removeAtDatabaseClose == other.m_removeAtDatabaseClose
&& m_useConfirmConstraintWhenAdding == other.m_useConfirmConstraintWhenAdding
@@ -43,6 +44,7 @@ bool KeeAgentSettings::operator==(KeeAgentSettings& other)
&& m_attachmentName == other.m_attachmentName
&& m_saveAttachmentToTempFile == other.m_saveAttachmentToTempFile
&& m_fileName == other.m_fileName);
+ // clang-format on
}
bool KeeAgentSettings::operator!=(KeeAgentSettings& other)
diff --git a/src/sshagent/OpenSSHKey.cpp b/src/sshagent/OpenSSHKey.cpp
index 9d1301a05..8abbee367 100644
--- a/src/sshagent/OpenSSHKey.cpp
+++ b/src/sshagent/OpenSSHKey.cpp
@@ -390,7 +390,7 @@ bool OpenSSHKey::openPrivateKey(const QString& passphrase)
hash.addData(m_cipherIV.data(), 8);
mdBuf = hash.result();
keyData.append(mdBuf);
- } while(keyData.size() < cipher->keySize());
+ } while (keyData.size() < cipher->keySize());
if (keyData.size() > cipher->keySize()) {
// If our key size isn't a multiple of 16 (e.g. AES-192 or something),
diff --git a/src/streams/HashedBlockStream.cpp b/src/streams/HashedBlockStream.cpp
index 753bdecc6..879960223 100644
--- a/src/streams/HashedBlockStream.cpp
+++ b/src/streams/HashedBlockStream.cpp
@@ -1,19 +1,19 @@
/*
-* Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 or (at your option)
-* version 3 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include "HashedBlockStream.h"
diff --git a/src/streams/HashedBlockStream.h b/src/streams/HashedBlockStream.h
index 60a15a8c9..e107c2cce 100644
--- a/src/streams/HashedBlockStream.h
+++ b/src/streams/HashedBlockStream.h
@@ -1,19 +1,19 @@
/*
-* Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 or (at your option)
-* version 3 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef KEEPASSX_HASHEDBLOCKSTREAM_H
#define KEEPASSX_HASHEDBLOCKSTREAM_H
diff --git a/src/streams/HmacBlockStream.cpp b/src/streams/HmacBlockStream.cpp
index 30c7bac5e..ccfefcba7 100644
--- a/src/streams/HmacBlockStream.cpp
+++ b/src/streams/HmacBlockStream.cpp
@@ -1,19 +1,19 @@
/*
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 or (at your option)
-* version 3 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include "HmacBlockStream.h"
diff --git a/src/streams/HmacBlockStream.h b/src/streams/HmacBlockStream.h
index a2ad062e3..18f5e5301 100644
--- a/src/streams/HmacBlockStream.h
+++ b/src/streams/HmacBlockStream.h
@@ -1,19 +1,19 @@
/*
-* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 or (at your option)
-* version 3 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef KEEPASSX_HMACBLOCKSTREAM_H
#define KEEPASSX_HMACBLOCKSTREAM_H
diff --git a/src/streams/LayeredStream.cpp b/src/streams/LayeredStream.cpp
index 9b1545850..af62dae95 100644
--- a/src/streams/LayeredStream.cpp
+++ b/src/streams/LayeredStream.cpp
@@ -1,19 +1,19 @@
/*
-* Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 or (at your option)
-* version 3 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include "LayeredStream.h"
diff --git a/src/streams/LayeredStream.h b/src/streams/LayeredStream.h
index 4ca7aba9a..0e1156d70 100644
--- a/src/streams/LayeredStream.h
+++ b/src/streams/LayeredStream.h
@@ -1,19 +1,19 @@
/*
-* Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 or (at your option)
-* version 3 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2010 Felix Geyer <debfx@fobos.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef KEEPASSX_LAYEREDSTREAM_H
#define KEEPASSX_LAYEREDSTREAM_H
diff --git a/src/streams/StoreDataStream.cpp b/src/streams/StoreDataStream.cpp
index 18d7db980..428592e50 100644
--- a/src/streams/StoreDataStream.cpp
+++ b/src/streams/StoreDataStream.cpp
@@ -1,19 +1,19 @@
/*
-* Copyright (C) 2012 Felix Geyer <debfx@fobos.de>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 or (at your option)
-* version 3 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2012 Felix Geyer <debfx@fobos.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#include "StoreDataStream.h"
diff --git a/src/streams/StoreDataStream.h b/src/streams/StoreDataStream.h
index 9f39d6a7c..e08f46c61 100644
--- a/src/streams/StoreDataStream.h
+++ b/src/streams/StoreDataStream.h
@@ -1,19 +1,19 @@
/*
-* Copyright (C) 2012 Felix Geyer <debfx@fobos.de>
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 2 or (at your option)
-* version 3 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2012 Felix Geyer <debfx@fobos.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 or (at your option)
+ * version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
#ifndef KEEPASSX_STOREDATASTREAM_H
#define KEEPASSX_STOREDATASTREAM_H
diff --git a/src/totp/totp.cpp b/src/totp/totp.cpp
index f1146441a..fef8e0b7e 100644
--- a/src/totp/totp.cpp
+++ b/src/totp/totp.cpp
@@ -30,7 +30,7 @@
#include <QtEndian>
#include <cmath>
-static QList<Totp::Encoder> encoders {
+static QList<Totp::Encoder> encoders{
{"", "", "0123456789", Totp::DEFAULT_DIGITS, Totp::DEFAULT_STEP, false},
{"steam", Totp::STEAM_SHORTNAME, "23456789BCDFGHJKMNPQRTVWXY", Totp::STEAM_DIGITS, Totp::DEFAULT_STEP, true},
};
@@ -88,16 +88,18 @@ QSharedPointer<Totp::Settings> Totp::parseSettings(const QString& rawSettings, c
return settings;
}
-QSharedPointer<Totp::Settings> Totp::createSettings(const QString& key, const uint digits, const uint step,
- const QString& encoderShortName)
+QSharedPointer<Totp::Settings>
+Totp::createSettings(const QString& key, const uint digits, const uint step, const QString& encoderShortName)
{
bool isCustom = digits != DEFAULT_DIGITS || step != DEFAULT_STEP;
- return QSharedPointer<Totp::Settings>(new Totp::Settings {
- getEncoderByShortName(encoderShortName), key, false, isCustom, digits, step
- });
+ return QSharedPointer<Totp::Settings>(
+ new Totp::Settings{getEncoderByShortName(encoderShortName), key, false, isCustom, digits, step});
}
-QString Totp::writeSettings(const QSharedPointer<Totp::Settings>& settings, const QString& title, const QString& username, bool forceOtp)
+QString Totp::writeSettings(const QSharedPointer<Totp::Settings>& settings,
+ const QString& title,
+ const QString& username,
+ bool forceOtp)
{
if (settings.isNull()) {
return {};
@@ -106,11 +108,11 @@ QString Totp::writeSettings(const QSharedPointer<Totp::Settings>& settings, cons
// OTP Url output
if (settings->otpUrl || forceOtp) {
auto urlstring = QString("otpauth://totp/%1:%2?secret=%3&period=%4&digits=%5&issuer=%1")
- .arg(title.isEmpty() ? "KeePassXC" : QString(QUrl::toPercentEncoding(title)),
- username.isEmpty() ? "none" : QString(QUrl::toPercentEncoding(username)),
- QString(Base32::sanitizeInput(settings->key.toLatin1())))
- .arg(settings->step)
- .arg(settings->digits);
+ .arg(title.isEmpty() ? "KeePassXC" : QString(QUrl::toPercentEncoding(title)),
+ username.isEmpty() ? "none" : QString(QUrl::toPercentEncoding(username)),
+ QString(Base32::sanitizeInput(settings->key.toLatin1())))
+ .arg(settings->step)
+ .arg(settings->digits);
if (!settings->encoder.name.isEmpty()) {
urlstring.append("&encoder=").append(settings->encoder.name);
diff --git a/src/totp/totp.h b/src/totp/totp.h
index 0697281bf..9c90ec5a9 100644
--- a/src/totp/totp.h
+++ b/src/totp/totp.h
@@ -21,54 +21,57 @@
#include <QMap>
#include <QString>
-#include <QtCore/qglobal.h>
#include <QtCore/QSharedPointer>
+#include <QtCore/qglobal.h>
class QUrl;
-namespace Totp {
-
-struct Encoder
+namespace Totp
{
- QString name;
- QString shortName;
- QString alphabet;
- uint digits;
- uint step;
- bool reverse;
-};
-struct Settings
-{
- Totp::Encoder encoder;
- QString key;
- bool otpUrl;
- bool custom;
- uint digits;
- uint step;
-};
+ struct Encoder
+ {
+ QString name;
+ QString shortName;
+ QString alphabet;
+ uint digits;
+ uint step;
+ bool reverse;
+ };
+
+ struct Settings
+ {
+ Totp::Encoder encoder;
+ QString key;
+ bool otpUrl;
+ bool custom;
+ uint digits;
+ uint step;
+ };
-constexpr uint DEFAULT_STEP = 30u;
-constexpr uint DEFAULT_DIGITS = 6u;
-constexpr uint STEAM_DIGITS = 5u;
-static const QString STEAM_SHORTNAME = "S";
+ constexpr uint DEFAULT_STEP = 30u;
+ constexpr uint DEFAULT_DIGITS = 6u;
+ constexpr uint STEAM_DIGITS = 5u;
+ static const QString STEAM_SHORTNAME = "S";
-static const QString ATTRIBUTE_OTP = "otp";
-static const QString ATTRIBUTE_SEED = "TOTP Seed";
-static const QString ATTRIBUTE_SETTINGS = "TOTP Settings";
+ static const QString ATTRIBUTE_OTP = "otp";
+ static const QString ATTRIBUTE_SEED = "TOTP Seed";
+ static const QString ATTRIBUTE_SETTINGS = "TOTP Settings";
-QSharedPointer<Totp::Settings> parseSettings(const QString& rawSettings, const QString& key = {});
-QSharedPointer<Totp::Settings> createSettings(const QString& key, const uint digits, const uint step,
- const QString& encoderShortName = {});
-QString writeSettings(const QSharedPointer<Totp::Settings>& settings, const QString& title = {},
- const QString& username = {}, bool forceOtp = false);
+ QSharedPointer<Totp::Settings> parseSettings(const QString& rawSettings, const QString& key = {});
+ QSharedPointer<Totp::Settings>
+ createSettings(const QString& key, const uint digits, const uint step, const QString& encoderShortName = {});
+ QString writeSettings(const QSharedPointer<Totp::Settings>& settings,
+ const QString& title = {},
+ const QString& username = {},
+ bool forceOtp = false);
-QString generateTotp(const QSharedPointer<Totp::Settings>& settings, const quint64 time = 0ull);
+ QString generateTotp(const QSharedPointer<Totp::Settings>& settings, const quint64 time = 0ull);
-Encoder& defaultEncoder();
-Encoder& steamEncoder();
-Encoder& getEncoderByShortName(const QString& shortName);
-Encoder& getEncoderByName(const QString& name);
-}
+ Encoder& defaultEncoder();
+ Encoder& steamEncoder();
+ Encoder& getEncoderByShortName(const QString& shortName);
+ Encoder& getEncoderByName(const QString& name);
+} // namespace Totp
#endif // QTOTP_H
diff --git a/src/touchid/TouchID.h b/src/touchid/TouchID.h
index 115943a27..d37522054 100644
--- a/src/touchid/TouchID.h
+++ b/src/touchid/TouchID.h
@@ -5,10 +5,10 @@
#define TOUCHID_AVAILABLE 1
#define TOUCHID_NOT_AVAILABLE 0
-#include <QHash>
-#include <QString>
#include <QByteArray>
+#include <QHash>
#include <QSharedPointer>
+#include <QString>
class TouchID
{
@@ -16,7 +16,9 @@ public:
static TouchID& getInstance();
private:
- TouchID() {}
+ TouchID()
+ {
+ }
// TouchID(TouchID const&); // Don't Implement
// void operator=(TouchID const&); // Don't implement
diff --git a/tests/TestCli.cpp b/tests/TestCli.cpp
index d25201e2e..435c2f6e2 100644
--- a/tests/TestCli.cpp
+++ b/tests/TestCli.cpp
@@ -16,24 +16,24 @@
*/
#include "TestCli.h"
+
#include "config-keepassx-tests.h"
-#include "core/Global.h"
-#include "core/Config.h"
#include "core/Bootstrap.h"
-#include "core/Tools.h"
+#include "core/Config.h"
+#include "core/Global.h"
#include "core/PasswordGenerator.h"
+#include "core/Tools.h"
#include "crypto/Crypto.h"
-#include "format/KeePass2.h"
#include "format/Kdbx3Reader.h"
+#include "format/Kdbx3Writer.h"
#include "format/Kdbx4Reader.h"
#include "format/Kdbx4Writer.h"
-#include "format/Kdbx3Writer.h"
#include "format/KdbxXmlReader.h"
+#include "format/KeePass2.h"
-#include "cli/Command.h"
-#include "cli/Utils.h"
#include "cli/Add.h"
#include "cli/Clip.h"
+#include "cli/Command.h"
#include "cli/Diceware.h"
#include "cli/Edit.h"
#include "cli/Estimate.h"
@@ -44,12 +44,13 @@
#include "cli/Merge.h"
#include "cli/Remove.h"
#include "cli/Show.h"
+#include "cli/Utils.h"
-#include <QFile>
#include <QClipboard>
+#include <QFile>
#include <QFuture>
-#include <QtConcurrent>
#include <QSet>
+#include <QtConcurrent>
#include <cstdio>
@@ -130,7 +131,7 @@ QSharedPointer<Database> TestCli::readTestDatabase() const
{
Utils::Test::setNextPassword("a");
auto db = QSharedPointer<Database>(Database::unlockFromStdin(m_dbFile->fileName(), "", m_stdoutHandle));
- m_stdoutFile->seek(ftell(m_stdoutHandle)); // re-synchronize handles
+ m_stdoutFile->seek(ftell(m_stdoutHandle)); // re-synchronize handles
return db;
}
@@ -159,7 +160,16 @@ void TestCli::testAdd()
QVERIFY(addCmd.getDescriptionLine().contains(addCmd.name));
Utils::Test::setNextPassword("a");
- addCmd.execute({"add", "-u", "newuser", "--url", "https://example.com/", "-g", "-l", "20", m_dbFile->fileName(), "/newuser-entry"});
+ addCmd.execute({"add",
+ "-u",
+ "newuser",
+ "--url",
+ "https://example.com/",
+ "-g",
+ "-l",
+ "20",
+ m_dbFile->fileName(),
+ "/newuser-entry"});
m_stderrFile->reset();
m_stdoutFile->reset();
m_stdoutFile->readLine(); // skip password prompt
@@ -184,7 +194,17 @@ void TestCli::testAdd()
Utils::Test::setNextPassword("a");
Utils::Test::setNextPassword("newpassword");
- addCmd.execute({"add", "-u", "newuser2", "--url", "https://example.net/", "-g", "-l", "20", "-p", m_dbFile->fileName(), "/newuser-entry2"});
+ addCmd.execute({"add",
+ "-u",
+ "newuser2",
+ "--url",
+ "https://example.net/",
+ "-g",
+ "-l",
+ "20",
+ "-p",
+ m_dbFile->fileName(),
+ "/newuser-entry2"});
db = readTestDatabase();
entry = db->rootGroup()->findEntryByPath("/newuser-entry2");
@@ -251,8 +271,10 @@ void TestCli::testClip()
// Password with timeout
Utils::Test::setNextPassword("a");
+ // clang-format off
QFuture<void> future = QtConcurrent::run(&clipCmd, &Clip::execute, QStringList{"clip", m_dbFile->fileName(), "/Sample Entry", "1"});
-
+ // clang-format on
+
QTRY_COMPARE_WITH_TIMEOUT(clipboard->text(), QString("Password"), 500);
QTRY_COMPARE_WITH_TIMEOUT(clipboard->text(), QString(""), 1500);
@@ -322,7 +344,9 @@ void TestCli::testEdit()
QVERIFY(editCmd.getDescriptionLine().contains(editCmd.name));
Utils::Test::setNextPassword("a");
+ // clang-format off
editCmd.execute({"edit", "-u", "newuser", "--url", "https://otherurl.example.com/", "-t", "newtitle", m_dbFile->fileName(), "/Sample Entry"});
+ // clang-format on
m_stdoutFile->reset();
m_stdoutFile->readLine(); // skip prompt line
QCOMPARE(m_stdoutFile->readLine(), QByteArray("Successfully edited entry newtitle.\n"));
@@ -378,54 +402,74 @@ void TestCli::testEstimate_data()
QTest::addColumn<QString>("log10");
QTest::addColumn<QStringList>("searchStrings");
- QTest::newRow("Dictionary")
- << "password" << "8" << "1.0" << "0.3"
- << QStringList{"Type: Dictionary", "\tpassword"};
+ QTest::newRow("Dictionary") << "password"
+ << "8"
+ << "1.0"
+ << "0.3" << QStringList{"Type: Dictionary", "\tpassword"};
- QTest::newRow("Spatial")
- << "zxcv" << "4" << "10.3" << "3.1"
- << QStringList{"Type: Spatial", "\tzxcv"};
+ QTest::newRow("Spatial") << "zxcv"
+ << "4"
+ << "10.3"
+ << "3.1" << QStringList{"Type: Spatial", "\tzxcv"};
- QTest::newRow("Spatial(Rep)")
- << "sdfgsdfg" << "8" << "11.3" << "3.4"
- << QStringList{"Type: Spatial(Rep)", "\tsdfgsdfg"};
+ QTest::newRow("Spatial(Rep)") << "sdfgsdfg"
+ << "8"
+ << "11.3"
+ << "3.4" << QStringList{"Type: Spatial(Rep)", "\tsdfgsdfg"};
QTest::newRow("Dictionary / Sequence")
- << "password123" << "11" << "4.5" << "1.3"
- << QStringList{"Type: Dictionary", "Type: Sequence", "\tpassword", "\t123"};
+ << "password123"
+ << "11"
+ << "4.5"
+ << "1.3" << QStringList{"Type: Dictionary", "Type: Sequence", "\tpassword", "\t123"};
- QTest::newRow("Dict+Leet")
- << "p455w0rd" << "8" << "2.5" << "0.7"
- << QStringList{"Type: Dict+Leet", "\tp455w0rd"};
+ QTest::newRow("Dict+Leet") << "p455w0rd"
+ << "8"
+ << "2.5"
+ << "0.7" << QStringList{"Type: Dict+Leet", "\tp455w0rd"};
- QTest::newRow("Dictionary(Rep)")
- << "hellohello" << "10" << "7.3" << "2.2"
- << QStringList{"Type: Dictionary(Rep)", "\thellohello"};
+ QTest::newRow("Dictionary(Rep)") << "hellohello"
+ << "10"
+ << "7.3"
+ << "2.2" << QStringList{"Type: Dictionary(Rep)", "\thellohello"};
QTest::newRow("Sequence(Rep) / Dictionary")
- << "456456foobar" << "12" << "16.7" << "5.0"
- << QStringList{"Type: Sequence(Rep)", "Type: Dictionary", "\t456456", "\tfoobar"};
+ << "456456foobar"
+ << "12"
+ << "16.7"
+ << "5.0" << QStringList{"Type: Sequence(Rep)", "Type: Dictionary", "\t456456", "\tfoobar"};
QTest::newRow("Bruteforce(Rep) / Bruteforce")
- << "xzxzy" << "5" << "16.1" << "4.8"
- << QStringList{"Type: Bruteforce(Rep)", "Type: Bruteforce", "\txzxz", "\ty"};
+ << "xzxzy"
+ << "5"
+ << "16.1"
+ << "4.8" << QStringList{"Type: Bruteforce(Rep)", "Type: Bruteforce", "\txzxz", "\ty"};
QTest::newRow("Dictionary / Date(Rep)")
- << "pass20182018" << "12" << "15.1" << "4.56"
- << QStringList{"Type: Dictionary", "Type: Date(Rep)", "\tpass", "\t20182018"};
+ << "pass20182018"
+ << "12"
+ << "15.1"
+ << "4.56" << QStringList{"Type: Dictionary", "Type: Date(Rep)", "\tpass", "\t20182018"};
QTest::newRow("Dictionary / Date / Bruteforce")
- << "mypass2018-2" << "12" << "32.9" << "9.9"
- << QStringList{"Type: Dictionary", "Type: Date", "Type: Bruteforce", "\tmypass", "\t2018", "\t-2"};
+ << "mypass2018-2"
+ << "12"
+ << "32.9"
+ << "9.9" << QStringList{"Type: Dictionary", "Type: Date", "Type: Bruteforce", "\tmypass", "\t2018", "\t-2"};
- QTest::newRow("Strong Password")
- << "E*!%.Qw{t.X,&bafw)\"Q!ah$%;U/" << "28" << "165.7" << "49.8"
- << QStringList{"Type: Bruteforce", "\tE*"};
+ QTest::newRow("Strong Password") << "E*!%.Qw{t.X,&bafw)\"Q!ah$%;U/"
+ << "28"
+ << "165.7"
+ << "49.8" << QStringList{"Type: Bruteforce", "\tE*"};
// TODO: detect passphrases and adjust entropy calculation accordingly (issue #2347)
QTest::newRow("Strong Passphrase")
- << "squint wooing resupply dangle isolation axis headsman" << "53" << "151.2" << "45.5"
- << QStringList{"Type: Dictionary", "Type: Bruteforce", "Multi-word extra bits 22.0", "\tsquint", "\t ", "\twooing"};
+ << "squint wooing resupply dangle isolation axis headsman"
+ << "53"
+ << "151.2"
+ << "45.5"
+ << QStringList{
+ "Type: Dictionary", "Type: Bruteforce", "Multi-word extra bits 22.0", "\tsquint", "\t ", "\twooing"};
}
void TestCli::testEstimate()
@@ -514,31 +558,23 @@ void TestCli::testGenerate_data()
QTest::newRow("length") << QStringList{"generate", "-L", "13"} << "^.{13}$";
QTest::newRow("lowercase") << QStringList{"generate", "-L", "14", "-l"} << "^[a-z]{14}$";
QTest::newRow("uppercase") << QStringList{"generate", "-L", "15", "-u"} << "^[A-Z]{15}$";
- QTest::newRow("numbers")<< QStringList{"generate", "-L", "16", "-n"} << "^[0-9]{16}$";
- QTest::newRow("special")
- << QStringList{"generate", "-L", "200", "-s"}
- << R"(^[\(\)\[\]\{\}\.\-*|\\,:;"'\/\_!+-<=>?#$%&^`@~]{200}$)";
- QTest::newRow("special (exclude)")
- << QStringList{"generate", "-L", "200", "-s" , "-x", "+.?@&"}
- << R"(^[\(\)\[\]\{\}\.\-*|\\,:;"'\/\_!-<=>#$%^`~]{200}$)";
- QTest::newRow("extended")
- << QStringList{"generate", "-L", "50", "-e"}
- << R"(^[^a-zA-Z0-9\(\)\[\]\{\}\.\-\*\|\\,:;"'\/\_!+-<=>?#$%&^`@~]{50}$)";
+ QTest::newRow("numbers") << QStringList{"generate", "-L", "16", "-n"} << "^[0-9]{16}$";
+ QTest::newRow("special") << QStringList{"generate", "-L", "200", "-s"}
+ << R"(^[\(\)\[\]\{\}\.\-*|\\,:;"'\/\_!+-<=>?#$%&^`@~]{200}$)";
+ QTest::newRow("special (exclude)") << QStringList{"generate", "-L", "200", "-s", "-x", "+.?@&"}
+ << R"(^[\(\)\[\]\{\}\.\-*|\\,:;"'\/\_!-<=>#$%^`~]{200}$)";
+ QTest::newRow("extended") << QStringList{"generate", "-L", "50", "-e"}
+ << R"(^[^a-zA-Z0-9\(\)\[\]\{\}\.\-\*\|\\,:;"'\/\_!+-<=>?#$%&^`@~]{50}$)";
QTest::newRow("numbers + lowercase + uppercase")
- << QStringList{"generate", "-L", "16", "-n", "-u", "-l"}
- << "^[0-9a-zA-Z]{16}$";
+ << QStringList{"generate", "-L", "16", "-n", "-u", "-l"} << "^[0-9a-zA-Z]{16}$";
QTest::newRow("numbers + lowercase + uppercase (exclude)")
- << QStringList{"generate", "-L", "500", "-n", "-u", "-l", "-x", "abcdefg0123@"}
- << "^[^abcdefg0123@]{500}$";
+ << QStringList{"generate", "-L", "500", "-n", "-u", "-l", "-x", "abcdefg0123@"} << "^[^abcdefg0123@]{500}$";
QTest::newRow("numbers + lowercase + uppercase (exclude similar)")
- << QStringList{"generate", "-L", "200", "-n", "-u", "-l", "--exclude-similar"}
- << "^[^l1IO0]{200}$";
+ << QStringList{"generate", "-L", "200", "-n", "-u", "-l", "--exclude-similar"} << "^[^l1IO0]{200}$";
QTest::newRow("uppercase + lowercase (every)")
- << QStringList{"generate", "-L", "2", "-u", "-l", "--every-group"}
- << "^[a-z][A-Z]|[A-Z][a-z]$";
+ << QStringList{"generate", "-L", "2", "-u", "-l", "--every-group"} << "^[a-z][A-Z]|[A-Z][a-z]$";
QTest::newRow("numbers + lowercase (every)")
- << QStringList{"generate", "-L", "2", "-n", "-l", "--every-group"}
- << "^[a-z][0-9]|[0-9][a-z]$";
+ << QStringList{"generate", "-L", "2", "-n", "-l", "--every-group"} << "^[a-z][0-9]|[0-9][a-z]$";
}
void TestCli::testGenerate()
@@ -559,7 +595,8 @@ void TestCli::testGenerate()
QRegularExpression regex(pattern);
QString password = stream.readLine();
pos = stream.pos();
- QVERIFY2(regex.match(password).hasMatch(), qPrintable("Password " + password + " does not match pattern " + pattern));
+ QVERIFY2(regex.match(password).hasMatch(),
+ qPrintable("Password " + password + " does not match pattern " + pattern));
}
}
@@ -572,14 +609,15 @@ void TestCli::testList()
Utils::Test::setNextPassword("a");
listCmd.execute({"ls", m_dbFile->fileName()});
m_stdoutFile->reset();
- m_stdoutFile->readLine(); // skip password prompt
- QCOMPARE(m_stdoutFile->readAll(), QByteArray("Sample Entry\n"
- "General/\n"
- "Windows/\n"
- "Network/\n"
- "Internet/\n"
- "eMail/\n"
- "Homebanking/\n"));
+ m_stdoutFile->readLine(); // skip password prompt
+ QCOMPARE(m_stdoutFile->readAll(),
+ QByteArray("Sample Entry\n"
+ "General/\n"
+ "Windows/\n"
+ "Network/\n"
+ "Internet/\n"
+ "eMail/\n"
+ "Homebanking/\n"));
// Quiet option
qint64 pos = m_stdoutFile->pos();
@@ -599,20 +637,21 @@ void TestCli::testList()
Utils::Test::setNextPassword("a");
listCmd.execute({"ls", "-R", m_dbFile->fileName()});
m_stdoutFile->seek(pos);
- m_stdoutFile->readLine(); // skip password prompt
- QCOMPARE(m_stdoutFile->readAll(), QByteArray("Sample Entry\n"
- "General/\n"
- " [empty]\n"
- "Windows/\n"
- " [empty]\n"
- "Network/\n"
- " [empty]\n"
- "Internet/\n"
- " [empty]\n"
- "eMail/\n"
- " [empty]\n"
- "Homebanking/\n"
- " [empty]\n"));
+ m_stdoutFile->readLine(); // skip password prompt
+ QCOMPARE(m_stdoutFile->readAll(),
+ QByteArray("Sample Entry\n"
+ "General/\n"
+ " [empty]\n"
+ "Windows/\n"
+ " [empty]\n"
+ "Network/\n"
+ " [empty]\n"
+ "Internet/\n"
+ " [empty]\n"
+ "eMail/\n"
+ " [empty]\n"
+ "Homebanking/\n"
+ " [empty]\n"));
pos = m_stdoutFile->pos();
Utils::Test::setNextPassword("a");
@@ -625,7 +664,7 @@ void TestCli::testList()
Utils::Test::setNextPassword("a");
listCmd.execute({"ls", m_dbFile->fileName(), "/DoesNotExist/"});
m_stdoutFile->seek(pos);
- m_stdoutFile->readLine(); // skip password prompt
+ m_stdoutFile->readLine(); // skip password prompt
m_stderrFile->reset();
QCOMPARE(m_stdoutFile->readAll(), QByteArray(""));
QCOMPARE(m_stderrFile->readAll(), QByteArray("Cannot find group /DoesNotExist/.\n"));
@@ -640,7 +679,7 @@ void TestCli::testLocate()
Utils::Test::setNextPassword("a");
locateCmd.execute({"locate", m_dbFile->fileName(), "Sample"});
m_stdoutFile->reset();
- m_stdoutFile->readLine(); // skip password prompt
+ m_stdoutFile->readLine(); // skip password prompt
QCOMPARE(m_stdoutFile->readAll(), QByteArray("/Sample Entry\n"));
// Quiet option
@@ -654,7 +693,7 @@ void TestCli::testLocate()
Utils::Test::setNextPassword("a");
locateCmd.execute({"locate", m_dbFile->fileName(), "Does Not Exist"});
m_stdoutFile->seek(pos);
- m_stdoutFile->readLine(); // skip password prompt
+ m_stdoutFile->readLine(); // skip password prompt
m_stderrFile->reset();
QCOMPARE(m_stdoutFile->readAll(), QByteArray(""));
QCOMPARE(m_stderrFile->readAll(), QByteArray("No results for that search term.\n"));
@@ -678,14 +717,14 @@ void TestCli::testLocate()
Utils::Test::setNextPassword("a");
locateCmd.execute({"locate", tmpFile.fileName(), "New"});
m_stdoutFile->seek(pos);
- m_stdoutFile->readLine(); // skip password prompt
+ m_stdoutFile->readLine(); // skip password prompt
QCOMPARE(m_stdoutFile->readAll(), QByteArray("/General/New Entry\n"));
pos = m_stdoutFile->pos();
Utils::Test::setNextPassword("a");
locateCmd.execute({"locate", tmpFile.fileName(), "Entry"});
m_stdoutFile->seek(pos);
- m_stdoutFile->readLine(); // skip password prompt
+ m_stdoutFile->readLine(); // skip password prompt
QCOMPARE(m_stdoutFile->readAll(), QByteArray("/Sample Entry\n/General/New Entry\n"));
}
@@ -811,7 +850,7 @@ void TestCli::testRemove()
Utils::Test::setNextPassword("a");
removeCmd.execute({"rm", m_dbFile->fileName(), "/Sample Entry"});
m_stdoutFile->seek(pos);
- m_stdoutFile->readLine(); // skip password prompt
+ m_stdoutFile->readLine(); // skip password prompt
QCOMPARE(m_stdoutFile->readAll(), QByteArray("Successfully recycled entry Sample Entry.\n"));
auto key = QSharedPointer<CompositeKey>::create();
@@ -831,7 +870,7 @@ void TestCli::testRemove()
Utils::Test::setNextPassword("a");
removeCmd.execute({"rm", fileCopy.fileName(), "/Sample Entry"});
m_stdoutFile->seek(pos);
- m_stdoutFile->readLine(); // skip password prompt
+ m_stdoutFile->readLine(); // skip password prompt
QCOMPARE(m_stdoutFile->readAll(), QByteArray("Successfully deleted entry Sample Entry.\n"));
readBack.setFileName(fileCopy.fileName());
@@ -849,7 +888,7 @@ void TestCli::testRemove()
Utils::Test::setNextPassword("a");
removeCmd.execute({"rm", fileCopy.fileName(), "/Sample Entry"});
m_stdoutFile->seek(pos);
- m_stdoutFile->readLine(); // skip password prompt
+ m_stdoutFile->readLine(); // skip password prompt
m_stderrFile->reset();
QCOMPARE(m_stdoutFile->readAll(), QByteArray(""));
QCOMPARE(m_stderrFile->readAll(), QByteArray("Entry /Sample Entry not found.\n"));
@@ -910,12 +949,13 @@ void TestCli::testShow()
Utils::Test::setNextPassword("a");
showCmd.execute({"show", m_dbFile->fileName(), "/Sample Entry"});
m_stdoutFile->reset();
- m_stdoutFile->readLine(); // skip password prompt
- QCOMPARE(m_stdoutFile->readAll(), QByteArray("Title: Sample Entry\n"
- "UserName: User Name\n"
- "Password: Password\n"
- "URL: http://www.somesite.com/\n"
- "Notes: Notes\n"));
+ m_stdoutFile->readLine(); // skip password prompt
+ QCOMPARE(m_stdoutFile->readAll(),
+ QByteArray("Title: Sample Entry\n"
+ "UserName: User Name\n"
+ "Password: Password\n"
+ "URL: http://www.somesite.com/\n"
+ "Notes: Notes\n"));
qint64 pos = m_stdoutFile->pos();
Utils::Test::setNextPassword("a");
@@ -931,22 +971,23 @@ void TestCli::testShow()
Utils::Test::setNextPassword("a");
showCmd.execute({"show", "-a", "Title", m_dbFile->fileName(), "/Sample Entry"});
m_stdoutFile->seek(pos);
- m_stdoutFile->readLine(); // skip password prompt
+ m_stdoutFile->readLine(); // skip password prompt
QCOMPARE(m_stdoutFile->readAll(), QByteArray("Sample Entry\n"));
pos = m_stdoutFile->pos();
Utils::Test::setNextPassword("a");
showCmd.execute({"show", "-a", "Title", "-a", "URL", m_dbFile->fileName(), "/Sample Entry"});
m_stdoutFile->seek(pos);
- m_stdoutFile->readLine(); // skip password prompt
- QCOMPARE(m_stdoutFile->readAll(), QByteArray("Sample Entry\n"
- "http://www.somesite.com/\n"));
+ m_stdoutFile->readLine(); // skip password prompt
+ QCOMPARE(m_stdoutFile->readAll(),
+ QByteArray("Sample Entry\n"
+ "http://www.somesite.com/\n"));
pos = m_stdoutFile->pos();
Utils::Test::setNextPassword("a");
showCmd.execute({"show", "-a", "DoesNotExist", m_dbFile->fileName(), "/Sample Entry"});
m_stdoutFile->seek(pos);
- m_stdoutFile->readLine(); // skip password prompt
+ m_stdoutFile->readLine(); // skip password prompt
m_stderrFile->reset();
QCOMPARE(m_stdoutFile->readAll(), QByteArray(""));
QCOMPARE(m_stderrFile->readAll(), QByteArray("ERROR: unknown attribute DoesNotExist.\n"));
diff --git a/tests/TestCli.h b/tests/TestCli.h
index 061055dcd..63cd1f55e 100644
--- a/tests/TestCli.h
+++ b/tests/TestCli.h
@@ -21,11 +21,11 @@
#include "core/Database.h"
#include "util/TemporaryFile.h"
-#include <QTest>
-#include <QTextStream>
#include <QFile>
#include <QScopedPointer>
#include <QTemporaryFile>
+#include <QTest>
+#include <QTextStream>
class TestCli : public QObject
{
@@ -70,4 +70,4 @@ private:
FILE* m_stdinHandle = stdin;
};
-#endif //KEEPASSXC_TESTCLI_H
+#endif // KEEPASSXC_TESTCLI_H
diff --git a/tests/TestCryptoHash.cpp b/tests/TestCryptoHash.cpp
index ac6cd7c7b..7cc6f7c17 100644
--- a/tests/TestCryptoHash.cpp
+++ b/tests/TestCryptoHash.cpp
@@ -50,8 +50,9 @@ void TestCryptoHash::test()
"8d2877eec2f63b931bd47417a81a538327af927da3e"));
QByteArray result3 = CryptoHash::hash(source2, CryptoHash::Sha512);
- QCOMPARE(result3, QByteArray::fromHex("0d41b612584ed39ff72944c29494573e40f4bb95283455fae2e0be1e3565aa9f48057d59e6ff"
- "d777970e282871c25a549a2763e5b724794f312c97021c42f91d"));
+ QCOMPARE(result3,
+ QByteArray::fromHex("0d41b612584ed39ff72944c29494573e40f4bb95283455fae2e0be1e3565aa9f48057d59e6ff"
+ "d777970e282871c25a549a2763e5b724794f312c97021c42f91d"));
CryptoHash cryptoHash4(CryptoHash::Sha512);
cryptoHash4.addData(QString("KeePa").toLatin1());
diff --git a/tests/TestCsvExporter.cpp b/tests/TestCsvExporter.cpp
index b71cf9ca7..07208c380 100644
--- a/tests/TestCsvExporter.cpp
+++ b/tests/TestCsvExporter.cpp
@@ -62,9 +62,10 @@ void TestCsvExporter::testExport()
QVERIFY(buffer.open(QIODevice::ReadWrite));
m_csvExporter->exportDatabase(&buffer, m_db);
- QString expectedResult =
- QString().append(ExpectedHeaderLine).append("\"Root/Test Group Name\",\"Test Entry Title\",\"Test Username\",\"Test "
- "Password\",\"http://test.url\",\"Test Notes\"\n");
+ QString expectedResult = QString()
+ .append(ExpectedHeaderLine)
+ .append("\"Root/Test Group Name\",\"Test Entry Title\",\"Test Username\",\"Test "
+ "Password\",\"http://test.url\",\"Test Notes\"\n");
QCOMPARE(QString::fromUtf8(buffer.buffer().constData()), expectedResult);
}
diff --git a/tests/TestEntry.cpp b/tests/TestEntry.cpp
index 8109f9bd9..23af41e6a 100644
--- a/tests/TestEntry.cpp
+++ b/tests/TestEntry.cpp
@@ -343,8 +343,7 @@ void TestEntry::testResolveReferencePlaceholders()
tstEntry->setGroup(root);
tstEntry->setUuid(QUuid::createUuid());
- QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@I:%1}").arg(entry1->uuidToHex())),
- entry1->title());
+ QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@I:%1}").arg(entry1->uuidToHex())), entry1->title());
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@T:%1}").arg(entry1->title())), entry1->title());
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@U:%1}").arg(entry1->username())), entry1->title());
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@P:%1}").arg(entry1->password())), entry1->title());
@@ -354,8 +353,7 @@ void TestEntry::testResolveReferencePlaceholders()
QString("{REF:T@O:%1}").arg(entry1->attributes()->value("CustomAttribute1"))),
entry1->title());
- QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@I:%1}").arg(entry1->uuidToHex())),
- entry1->title());
+ QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@I:%1}").arg(entry1->uuidToHex())), entry1->title());
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@T:%1}").arg(entry1->title())), entry1->title());
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:U@U:%1}").arg(entry1->username())),
entry1->username());
@@ -364,8 +362,7 @@ void TestEntry::testResolveReferencePlaceholders()
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:A@A:%1}").arg(entry1->url())), entry1->url());
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:N@N:%1}").arg(entry1->notes())), entry1->notes());
- QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@I:%1}").arg(entry2->uuidToHex())),
- entry2->title());
+ QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@I:%1}").arg(entry2->uuidToHex())), entry2->title());
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@T:%1}").arg(entry2->title())), entry2->title());
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@U:%1}").arg(entry2->username())), entry2->title());
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@P:%1}").arg(entry2->password())), entry2->title());
@@ -383,23 +380,38 @@ void TestEntry::testResolveReferencePlaceholders()
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:A@A:%1}").arg(entry2->url())), entry2->url());
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:N@N:%1}").arg(entry2->notes())), entry2->notes());
- QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@I:%1}").arg(entry3->uuidToHex())), entry3->attributes()->value("AttributeTitle"));
- QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:U@I:%1}").arg(entry3->uuidToHex())), entry3->attributes()->value("AttributeUsername"));
- QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:P@I:%1}").arg(entry3->uuidToHex())), entry3->attributes()->value("AttributePassword"));
- QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:A@I:%1}").arg(entry3->uuidToHex())), entry3->attributes()->value("AttributeUrl"));
- QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:N@I:%1}").arg(entry3->uuidToHex())), entry3->attributes()->value("AttributeNotes"));
-
- QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@I:%1}").arg(entry3->uuidToHex().toUpper())), entry3->attributes()->value("AttributeTitle"));
- QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:U@I:%1}").arg(entry3->uuidToHex().toUpper())), entry3->attributes()->value("AttributeUsername"));
- QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:P@I:%1}").arg(entry3->uuidToHex().toUpper())), entry3->attributes()->value("AttributePassword"));
- QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:A@I:%1}").arg(entry3->uuidToHex().toUpper())), entry3->attributes()->value("AttributeUrl"));
- QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:N@I:%1}").arg(entry3->uuidToHex().toUpper())), entry3->attributes()->value("AttributeNotes"));
-
- QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:t@i:%1}").arg(entry3->uuidToHex().toLower())), entry3->attributes()->value("AttributeTitle"));
- QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:u@i:%1}").arg(entry3->uuidToHex().toLower())), entry3->attributes()->value("AttributeUsername"));
- QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:p@i:%1}").arg(entry3->uuidToHex().toLower())), entry3->attributes()->value("AttributePassword"));
- QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:a@i:%1}").arg(entry3->uuidToHex().toLower())), entry3->attributes()->value("AttributeUrl"));
- QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:n@i:%1}").arg(entry3->uuidToHex().toLower())), entry3->attributes()->value("AttributeNotes"));
+ QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@I:%1}").arg(entry3->uuidToHex())),
+ entry3->attributes()->value("AttributeTitle"));
+ QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:U@I:%1}").arg(entry3->uuidToHex())),
+ entry3->attributes()->value("AttributeUsername"));
+ QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:P@I:%1}").arg(entry3->uuidToHex())),
+ entry3->attributes()->value("AttributePassword"));
+ QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:A@I:%1}").arg(entry3->uuidToHex())),
+ entry3->attributes()->value("AttributeUrl"));
+ QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:N@I:%1}").arg(entry3->uuidToHex())),
+ entry3->attributes()->value("AttributeNotes"));
+
+ QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@I:%1}").arg(entry3->uuidToHex().toUpper())),
+ entry3->attributes()->value("AttributeTitle"));
+ QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:U@I:%1}").arg(entry3->uuidToHex().toUpper())),
+ entry3->attributes()->value("AttributeUsername"));
+ QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:P@I:%1}").arg(entry3->uuidToHex().toUpper())),
+ entry3->attributes()->value("AttributePassword"));
+ QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:A@I:%1}").arg(entry3->uuidToHex().toUpper())),
+ entry3->attributes()->value("AttributeUrl"));
+ QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:N@I:%1}").arg(entry3->uuidToHex().toUpper())),
+ entry3->attributes()->value("AttributeNotes"));
+
+ QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:t@i:%1}").arg(entry3->uuidToHex().toLower())),
+ entry3->attributes()->value("AttributeTitle"));
+ QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:u@i:%1}").arg(entry3->uuidToHex().toLower())),
+ entry3->attributes()->value("AttributeUsername"));
+ QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:p@i:%1}").arg(entry3->uuidToHex().toLower())),
+ entry3->attributes()->value("AttributePassword"));
+ QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:a@i:%1}").arg(entry3->uuidToHex().toLower())),
+ entry3->attributes()->value("AttributeUrl"));
+ QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:n@i:%1}").arg(entry3->uuidToHex().toLower())),
+ entry3->attributes()->value("AttributeNotes"));
}
void TestEntry::testResolveNonIdPlaceholdersToUuid()
@@ -466,8 +478,7 @@ void TestEntry::testResolveNonIdPlaceholdersToUuid()
newEntry->setGroup(root);
newEntry->setNotes(newEntryNotesRaw);
- const QString newEntryNotesResolved =
- newEntry->resolveMultiplePlaceholders(newEntry->notes());
+ const QString newEntryNotesResolved = newEntry->resolveMultiplePlaceholders(newEntry->notes());
QCOMPARE(newEntryNotesResolved, referencedEntry->uuidToHex());
}
}
diff --git a/tests/TestGlobal.h b/tests/TestGlobal.h
index 958034293..c85e60faf 100644
--- a/tests/TestGlobal.h
+++ b/tests/TestGlobal.h
@@ -25,7 +25,7 @@
namespace QTest
{
-
+
template <> inline char* toString(const Group::TriState& triState)
{
QString value;
diff --git a/tests/TestKdbx4.cpp b/tests/TestKdbx4.cpp
index a7fd52e0e..fe4679da5 100644
--- a/tests/TestKdbx4.cpp
+++ b/tests/TestKdbx4.cpp
@@ -320,11 +320,11 @@ void TestKdbx4::testUpgradeMasterKeyIntegrity_data()
QTest::newRow("Upgrade (explicit): kdf-argon2") << QString("kdf-argon2") << KeePass2::FILE_VERSION_4;
QTest::newRow("Upgrade (explicit): kdf-aes-kdbx4") << QString("kdf-aes-kdbx4") << KeePass2::FILE_VERSION_4;
QTest::newRow("Upgrade (implicit): public-customdata") << QString("public-customdata") << KeePass2::FILE_VERSION_4;
- QTest::newRow("Upgrade (implicit): rootgroup-customdata") << QString("rootgroup-customdata")
- << KeePass2::FILE_VERSION_4;
+ QTest::newRow("Upgrade (implicit): rootgroup-customdata")
+ << QString("rootgroup-customdata") << KeePass2::FILE_VERSION_4;
QTest::newRow("Upgrade (implicit): group-customdata") << QString("group-customdata") << KeePass2::FILE_VERSION_4;
- QTest::newRow("Upgrade (implicit): rootentry-customdata") << QString("rootentry-customdata")
- << KeePass2::FILE_VERSION_4;
+ QTest::newRow("Upgrade (implicit): rootentry-customdata")
+ << QString("rootentry-customdata") << KeePass2::FILE_VERSION_4;
QTest::newRow("Upgrade (implicit): entry-customdata") << QString("entry-customdata") << KeePass2::FILE_VERSION_4;
}
diff --git a/tests/TestKeePass2Format.cpp b/tests/TestKeePass2Format.cpp
index 35bbfed3e..012a1b11a 100644
--- a/tests/TestKeePass2Format.cpp
+++ b/tests/TestKeePass2Format.cpp
@@ -146,7 +146,8 @@ void TestKeePass2Format::testXmlGroupRoot()
QCOMPARE(group->defaultAutoTypeSequence(), QString(""));
QCOMPARE(group->autoTypeEnabled(), Group::Inherit);
QCOMPARE(group->searchingEnabled(), Group::Inherit);
- QCOMPARE(group->lastTopVisibleEntry()->uuid(), QUuid::fromRfc4122(QByteArray::fromBase64("+wSUOv6qf0OzW8/ZHAs2sA==")));
+ QCOMPARE(group->lastTopVisibleEntry()->uuid(),
+ QUuid::fromRfc4122(QByteArray::fromBase64("+wSUOv6qf0OzW8/ZHAs2sA==")));
QCOMPARE(group->children().size(), 3);
QVERIFY(m_xmlDb->metadata()->recycleBin() == m_xmlDb->rootGroup()->children().at(2));
diff --git a/tests/TestMerge.cpp b/tests/TestMerge.cpp
index 3e41d7d50..a09eb32e6 100644
--- a/tests/TestMerge.cpp
+++ b/tests/TestMerge.cpp
@@ -37,7 +37,7 @@ namespace
}
MockClock* m_clock = nullptr;
-}
+} // namespace
void TestMerge::initTestCase()
{
@@ -302,7 +302,9 @@ void TestMerge::testResolveConflictDuplicate()
"KeepBoth should not reuse the UUIDs when cloning.");
}
-void TestMerge::testResolveConflictTemplate(int mergeMode, std::function<void(Database*, const QMap<const char*, QDateTime>&)> verification)
+void TestMerge::testResolveConflictTemplate(
+ int mergeMode,
+ std::function<void(Database*, const QMap<const char*, QDateTime>&)> verification)
{
QMap<const char*, QDateTime> timestamps;
timestamps["initialTime"] = m_clock->currentDateTimeUtc();
@@ -434,7 +436,8 @@ void TestMerge::testResolveConflictTemplate(int mergeMode, std::function<void(Da
QVERIFY(dbDestination->rootGroup()->findEntryByPath("entrySource"));
}
-void TestMerge::testDeletionConflictTemplate(int mergeMode, std::function<void(Database*, const QMap<QString, QUuid>&)> verification)
+void TestMerge::testDeletionConflictTemplate(int mergeMode,
+ std::function<void(Database*, const QMap<QString, QUuid>&)> verification)
{
QMap<QString, QUuid> identifiers;
m_clock->currentDateTimeUtc();
@@ -609,7 +612,7 @@ void TestMerge::assertDeletionNewerOnly(Database* db, const QMap<QString, QUuid>
QVERIFY(db->containsDeletedObject(identifiers["EntryDeletedInTargetAfterEntryUpdatedInSource"]));
}
-void TestMerge::assertDeletionLocalOnly(Database* db, const QMap<QString, QUuid> &identifiers)
+void TestMerge::assertDeletionLocalOnly(Database* db, const QMap<QString, QUuid>& identifiers)
{
QPointer<Group> mergedRootGroup = db->rootGroup();
@@ -647,66 +650,80 @@ void TestMerge::assertDeletionLocalOnly(Database* db, const QMap<QString, QUuid>
QVERIFY(db->containsDeletedObject(identifiers["EntryDeletedInTargetAfterEntryUpdatedInSource"]));
}
-void TestMerge::assertUpdateMergedEntry1(Entry *mergedEntry1, const QMap<const char *, QDateTime> &timestamps)
+void TestMerge::assertUpdateMergedEntry1(Entry* mergedEntry1, const QMap<const char*, QDateTime>& timestamps)
{
QCOMPARE(mergedEntry1->historyItems().count(), 4);
QCOMPARE(mergedEntry1->historyItems().at(0)->notes(), QString(""));
QCOMPARE(mergedEntry1->historyItems().at(0)->timeInfo().lastModificationTime(), timestamps["initialTime"]);
QCOMPARE(mergedEntry1->historyItems().at(1)->notes(), QString(""));
- QCOMPARE(mergedEntry1->historyItems().at(1)->timeInfo().lastModificationTime(), timestamps["oldestCommonHistoryTime"]);
+ QCOMPARE(mergedEntry1->historyItems().at(1)->timeInfo().lastModificationTime(),
+ timestamps["oldestCommonHistoryTime"]);
QCOMPARE(mergedEntry1->historyItems().at(2)->notes(), QString("1 Common"));
- QCOMPARE(mergedEntry1->historyItems().at(2)->timeInfo().lastModificationTime(), timestamps["newestCommonHistoryTime"]);
+ QCOMPARE(mergedEntry1->historyItems().at(2)->timeInfo().lastModificationTime(),
+ timestamps["newestCommonHistoryTime"]);
QCOMPARE(mergedEntry1->historyItems().at(3)->notes(), QString("2 Source"));
- QCOMPARE(mergedEntry1->historyItems().at(3)->timeInfo().lastModificationTime(), timestamps["oldestDivergingHistoryTime"]);
+ QCOMPARE(mergedEntry1->historyItems().at(3)->timeInfo().lastModificationTime(),
+ timestamps["oldestDivergingHistoryTime"]);
QCOMPARE(mergedEntry1->notes(), QString("3 Destination"));
QCOMPARE(mergedEntry1->timeInfo().lastModificationTime(), timestamps["newestDivergingHistoryTime"]);
}
-void TestMerge::assertUpdateReappliedEntry2(Entry *mergedEntry2, const QMap<const char *, QDateTime> &timestamps)
+void TestMerge::assertUpdateReappliedEntry2(Entry* mergedEntry2, const QMap<const char*, QDateTime>& timestamps)
{
QCOMPARE(mergedEntry2->historyItems().count(), 5);
QCOMPARE(mergedEntry2->historyItems().at(0)->notes(), QString(""));
QCOMPARE(mergedEntry2->historyItems().at(0)->timeInfo().lastModificationTime(), timestamps["initialTime"]);
QCOMPARE(mergedEntry2->historyItems().at(1)->notes(), QString(""));
- QCOMPARE(mergedEntry2->historyItems().at(1)->timeInfo().lastModificationTime(), timestamps["oldestCommonHistoryTime"]);
+ QCOMPARE(mergedEntry2->historyItems().at(1)->timeInfo().lastModificationTime(),
+ timestamps["oldestCommonHistoryTime"]);
QCOMPARE(mergedEntry2->historyItems().at(2)->notes(), QString("1 Common"));
- QCOMPARE(mergedEntry2->historyItems().at(2)->timeInfo().lastModificationTime(), timestamps["newestCommonHistoryTime"]);
+ QCOMPARE(mergedEntry2->historyItems().at(2)->timeInfo().lastModificationTime(),
+ timestamps["newestCommonHistoryTime"]);
QCOMPARE(mergedEntry2->historyItems().at(3)->notes(), QString("2 Destination"));
- QCOMPARE(mergedEntry2->historyItems().at(3)->timeInfo().lastModificationTime(), timestamps["oldestDivergingHistoryTime"]);
+ QCOMPARE(mergedEntry2->historyItems().at(3)->timeInfo().lastModificationTime(),
+ timestamps["oldestDivergingHistoryTime"]);
QCOMPARE(mergedEntry2->historyItems().at(4)->notes(), QString("3 Source"));
- QCOMPARE(mergedEntry2->historyItems().at(4)->timeInfo().lastModificationTime(), timestamps["newestDivergingHistoryTime"]);
+ QCOMPARE(mergedEntry2->historyItems().at(4)->timeInfo().lastModificationTime(),
+ timestamps["newestDivergingHistoryTime"]);
QCOMPARE(mergedEntry2->notes(), QString("2 Destination"));
QCOMPARE(mergedEntry2->timeInfo().lastModificationTime(), timestamps["mergeTime"]);
}
-void TestMerge::assertUpdateReappliedEntry1(Entry *mergedEntry1, const QMap<const char *, QDateTime> &timestamps)
+void TestMerge::assertUpdateReappliedEntry1(Entry* mergedEntry1, const QMap<const char*, QDateTime>& timestamps)
{
QCOMPARE(mergedEntry1->historyItems().count(), 5);
QCOMPARE(mergedEntry1->historyItems().at(0)->notes(), QString(""));
QCOMPARE(mergedEntry1->historyItems().at(0)->timeInfo().lastModificationTime(), timestamps["initialTime"]);
QCOMPARE(mergedEntry1->historyItems().at(1)->notes(), QString(""));
- QCOMPARE(mergedEntry1->historyItems().at(1)->timeInfo().lastModificationTime(), timestamps["oldestCommonHistoryTime"]);
+ QCOMPARE(mergedEntry1->historyItems().at(1)->timeInfo().lastModificationTime(),
+ timestamps["oldestCommonHistoryTime"]);
QCOMPARE(mergedEntry1->historyItems().at(2)->notes(), QString("1 Common"));
- QCOMPARE(mergedEntry1->historyItems().at(2)->timeInfo().lastModificationTime(), timestamps["newestCommonHistoryTime"]);
+ QCOMPARE(mergedEntry1->historyItems().at(2)->timeInfo().lastModificationTime(),
+ timestamps["newestCommonHistoryTime"]);
QCOMPARE(mergedEntry1->historyItems().at(3)->notes(), QString("2 Source"));
- QCOMPARE(mergedEntry1->historyItems().at(3)->timeInfo().lastModificationTime(), timestamps["oldestDivergingHistoryTime"]);
+ QCOMPARE(mergedEntry1->historyItems().at(3)->timeInfo().lastModificationTime(),
+ timestamps["oldestDivergingHistoryTime"]);
QCOMPARE(mergedEntry1->historyItems().at(4)->notes(), QString("3 Destination"));
- QCOMPARE(mergedEntry1->historyItems().at(4)->timeInfo().lastModificationTime(), timestamps["newestDivergingHistoryTime"]);
+ QCOMPARE(mergedEntry1->historyItems().at(4)->timeInfo().lastModificationTime(),
+ timestamps["newestDivergingHistoryTime"]);
QCOMPARE(mergedEntry1->notes(), QString("2 Source"));
QCOMPARE(mergedEntry1->timeInfo().lastModificationTime(), timestamps["mergeTime"]);
}
-void TestMerge::assertUpdateMergedEntry2(Entry *mergedEntry2, const QMap<const char *, QDateTime> &timestamps)
+void TestMerge::assertUpdateMergedEntry2(Entry* mergedEntry2, const QMap<const char*, QDateTime>& timestamps)
{
QCOMPARE(mergedEntry2->historyItems().count(), 4);
QCOMPARE(mergedEntry2->historyItems().at(0)->notes(), QString(""));
QCOMPARE(mergedEntry2->historyItems().at(0)->timeInfo().lastModificationTime(), timestamps["initialTime"]);
QCOMPARE(mergedEntry2->historyItems().at(1)->notes(), QString(""));
- QCOMPARE(mergedEntry2->historyItems().at(1)->timeInfo().lastModificationTime(), timestamps["oldestCommonHistoryTime"]);
+ QCOMPARE(mergedEntry2->historyItems().at(1)->timeInfo().lastModificationTime(),
+ timestamps["oldestCommonHistoryTime"]);
QCOMPARE(mergedEntry2->historyItems().at(2)->notes(), QString("1 Common"));
- QCOMPARE(mergedEntry2->historyItems().at(2)->timeInfo().lastModificationTime(), timestamps["newestCommonHistoryTime"]);
+ QCOMPARE(mergedEntry2->historyItems().at(2)->timeInfo().lastModificationTime(),
+ timestamps["newestCommonHistoryTime"]);
QCOMPARE(mergedEntry2->historyItems().at(3)->notes(), QString("2 Destination"));
- QCOMPARE(mergedEntry2->historyItems().at(3)->timeInfo().lastModificationTime(), timestamps["oldestDivergingHistoryTime"]);
+ QCOMPARE(mergedEntry2->historyItems().at(3)->timeInfo().lastModificationTime(),
+ timestamps["oldestDivergingHistoryTime"]);
QCOMPARE(mergedEntry2->notes(), QString("3 Source"));
QCOMPARE(mergedEntry2->timeInfo().lastModificationTime(), timestamps["newestDivergingHistoryTime"]);
}
diff --git a/tests/TestMerge.h b/tests/TestMerge.h
index 7a18d2a39..159256f2b 100644
--- a/tests/TestMerge.h
+++ b/tests/TestMerge.h
@@ -66,15 +66,16 @@ private slots:
private:
Database* createTestDatabase();
Database* createTestDatabaseStructureClone(Database* source, int entryFlags, int groupFlags);
- void testResolveConflictTemplate(int mergeMode, std::function<void(Database*, const QMap<const char*, QDateTime>&)> verification);
- void testDeletionConflictTemplate(int mergeMode, std::function<void(Database*, const QMap<QString, QUuid>&)> verification);
- static void assertDeletionNewerOnly(Database *db, const QMap<QString, QUuid> &identifiers);
- static void assertDeletionLocalOnly(Database *db, const QMap<QString, QUuid> &identifiers);
- static void assertUpdateMergedEntry1(Entry *entry, const QMap<const char*, QDateTime> &timestamps);
- static void assertUpdateReappliedEntry2(Entry *entry, const QMap<const char*, QDateTime> &timestamps);
- static void assertUpdateReappliedEntry1(Entry *entry, const QMap<const char*, QDateTime> &timestamps);
- static void assertUpdateMergedEntry2(Entry *entry, const QMap<const char *, QDateTime> &timestamps);
-
+ void testResolveConflictTemplate(int mergeMode,
+ std::function<void(Database*, const QMap<const char*, QDateTime>&)> verification);
+ void testDeletionConflictTemplate(int mergeMode,
+ std::function<void(Database*, const QMap<QString, QUuid>&)> verification);
+ static void assertDeletionNewerOnly(Database* db, const QMap<QString, QUuid>& identifiers);
+ static void assertDeletionLocalOnly(Database* db, const QMap<QString, QUuid>& identifiers);
+ static void assertUpdateMergedEntry1(Entry* entry, const QMap<const char*, QDateTime>& timestamps);
+ static void assertUpdateReappliedEntry2(Entry* entry, const QMap<const char*, QDateTime>& timestamps);
+ static void assertUpdateReappliedEntry1(Entry* entry, const QMap<const char*, QDateTime>& timestamps);
+ static void assertUpdateMergedEntry2(Entry* entry, const QMap<const char*, QDateTime>& timestamps);
};
#endif // KEEPASSX_TESTMERGE_H
diff --git a/tests/TestModified.cpp b/tests/TestModified.cpp
index fff558b22..254db3796 100644
--- a/tests/TestModified.cpp
+++ b/tests/TestModified.cpp
@@ -181,7 +181,6 @@ void TestModified::testGroupSets()
root->setIcon(root->iconUuid());
QTRY_COMPARE(spyModified.count(), spyCount);
-
group->setUuid(QUuid::createUuid());
++spyCount;
QTRY_COMPARE(spyModified.count(), spyCount);
diff --git a/tests/TestOpenSSHKey.cpp b/tests/TestOpenSSHKey.cpp
index 40fb9c302..63a1455d9 100644
--- a/tests/TestOpenSSHKey.cpp
+++ b/tests/TestOpenSSHKey.cpp
@@ -89,38 +89,36 @@ void TestOpenSSHKey::testParseDSA()
void TestOpenSSHKey::testDecryptRSAAES128CBC()
{
- const QString keyString = QString(
- "-----BEGIN RSA PRIVATE KEY-----\n"
- "Proc-Type: 4,ENCRYPTED\n"
- "DEK-Info: AES-128-CBC,804E4D214D1263FF94E3743FE799DBB4\n"
- "\n"
- "lM9TDfOTbiRhaGGDh7Hn+rqw8CCWcYBZYu7smyYLdnWKXKPmbne8CQFZBAS1FJwZ\n"
- "6Mj6n075yFGyzN9/OfeqKiUA4adlbwLbGwB+yyKsC2FlsvRIEr4hup02WWM47vHj\n"
- "DS4TRmNkE7MKFLhpNCyt5OGGM45s+/lwVTw51K0Hm99TBd72IrX4jfY9ZxAVbL3l\n"
- "aTohL8x6oOTe7q318QgJoFi+DjJhDWLGLLJ7fBqD2imz2fmrY4j8Jpw2sDe1rj82\n"
- "gMqqNG3FrfN0S4uYlWYH5pAh+BUcB1UdmTU/rV5wJMK1oUytmZv/J2+X/0k3Y93F\n"
- "aw6JWOy28OizW+TQXvv8gREWsp5PEclqUZhhGQbVbCQCiDOxg+xiXNySdRH1IqjR\n"
- "zQiKgD4SPzkxQekExPaIQT/KutWZdMNYybEqooCx8YyeDoN31z7Wa2rv6OulOn/j\n"
- "wJFvyd2PT/6brHKI4ky8RYroDf4FbVYKfyEW5CSAg2OyL/tY/kSPgy/k0WT7fDwq\n"
- "dPSuYM9yeWNL6kAhDqDOv8+s3xvOVEljktBvQvItQwVLmHszC3E2AcnaxzdblKPu\n"
- "e3+mBT80NXHjERK2ht+/9JYseK1ujNbNAaG8SbKfU3FF0VlyJ0QW6TuIEdpNnymT\n"
- "0fm0cDfKNaoeJIFnBRZhgIOJAic9DM0cTe/vSG69DaUYsaQPp36al7Fbux3GpFHS\n"
- "OtJEySYGro/6zvJ9dDIEfIGZjA3RaMt6+DuyJZXQdT2RNXa9j60xW7dXh0En4n82\n"
- "JUKTxYhDPLS5c8BzpJqoopxpKwElmrJ7Y3xpd6z2vIlD8ftuZrkk6siTMNQ2s7MI\n"
- "Xl332O+0H4k7uSfczHPOOw36TFhNjGQAP0b7O+0/RVG0ttOIoAn7ZkX3nfdbtG5B\n"
- "DWKvDaopvrcC2/scQ5uLUnqnBiGw1XiYpdg5ang7knHNzHZAIekVaYYZigpCAKp+\n"
- "OtoaDeUEzqFhYVmF8ad1fgvC9ZUsuxS4XUHCKl0H6CJcvW9MJPVbveqYoK+j9qKd\n"
- "iMIkQBP1kE2rzGZVGUkZTpM9LVD9nP0nsbr6E8BatFcNgRirsg2BTJglNpXlCmY6\n"
- "ldzJ/ELBbzoXIn+0wTGai0o4eBPx55baef69JfPuZqEB9pLNE+mHstrqIwcfqYu4\n"
- "M+Vzun1QshRMj9a1PVkIHfs1fLeebI4QCHO0vJlc9K4iYPM4rsDNO3YaAgGRuARS\n"
- "f3McGiGFxkv5zxe8i05ZBnn+exE77jpRKxd223jAMe2wu4WiFB7ZVo4Db6b5Oo2T\n"
- "TPh3VuY7TNMEKkcUi+mGLKjroocQ5j8WQYlfnyOaTalUVQDzOTNb67QIIoiszR0U\n"
- "+AXGyxHj0QtotZFoPME+AbS9Zqy3SgSOuIzPBPU5zS4uoKNdD5NPE5YAuafCjsDy\n"
- "MT4DVy+cPOQYUK022S7T2nsA1btmvUvD5LL2Mc8VuKsWOn/7FKZua6OCfipt6oX0\n"
- "1tzYrw0/ALK+CIdVdYIiPPfxGZkr+JSLOOg7u50tpmen9GzxgNTv63miygwUAIDF\n"
- "u0GbQwOueoA453/N75FcXOgrbqTdivyadUbRP+l7YJk/SfIytyJMOigejp+Z1lzF\n"
- "-----END RSA PRIVATE KEY-----\n"
- );
+ const QString keyString = QString("-----BEGIN RSA PRIVATE KEY-----\n"
+ "Proc-Type: 4,ENCRYPTED\n"
+ "DEK-Info: AES-128-CBC,804E4D214D1263FF94E3743FE799DBB4\n"
+ "\n"
+ "lM9TDfOTbiRhaGGDh7Hn+rqw8CCWcYBZYu7smyYLdnWKXKPmbne8CQFZBAS1FJwZ\n"
+ "6Mj6n075yFGyzN9/OfeqKiUA4adlbwLbGwB+yyKsC2FlsvRIEr4hup02WWM47vHj\n"
+ "DS4TRmNkE7MKFLhpNCyt5OGGM45s+/lwVTw51K0Hm99TBd72IrX4jfY9ZxAVbL3l\n"
+ "aTohL8x6oOTe7q318QgJoFi+DjJhDWLGLLJ7fBqD2imz2fmrY4j8Jpw2sDe1rj82\n"
+ "gMqqNG3FrfN0S4uYlWYH5pAh+BUcB1UdmTU/rV5wJMK1oUytmZv/J2+X/0k3Y93F\n"
+ "aw6JWOy28OizW+TQXvv8gREWsp5PEclqUZhhGQbVbCQCiDOxg+xiXNySdRH1IqjR\n"
+ "zQiKgD4SPzkxQekExPaIQT/KutWZdMNYybEqooCx8YyeDoN31z7Wa2rv6OulOn/j\n"
+ "wJFvyd2PT/6brHKI4ky8RYroDf4FbVYKfyEW5CSAg2OyL/tY/kSPgy/k0WT7fDwq\n"
+ "dPSuYM9yeWNL6kAhDqDOv8+s3xvOVEljktBvQvItQwVLmHszC3E2AcnaxzdblKPu\n"
+ "e3+mBT80NXHjERK2ht+/9JYseK1ujNbNAaG8SbKfU3FF0VlyJ0QW6TuIEdpNnymT\n"
+ "0fm0cDfKNaoeJIFnBRZhgIOJAic9DM0cTe/vSG69DaUYsaQPp36al7Fbux3GpFHS\n"
+ "OtJEySYGro/6zvJ9dDIEfIGZjA3RaMt6+DuyJZXQdT2RNXa9j60xW7dXh0En4n82\n"
+ "JUKTxYhDPLS5c8BzpJqoopxpKwElmrJ7Y3xpd6z2vIlD8ftuZrkk6siTMNQ2s7MI\n"
+ "Xl332O+0H4k7uSfczHPOOw36TFhNjGQAP0b7O+0/RVG0ttOIoAn7ZkX3nfdbtG5B\n"
+ "DWKvDaopvrcC2/scQ5uLUnqnBiGw1XiYpdg5ang7knHNzHZAIekVaYYZigpCAKp+\n"
+ "OtoaDeUEzqFhYVmF8ad1fgvC9ZUsuxS4XUHCKl0H6CJcvW9MJPVbveqYoK+j9qKd\n"
+ "iMIkQBP1kE2rzGZVGUkZTpM9LVD9nP0nsbr6E8BatFcNgRirsg2BTJglNpXlCmY6\n"
+ "ldzJ/ELBbzoXIn+0wTGai0o4eBPx55baef69JfPuZqEB9pLNE+mHstrqIwcfqYu4\n"
+ "M+Vzun1QshRMj9a1PVkIHfs1fLeebI4QCHO0vJlc9K4iYPM4rsDNO3YaAgGRuARS\n"
+ "f3McGiGFxkv5zxe8i05ZBnn+exE77jpRKxd223jAMe2wu4WiFB7ZVo4Db6b5Oo2T\n"
+ "TPh3VuY7TNMEKkcUi+mGLKjroocQ5j8WQYlfnyOaTalUVQDzOTNb67QIIoiszR0U\n"
+ "+AXGyxHj0QtotZFoPME+AbS9Zqy3SgSOuIzPBPU5zS4uoKNdD5NPE5YAuafCjsDy\n"
+ "MT4DVy+cPOQYUK022S7T2nsA1btmvUvD5LL2Mc8VuKsWOn/7FKZua6OCfipt6oX0\n"
+ "1tzYrw0/ALK+CIdVdYIiPPfxGZkr+JSLOOg7u50tpmen9GzxgNTv63miygwUAIDF\n"
+ "u0GbQwOueoA453/N75FcXOgrbqTdivyadUbRP+l7YJk/SfIytyJMOigejp+Z1lzF\n"
+ "-----END RSA PRIVATE KEY-----\n");
const QByteArray keyData = keyString.toLatin1();
@@ -179,65 +177,61 @@ void TestOpenSSHKey::testParseRSA()
void TestOpenSSHKey::testParseRSACompare()
{
- const QString oldKeyString = QString(
- "-----BEGIN RSA PRIVATE KEY-----\n"
- "MIIEpAIBAAKCAQEAsCHtJicDPWnvHSIKbnTZaJkIB9vgE0pmLdK580JUqBuonVbB\n"
- "y1QTy0ZQ7/TtqvLPgwPK88TR46OLO/QGCzo2+XxgJ85uy0xfuyUYRmSuw0drsErN\n"
- "mH8vU91lSBxsGDp9LtBbgHKoR23vMWZ34IxFRc55XphrIH48ijsMaL6bXBwF/3tD\n"
- "9T3lm2MpP1huyVNnIY9+GRRWCy4f9LMj/UGu/n4RtwwfpOZBBRwYkq5QkzA9lPm/\n"
- "VzF3MP1rKTMkvAw+Nfb383mkmc6MRnsa6uh6iDa9aVB7naegM13UJQX/PY1Ks6pO\n"
- "XDpy/MQ7iCh+HmYNq5dRmARyaNl9xIXJNhz1cQIDAQABAoIBAQCnEUc1LUQxeM5K\n"
- "wANNCqE+SgoIClPdeHC7fmrLh1ttqe6ib6ybBUFRS31yXs0hnfefunVEDKlaV8K2\n"
- "N52UAMAsngFHQNRvGh6kEWeZPd9Xc+N98TZbNCjcT+DGKc+Om8wqH5DrodZlCq4c\n"
- "GaoT4HnE4TjWtZTH2XXrWF9I66PKFWf070R44nvyVcvaZi4pC2YmURRPuGF6K1iK\n"
- "dH8zM6HHG1UGu2W6hLNn+K01IulG0Lb8eWNaNYMmtQWaxyp7I2IWkkecUs3nCuiR\n"
- "byFOoomCjdh8r9yZFvwxjGUhgtkALN9GCU0Mwve+s11IB2gevruN+q9/Qejbyfdm\n"
- "IlgLAeTRAoGBANRcVzW9CYeobCf+U9hKJFEOur8XO+J2mTMaELA0EjWpTJFAeIT7\n"
- "KeRpCRG4/vOSklxxRF6vP1EACA4Z+5BlN+FTipHHs+bSEgqkPZiiANDH7Zot5Iqv\n"
- "1q0fRyldNRZNZK7DWp08BPNVWGA/EnEuKJiURxnxBaxNXbUyMCdjxvMvAoGBANRT\n"
- "utbrqS/bAa/DcHKn3V6DRqBl3TDOfvCNjiKC84a67F2uXgzLIdMktr4d1NyCZVJd\n"
- "7/zVgWORLIdg1eAi6rYGoOvNV39wwga7CF+m9sBY0wAaKYCELe6L26r4aQHVCX6n\n"
- "rnIgUv+4o4itmU2iP0r3wlmDC9pDRQP82vfvQPlfAoGASwhleANW/quvq2HdViq8\n"
- "Mje2HBalfhrRfpDTHK8JUBSFjTzuWG42GxJRtgVbb8x2ElujAKGDCaetMO5VSGu7\n"
- "Fs5hw6iAFCpdXY0yhl+XUi2R8kwM2EPQ4lKO3jqkq0ClNmqn9a5jQWcCVt9yMLNS\n"
- "fLbHeI8EpiCf34ngIcrLXNkCgYEAzlcEZuKkC46xB+dNew8pMTUwSKZVm53BfPKD\n"
- "44QRN6imFbBjU9mAaJnwQbfp6dWKs834cGPolyM4++MeVfB42iZ88ksesgmZdUMD\n"
- "szkl6O0pOJs0I+HQZVdjRbadDZvD22MHQ3+oST1dJ3FVXz3Cdo9qPuT8esMO6f4r\n"
- "qfDH2s8CgYAXC/lWWHQ//PGP0pH4oiEXisx1K0X1u0xMGgrChxBRGRiKZUwNMIvJ\n"
- "TqUu7IKizK19cLHF/NBvxHYHFw+m7puNjn6T1RtRCUjRZT7Dx1VHfVosL9ih5DA8\n"
- "tpbZA5KGKcvHtB5DDgT0MHwzBZnb4Q//Rhovzn+HXZPsJTTgHHy3NQ==\n"
- "-----END RSA PRIVATE KEY-----\n"
- );
-
- const QString newKeyString = QString(
- "-----BEGIN OPENSSH PRIVATE KEY-----\n"
- "b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABFwAAAAdzc2gtcn\n"
- "NhAAAAAwEAAQAAAQEAsCHtJicDPWnvHSIKbnTZaJkIB9vgE0pmLdK580JUqBuonVbBy1QT\n"
- "y0ZQ7/TtqvLPgwPK88TR46OLO/QGCzo2+XxgJ85uy0xfuyUYRmSuw0drsErNmH8vU91lSB\n"
- "xsGDp9LtBbgHKoR23vMWZ34IxFRc55XphrIH48ijsMaL6bXBwF/3tD9T3lm2MpP1huyVNn\n"
- "IY9+GRRWCy4f9LMj/UGu/n4RtwwfpOZBBRwYkq5QkzA9lPm/VzF3MP1rKTMkvAw+Nfb383\n"
- "mkmc6MRnsa6uh6iDa9aVB7naegM13UJQX/PY1Ks6pOXDpy/MQ7iCh+HmYNq5dRmARyaNl9\n"
- "xIXJNhz1cQAAA8DLsKINy7CiDQAAAAdzc2gtcnNhAAABAQCwIe0mJwM9ae8dIgpudNlomQ\n"
- "gH2+ATSmYt0rnzQlSoG6idVsHLVBPLRlDv9O2q8s+DA8rzxNHjo4s79AYLOjb5fGAnzm7L\n"
- "TF+7JRhGZK7DR2uwSs2Yfy9T3WVIHGwYOn0u0FuAcqhHbe8xZnfgjEVFznlemGsgfjyKOw\n"
- "xovptcHAX/e0P1PeWbYyk/WG7JU2chj34ZFFYLLh/0syP9Qa7+fhG3DB+k5kEFHBiSrlCT\n"
- "MD2U+b9XMXcw/WspMyS8DD419vfzeaSZzoxGexrq6HqINr1pUHudp6AzXdQlBf89jUqzqk\n"
- "5cOnL8xDuIKH4eZg2rl1GYBHJo2X3Ehck2HPVxAAAAAwEAAQAAAQEApxFHNS1EMXjOSsAD\n"
- "TQqhPkoKCApT3Xhwu35qy4dbbanuom+smwVBUUt9cl7NIZ33n7p1RAypWlfCtjedlADALJ\n"
- "4BR0DUbxoepBFnmT3fV3PjffE2WzQo3E/gxinPjpvMKh+Q66HWZQquHBmqE+B5xOE41rWU\n"
- "x9l161hfSOujyhVn9O9EeOJ78lXL2mYuKQtmJlEUT7hheitYinR/MzOhxxtVBrtluoSzZ/\n"
- "itNSLpRtC2/HljWjWDJrUFmscqeyNiFpJHnFLN5wrokW8hTqKJgo3YfK/cmRb8MYxlIYLZ\n"
- "ACzfRglNDML3vrNdSAdoHr67jfqvf0Ho28n3ZiJYCwHk0QAAAIAXC/lWWHQ//PGP0pH4oi\n"
- "EXisx1K0X1u0xMGgrChxBRGRiKZUwNMIvJTqUu7IKizK19cLHF/NBvxHYHFw+m7puNjn6T\n"
- "1RtRCUjRZT7Dx1VHfVosL9ih5DA8tpbZA5KGKcvHtB5DDgT0MHwzBZnb4Q//Rhovzn+HXZ\n"
- "PsJTTgHHy3NQAAAIEA1FxXNb0Jh6hsJ/5T2EokUQ66vxc74naZMxoQsDQSNalMkUB4hPsp\n"
- "5GkJEbj+85KSXHFEXq8/UQAIDhn7kGU34VOKkcez5tISCqQ9mKIA0Mftmi3kiq/WrR9HKV\n"
- "01Fk1krsNanTwE81VYYD8ScS4omJRHGfEFrE1dtTIwJ2PG8y8AAACBANRTutbrqS/bAa/D\n"
- "cHKn3V6DRqBl3TDOfvCNjiKC84a67F2uXgzLIdMktr4d1NyCZVJd7/zVgWORLIdg1eAi6r\n"
- "YGoOvNV39wwga7CF+m9sBY0wAaKYCELe6L26r4aQHVCX6nrnIgUv+4o4itmU2iP0r3wlmD\n"
- "C9pDRQP82vfvQPlfAAAABmlkX3JzYQECAwQ=\n"
- "-----END OPENSSH PRIVATE KEY-----\n"
- );
+ const QString oldKeyString = QString("-----BEGIN RSA PRIVATE KEY-----\n"
+ "MIIEpAIBAAKCAQEAsCHtJicDPWnvHSIKbnTZaJkIB9vgE0pmLdK580JUqBuonVbB\n"
+ "y1QTy0ZQ7/TtqvLPgwPK88TR46OLO/QGCzo2+XxgJ85uy0xfuyUYRmSuw0drsErN\n"
+ "mH8vU91lSBxsGDp9LtBbgHKoR23vMWZ34IxFRc55XphrIH48ijsMaL6bXBwF/3tD\n"
+ "9T3lm2MpP1huyVNnIY9+GRRWCy4f9LMj/UGu/n4RtwwfpOZBBRwYkq5QkzA9lPm/\n"
+ "VzF3MP1rKTMkvAw+Nfb383mkmc6MRnsa6uh6iDa9aVB7naegM13UJQX/PY1Ks6pO\n"
+ "XDpy/MQ7iCh+HmYNq5dRmARyaNl9xIXJNhz1cQIDAQABAoIBAQCnEUc1LUQxeM5K\n"
+ "wANNCqE+SgoIClPdeHC7fmrLh1ttqe6ib6ybBUFRS31yXs0hnfefunVEDKlaV8K2\n"
+ "N52UAMAsngFHQNRvGh6kEWeZPd9Xc+N98TZbNCjcT+DGKc+Om8wqH5DrodZlCq4c\n"
+ "GaoT4HnE4TjWtZTH2XXrWF9I66PKFWf070R44nvyVcvaZi4pC2YmURRPuGF6K1iK\n"
+ "dH8zM6HHG1UGu2W6hLNn+K01IulG0Lb8eWNaNYMmtQWaxyp7I2IWkkecUs3nCuiR\n"
+ "byFOoomCjdh8r9yZFvwxjGUhgtkALN9GCU0Mwve+s11IB2gevruN+q9/Qejbyfdm\n"
+ "IlgLAeTRAoGBANRcVzW9CYeobCf+U9hKJFEOur8XO+J2mTMaELA0EjWpTJFAeIT7\n"
+ "KeRpCRG4/vOSklxxRF6vP1EACA4Z+5BlN+FTipHHs+bSEgqkPZiiANDH7Zot5Iqv\n"
+ "1q0fRyldNRZNZK7DWp08BPNVWGA/EnEuKJiURxnxBaxNXbUyMCdjxvMvAoGBANRT\n"
+ "utbrqS/bAa/DcHKn3V6DRqBl3TDOfvCNjiKC84a67F2uXgzLIdMktr4d1NyCZVJd\n"
+ "7/zVgWORLIdg1eAi6rYGoOvNV39wwga7CF+m9sBY0wAaKYCELe6L26r4aQHVCX6n\n"
+ "rnIgUv+4o4itmU2iP0r3wlmDC9pDRQP82vfvQPlfAoGASwhleANW/quvq2HdViq8\n"
+ "Mje2HBalfhrRfpDTHK8JUBSFjTzuWG42GxJRtgVbb8x2ElujAKGDCaetMO5VSGu7\n"
+ "Fs5hw6iAFCpdXY0yhl+XUi2R8kwM2EPQ4lKO3jqkq0ClNmqn9a5jQWcCVt9yMLNS\n"
+ "fLbHeI8EpiCf34ngIcrLXNkCgYEAzlcEZuKkC46xB+dNew8pMTUwSKZVm53BfPKD\n"
+ "44QRN6imFbBjU9mAaJnwQbfp6dWKs834cGPolyM4++MeVfB42iZ88ksesgmZdUMD\n"
+ "szkl6O0pOJs0I+HQZVdjRbadDZvD22MHQ3+oST1dJ3FVXz3Cdo9qPuT8esMO6f4r\n"
+ "qfDH2s8CgYAXC/lWWHQ//PGP0pH4oiEXisx1K0X1u0xMGgrChxBRGRiKZUwNMIvJ\n"
+ "TqUu7IKizK19cLHF/NBvxHYHFw+m7puNjn6T1RtRCUjRZT7Dx1VHfVosL9ih5DA8\n"
+ "tpbZA5KGKcvHtB5DDgT0MHwzBZnb4Q//Rhovzn+HXZPsJTTgHHy3NQ==\n"
+ "-----END RSA PRIVATE KEY-----\n");
+
+ const QString newKeyString = QString("-----BEGIN OPENSSH PRIVATE KEY-----\n"
+ "b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABFwAAAAdzc2gtcn\n"
+ "NhAAAAAwEAAQAAAQEAsCHtJicDPWnvHSIKbnTZaJkIB9vgE0pmLdK580JUqBuonVbBy1QT\n"
+ "y0ZQ7/TtqvLPgwPK88TR46OLO/QGCzo2+XxgJ85uy0xfuyUYRmSuw0drsErNmH8vU91lSB\n"
+ "xsGDp9LtBbgHKoR23vMWZ34IxFRc55XphrIH48ijsMaL6bXBwF/3tD9T3lm2MpP1huyVNn\n"
+ "IY9+GRRWCy4f9LMj/UGu/n4RtwwfpOZBBRwYkq5QkzA9lPm/VzF3MP1rKTMkvAw+Nfb383\n"
+ "mkmc6MRnsa6uh6iDa9aVB7naegM13UJQX/PY1Ks6pOXDpy/MQ7iCh+HmYNq5dRmARyaNl9\n"
+ "xIXJNhz1cQAAA8DLsKINy7CiDQAAAAdzc2gtcnNhAAABAQCwIe0mJwM9ae8dIgpudNlomQ\n"
+ "gH2+ATSmYt0rnzQlSoG6idVsHLVBPLRlDv9O2q8s+DA8rzxNHjo4s79AYLOjb5fGAnzm7L\n"
+ "TF+7JRhGZK7DR2uwSs2Yfy9T3WVIHGwYOn0u0FuAcqhHbe8xZnfgjEVFznlemGsgfjyKOw\n"
+ "xovptcHAX/e0P1PeWbYyk/WG7JU2chj34ZFFYLLh/0syP9Qa7+fhG3DB+k5kEFHBiSrlCT\n"
+ "MD2U+b9XMXcw/WspMyS8DD419vfzeaSZzoxGexrq6HqINr1pUHudp6AzXdQlBf89jUqzqk\n"
+ "5cOnL8xDuIKH4eZg2rl1GYBHJo2X3Ehck2HPVxAAAAAwEAAQAAAQEApxFHNS1EMXjOSsAD\n"
+ "TQqhPkoKCApT3Xhwu35qy4dbbanuom+smwVBUUt9cl7NIZ33n7p1RAypWlfCtjedlADALJ\n"
+ "4BR0DUbxoepBFnmT3fV3PjffE2WzQo3E/gxinPjpvMKh+Q66HWZQquHBmqE+B5xOE41rWU\n"
+ "x9l161hfSOujyhVn9O9EeOJ78lXL2mYuKQtmJlEUT7hheitYinR/MzOhxxtVBrtluoSzZ/\n"
+ "itNSLpRtC2/HljWjWDJrUFmscqeyNiFpJHnFLN5wrokW8hTqKJgo3YfK/cmRb8MYxlIYLZ\n"
+ "ACzfRglNDML3vrNdSAdoHr67jfqvf0Ho28n3ZiJYCwHk0QAAAIAXC/lWWHQ//PGP0pH4oi\n"
+ "EXisx1K0X1u0xMGgrChxBRGRiKZUwNMIvJTqUu7IKizK19cLHF/NBvxHYHFw+m7puNjn6T\n"
+ "1RtRCUjRZT7Dx1VHfVosL9ih5DA8tpbZA5KGKcvHtB5DDgT0MHwzBZnb4Q//Rhovzn+HXZ\n"
+ "PsJTTgHHy3NQAAAIEA1FxXNb0Jh6hsJ/5T2EokUQ66vxc74naZMxoQsDQSNalMkUB4hPsp\n"
+ "5GkJEbj+85KSXHFEXq8/UQAIDhn7kGU34VOKkcez5tISCqQ9mKIA0Mftmi3kiq/WrR9HKV\n"
+ "01Fk1krsNanTwE81VYYD8ScS4omJRHGfEFrE1dtTIwJ2PG8y8AAACBANRTutbrqS/bAa/D\n"
+ "cHKn3V6DRqBl3TDOfvCNjiKC84a67F2uXgzLIdMktr4d1NyCZVJd7/zVgWORLIdg1eAi6r\n"
+ "YGoOvNV39wwga7CF+m9sBY0wAaKYCELe6L26r4aQHVCX6nrnIgUv+4o4itmU2iP0r3wlmD\n"
+ "C9pDRQP82vfvQPlfAAAABmlkX3JzYQECAwQ=\n"
+ "-----END OPENSSH PRIVATE KEY-----\n");
const QByteArray oldKeyData = oldKeyString.toLatin1();
const QByteArray newKeyData = newKeyString.toLatin1();
@@ -294,38 +288,36 @@ void TestOpenSSHKey::testDecryptOpenSSHAES256CBC()
void TestOpenSSHKey::testDecryptRSAAES256CBC()
{
- const QString keyString = QString(
- "-----BEGIN RSA PRIVATE KEY-----\n"
- "Proc-Type: 4,ENCRYPTED\n"
- "DEK-Info: AES-256-CBC,D51E3F558B621BD9384627762CBD16AC\n"
- "\n"
- "b6nr/06Gj8/Nw3ZFMePFyZeuBodExvZZtZPSH3t/2ArcxXOkoqUhLmlcY/JrvnBF\n"
- "JHc34wx/6Yng7mqtUMuk2iMemTzOj3JRx8zHUhwPLnjM/tmeOm0wBUb3WB4+rFZW\n"
- "s1PaIgeKywKgFK0UkcSRpMuSaxheWmHrtJkBsHTF7Tg3ogPL8Dc+nhQlbe/ZGaQb\n"
- "vMdSYcBMaXngS5ZiOafXeY8+l+IMMOZwy5vPTFQGqKHIzOxFhShs1hSExnwOXy69\n"
- "wxrA/QftjNEy5ixIeGT7iQfRB04tEVg0DjYphTPmI2ophzFlwJVBjhj2cmmnsMZg\n"
- "a2TdT/78KZsw2cA5ieMcU6d7Yz5p5nu5dyTbZonn6qWficdZRJwZnVb5ikPnJYbZ\n"
- "1YJRHHND+RWtpanxz7WhStscTCLeI9w9j2gqBJSjKDPgJaoMiA+tyEoakNlPYg+9\n"
- "DadJkBGP0g5E9zw0n4niqQ7eCxk7qolmW6Wtn2zL4UyeJKGi9NWFSGW9x/PmAIse\n"
- "E2KVodiJMRNa8/qUZcW58ZG2uRnFTsW4BXdmzOy/Zp53TVGWStBVLDcldSD03ItD\n"
- "JIWQWDgWp5xyVqPl+8mkW7xDY0GRVSJCyRkctQeGTGysy0BcNjgQQtiA3lPC0rY5\n"
- "m2VxrCYU1KuyHsAjs/V8THcW4a1UdPcVBg1QbCh29bMoM6u4MuXVt7rkwxAV9HJa\n"
- "VbwPsKy7V6G60KaAFIiOs0wdOzBZBoPGd9vBQOEzATh2FYJruDo2OfzEnhv25RxE\n"
- "1q+C/Jds9cWqaNY8kNtUG799XIKkjrC6KvnoV6UA4BkGs2DAcO9rnwtl/hToEoBe\n"
- "ZVj72dlTuS6l9rHqKaz2GI0k0SEt/ZoakPHeDRgPNcDvEZWitV8MuD6Mwb47Y88u\n"
- "sjBmS5k4sJOtB4bLg/UShcqYfkv2OTsK90qGQtba9vMk04Xh1FuxB4fHa5VoKrsX\n"
- "Th/LB34xoYugd16NPmLuawhSo70o4bT70GYpxnb4brGfjWiuthRdegAG9ESSX+M6\n"
- "rNKQPnn2GSroIpkoA4k0PaflcE5tpzeIiJdv0h65N3vw6MFnCaWy8sRSy9fMyRim\n"
- "U8QZB2jcp+YjUU/eny3scuh0Vqt6g1tfFbI84pCC5bArBirf63MeMtwDU/IVImax\n"
- "xzKOzl7k8ropA+rhAJ4Z9X35EmUncBXhf8g39w6nFuSlqjE6rMxCrsrehljQ1Iuz\n"
- "bujaJ2PKpf98OejHDKnMDOfBBq0DdeERCYWlCcqWSgrEgHh4vB5dEQAPP5bAkdZj\n"
- "m0Dq+gF99yadioxf3/MUZVTa1dHklBJJkXTYVPeyH07Th5j7bGCcVb9Zd2Ao/Dia\n"
- "MPWf6xViCC6d0njCLQY2R8mOR5OMVsdlFrsKZMQ/lqjS/WSM6URDkuGb0Cq94TQd\n"
- "7DoblcA50FTwYrVXMygWygbjzJxhcoJDHztzwoqLT/ghh+6zRg6R/fY222tHHbhz\n"
- "nePf421NILzfxnuW+GOwRCM5+IHE3OBS/PYDGijjRFHU4ky0rRRDE64m9CeFzeBh\n"
- "CnFvW6Yx3Hrh5tXBP7kRZ6KjyrPP7tI4ciVSJceSBLRzFmoBr10kRMm+VsUh2xZH\n"
- "-----END RSA PRIVATE KEY-----\n"
- );
+ const QString keyString = QString("-----BEGIN RSA PRIVATE KEY-----\n"
+ "Proc-Type: 4,ENCRYPTED\n"
+ "DEK-Info: AES-256-CBC,D51E3F558B621BD9384627762CBD16AC\n"
+ "\n"
+ "b6nr/06Gj8/Nw3ZFMePFyZeuBodExvZZtZPSH3t/2ArcxXOkoqUhLmlcY/JrvnBF\n"
+ "JHc34wx/6Yng7mqtUMuk2iMemTzOj3JRx8zHUhwPLnjM/tmeOm0wBUb3WB4+rFZW\n"
+ "s1PaIgeKywKgFK0UkcSRpMuSaxheWmHrtJkBsHTF7Tg3ogPL8Dc+nhQlbe/ZGaQb\n"
+ "vMdSYcBMaXngS5ZiOafXeY8+l+IMMOZwy5vPTFQGqKHIzOxFhShs1hSExnwOXy69\n"
+ "wxrA/QftjNEy5ixIeGT7iQfRB04tEVg0DjYphTPmI2ophzFlwJVBjhj2cmmnsMZg\n"
+ "a2TdT/78KZsw2cA5ieMcU6d7Yz5p5nu5dyTbZonn6qWficdZRJwZnVb5ikPnJYbZ\n"
+ "1YJRHHND+RWtpanxz7WhStscTCLeI9w9j2gqBJSjKDPgJaoMiA+tyEoakNlPYg+9\n"
+ "DadJkBGP0g5E9zw0n4niqQ7eCxk7qolmW6Wtn2zL4UyeJKGi9NWFSGW9x/PmAIse\n"
+ "E2KVodiJMRNa8/qUZcW58ZG2uRnFTsW4BXdmzOy/Zp53TVGWStBVLDcldSD03ItD\n"
+ "JIWQWDgWp5xyVqPl+8mkW7xDY0GRVSJCyRkctQeGTGysy0BcNjgQQtiA3lPC0rY5\n"
+ "m2VxrCYU1KuyHsAjs/V8THcW4a1UdPcVBg1QbCh29bMoM6u4MuXVt7rkwxAV9HJa\n"
+ "VbwPsKy7V6G60KaAFIiOs0wdOzBZBoPGd9vBQOEzATh2FYJruDo2OfzEnhv25RxE\n"
+ "1q+C/Jds9cWqaNY8kNtUG799XIKkjrC6KvnoV6UA4BkGs2DAcO9rnwtl/hToEoBe\n"
+ "ZVj72dlTuS6l9rHqKaz2GI0k0SEt/ZoakPHeDRgPNcDvEZWitV8MuD6Mwb47Y88u\n"
+ "sjBmS5k4sJOtB4bLg/UShcqYfkv2OTsK90qGQtba9vMk04Xh1FuxB4fHa5VoKrsX\n"
+ "Th/LB34xoYugd16NPmLuawhSo70o4bT70GYpxnb4brGfjWiuthRdegAG9ESSX+M6\n"
+ "rNKQPnn2GSroIpkoA4k0PaflcE5tpzeIiJdv0h65N3vw6MFnCaWy8sRSy9fMyRim\n"
+ "U8QZB2jcp+YjUU/eny3scuh0Vqt6g1tfFbI84pCC5bArBirf63MeMtwDU/IVImax\n"
+ "xzKOzl7k8ropA+rhAJ4Z9X35EmUncBXhf8g39w6nFuSlqjE6rMxCrsrehljQ1Iuz\n"
+ "bujaJ2PKpf98OejHDKnMDOfBBq0DdeERCYWlCcqWSgrEgHh4vB5dEQAPP5bAkdZj\n"
+ "m0Dq+gF99yadioxf3/MUZVTa1dHklBJJkXTYVPeyH07Th5j7bGCcVb9Zd2Ao/Dia\n"
+ "MPWf6xViCC6d0njCLQY2R8mOR5OMVsdlFrsKZMQ/lqjS/WSM6URDkuGb0Cq94TQd\n"
+ "7DoblcA50FTwYrVXMygWygbjzJxhcoJDHztzwoqLT/ghh+6zRg6R/fY222tHHbhz\n"
+ "nePf421NILzfxnuW+GOwRCM5+IHE3OBS/PYDGijjRFHU4ky0rRRDE64m9CeFzeBh\n"
+ "CnFvW6Yx3Hrh5tXBP7kRZ6KjyrPP7tI4ciVSJceSBLRzFmoBr10kRMm+VsUh2xZH\n"
+ "-----END RSA PRIVATE KEY-----\n");
const QByteArray keyData = keyString.toLatin1();
@@ -374,38 +366,36 @@ void TestOpenSSHKey::testDecryptOpenSSHAES256CTR()
void TestOpenSSHKey::testDecryptRSAAES256CTR()
{
- const QString keyString = QString(
- "-----BEGIN RSA PRIVATE KEY-----\n"
- "Proc-Type: 4,ENCRYPTED\n"
- "DEK-Info: AES-256-CTR,192421854316290DFA8F469A1E8CB9BB\n"
- "\n"
- "3h7gUWua+jcvhYj1vUusbMdOG9j8SmNWFV5Hfersi8nF4ddsWEQDnMrRuhtIn4tU\n"
- "GcLY+SXguim5XXwF8gG1tmvpvFMhudTfX+0cIAX7eAVmqLy2RTA18DWqDwWokVP0\n"
- "RJPgRJJSorjMtu2F0YGVVjElW7pHIal7luNk3BDgYUMlgSg0BGOWb+9BkXcEnfc8\n"
- "KEwsJw2onoR2eXo6rYnczGaqPhAPu+I+PfUn0J8PFiffWc1KebRntLdRWeNsBS4p\n"
- "oxtqByzMYIu/WPSJJ5iFoNdKaWQPiZJB+juwI1wNLEtpzKkhpc7/6mOy87h+0eGV\n"
- "fF7javrbHv37eE+k2iZXrcLfvRpiBqt5+uhhCaM8TivBeUho5J38ru/wt/dk+OvY\n"
- "tzXboWA4zVnaYmqta1CkXYKOmb5a8TWEwtxmAuE6kCz/n3pPa6gwkwsyGI65IEyX\n"
- "ycJsbwUilAzXTcz5bIruGx38Sa9fndAN9llOQMS/hdyNs5W5dO1XZ5gU+ARPce+j\n"
- "+A2R8oCUv+2ciEu8z3F++U9aTRmTlD3xeIM0IWUFXKt8Y9fSRC5XoPCbZYNxnV6/\n"
- "hn9NPKCb890Faxies3MABOB5IZ0aTPWkx9ntxFhMaXyfkX2YthNO0GzAENPP9Knt\n"
- "DYhQePlKQ7sNi8+wzsHNeDxNuL/+Rib2MN3ankDtHIsqFz/Em+rD0+3ya8bLy3pP\n"
- "eeUiNpezL+uxI5llq/pikzK4sOgvH1r5YEkMxt9I09grkBwxR7DMBo0vgRE2MLiL\n"
- "nlri8TDwArC1+0gE8NspkkClsBOHXuVlGZo5lup2tn5MzERQcLvuFnAby/GnaVXQ\n"
- "Hm76teb1wMdL58FrdZsKR6e80E+F6JpTsz0a3XJqptgAwGsoxqizkUNJG5hRP8bi\n"
- "NBCFQZPeYi/GxgN5O2UkxhgRkKAcrHg+G87nhLk1ipsc214rb6iOspNizP6fGDuv\n"
- "/bsNTpYRgMNxCLh5Nv0HSUqckoNKOcIVe/9nF5/LLFGfhz95agjKTbBygThFK28N\n"
- "bnHq5fO9yKCMrGCRBQ6No1wwexyS4IAq17LcQP3k4w4n+Wt2GjO5HIldGOEyGqCE\n"
- "zeHYrPpGXF/yf3XTm00XghdQtVtRJptdddXVGZN3EN2w7/ghOSIIlsJO9C4IRgU3\n"
- "WkhX7oOpSE4wmXd5Ada+D1U46snW5nWANWko2NmQNVDeJcvuymL6t2ccNYeFWiA+\n"
- "Hlv0avBnqng7ZWPxYacqZI3+vU0rN9usN1pzwY/4NsBa34o3M7u6KvzEkyewbyUT\n"
- "VfXLJ8XRzb2u4NqQv0WiTBIRxvVB1sRPcrwB4HWKHwRFT8T7f1fefteROrKV7aKm\n"
- "Q48pckidDM0ORh1yIET8u24Mreo5eeWXjVJ9MHoM0486VySYxMwk8yp4tnaHx5kd\n"
- "fGlBbbwFOifhzjAk0u3KJRAG85t2GZhfTMo1IHS2kdu4Xs1N00ZmK0hjeGG+DCwy\n"
- "06ZKHOF5BHWU3SpQEjCsPDwfIpOINWGAJJnp6NIVf7FkHwViV50GWWGSZal4NqZy\n"
- "kR19buHiOb7KnGoPCw8MUmIym8v30FePhM4YQ7ASmRtsXlAhQNRX\n"
- "-----END RSA PRIVATE KEY-----\n"
- );
+ const QString keyString = QString("-----BEGIN RSA PRIVATE KEY-----\n"
+ "Proc-Type: 4,ENCRYPTED\n"
+ "DEK-Info: AES-256-CTR,192421854316290DFA8F469A1E8CB9BB\n"
+ "\n"
+ "3h7gUWua+jcvhYj1vUusbMdOG9j8SmNWFV5Hfersi8nF4ddsWEQDnMrRuhtIn4tU\n"
+ "GcLY+SXguim5XXwF8gG1tmvpvFMhudTfX+0cIAX7eAVmqLy2RTA18DWqDwWokVP0\n"
+ "RJPgRJJSorjMtu2F0YGVVjElW7pHIal7luNk3BDgYUMlgSg0BGOWb+9BkXcEnfc8\n"
+ "KEwsJw2onoR2eXo6rYnczGaqPhAPu+I+PfUn0J8PFiffWc1KebRntLdRWeNsBS4p\n"
+ "oxtqByzMYIu/WPSJJ5iFoNdKaWQPiZJB+juwI1wNLEtpzKkhpc7/6mOy87h+0eGV\n"
+ "fF7javrbHv37eE+k2iZXrcLfvRpiBqt5+uhhCaM8TivBeUho5J38ru/wt/dk+OvY\n"
+ "tzXboWA4zVnaYmqta1CkXYKOmb5a8TWEwtxmAuE6kCz/n3pPa6gwkwsyGI65IEyX\n"
+ "ycJsbwUilAzXTcz5bIruGx38Sa9fndAN9llOQMS/hdyNs5W5dO1XZ5gU+ARPce+j\n"
+ "+A2R8oCUv+2ciEu8z3F++U9aTRmTlD3xeIM0IWUFXKt8Y9fSRC5XoPCbZYNxnV6/\n"
+ "hn9NPKCb890Faxies3MABOB5IZ0aTPWkx9ntxFhMaXyfkX2YthNO0GzAENPP9Knt\n"
+ "DYhQePlKQ7sNi8+wzsHNeDxNuL/+Rib2MN3ankDtHIsqFz/Em+rD0+3ya8bLy3pP\n"
+ "eeUiNpezL+uxI5llq/pikzK4sOgvH1r5YEkMxt9I09grkBwxR7DMBo0vgRE2MLiL\n"
+ "nlri8TDwArC1+0gE8NspkkClsBOHXuVlGZo5lup2tn5MzERQcLvuFnAby/GnaVXQ\n"
+ "Hm76teb1wMdL58FrdZsKR6e80E+F6JpTsz0a3XJqptgAwGsoxqizkUNJG5hRP8bi\n"
+ "NBCFQZPeYi/GxgN5O2UkxhgRkKAcrHg+G87nhLk1ipsc214rb6iOspNizP6fGDuv\n"
+ "/bsNTpYRgMNxCLh5Nv0HSUqckoNKOcIVe/9nF5/LLFGfhz95agjKTbBygThFK28N\n"
+ "bnHq5fO9yKCMrGCRBQ6No1wwexyS4IAq17LcQP3k4w4n+Wt2GjO5HIldGOEyGqCE\n"
+ "zeHYrPpGXF/yf3XTm00XghdQtVtRJptdddXVGZN3EN2w7/ghOSIIlsJO9C4IRgU3\n"
+ "WkhX7oOpSE4wmXd5Ada+D1U46snW5nWANWko2NmQNVDeJcvuymL6t2ccNYeFWiA+\n"
+ "Hlv0avBnqng7ZWPxYacqZI3+vU0rN9usN1pzwY/4NsBa34o3M7u6KvzEkyewbyUT\n"
+ "VfXLJ8XRzb2u4NqQv0WiTBIRxvVB1sRPcrwB4HWKHwRFT8T7f1fefteROrKV7aKm\n"
+ "Q48pckidDM0ORh1yIET8u24Mreo5eeWXjVJ9MHoM0486VySYxMwk8yp4tnaHx5kd\n"
+ "fGlBbbwFOifhzjAk0u3KJRAG85t2GZhfTMo1IHS2kdu4Xs1N00ZmK0hjeGG+DCwy\n"
+ "06ZKHOF5BHWU3SpQEjCsPDwfIpOINWGAJJnp6NIVf7FkHwViV50GWWGSZal4NqZy\n"
+ "kR19buHiOb7KnGoPCw8MUmIym8v30FePhM4YQ7ASmRtsXlAhQNRX\n"
+ "-----END RSA PRIVATE KEY-----\n");
const QByteArray keyData = keyString.toLatin1();
@@ -422,16 +412,14 @@ void TestOpenSSHKey::testDecryptRSAAES256CTR()
void TestOpenSSHKey::testDecryptUTF8()
{
- const QString keyString = QString(
- "-----BEGIN OPENSSH PRIVATE KEY-----\n"
- "b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABDtSl4OvT\n"
- "H/wHay2dvjOnpIAAAAEAAAAAEAAAAzAAAAC3NzaC1lZDI1NTE5AAAAIIhrBrn6rb+d3GwF\n"
- "ifpJ6gYut95lXvwypiQmu9ZpA8H9AAAAsD85Gpn2mbVEWq3ygx11wBnN5mUQXnMuP48rLv\n"
- "0qwm12IihOkrR925ledwN2Sa5mkkL0XjDz6SsKfIFhFa84hUHQdw5zPR8yVGRWLzkNDmo7\n"
- "WXNpnoE4ebsX2j0TsBNjP80RUcJdjSXidkt3+aZjaCfquO8cBQn4GJJSDSPwFJYlJeSD/h\n"
- "vpb72MEQchOD3NNMORYTJ5sOJ73RayhhmwjTVlrG+zYAw6fXW0YXX3+5LE\n"
- "-----END OPENSSH PRIVATE KEY-----\n"
- );
+ const QString keyString = QString("-----BEGIN OPENSSH PRIVATE KEY-----\n"
+ "b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABDtSl4OvT\n"
+ "H/wHay2dvjOnpIAAAAEAAAAAEAAAAzAAAAC3NzaC1lZDI1NTE5AAAAIIhrBrn6rb+d3GwF\n"
+ "ifpJ6gYut95lXvwypiQmu9ZpA8H9AAAAsD85Gpn2mbVEWq3ygx11wBnN5mUQXnMuP48rLv\n"
+ "0qwm12IihOkrR925ledwN2Sa5mkkL0XjDz6SsKfIFhFa84hUHQdw5zPR8yVGRWLzkNDmo7\n"
+ "WXNpnoE4ebsX2j0TsBNjP80RUcJdjSXidkt3+aZjaCfquO8cBQn4GJJSDSPwFJYlJeSD/h\n"
+ "vpb72MEQchOD3NNMORYTJ5sOJ73RayhhmwjTVlrG+zYAw6fXW0YXX3+5LE\n"
+ "-----END OPENSSH PRIVATE KEY-----\n");
const QByteArray keyData = keyString.toLatin1();
diff --git a/tests/TestPasswordGenerator.cpp b/tests/TestPasswordGenerator.cpp
index 53cf25c31..b043a7cd0 100644
--- a/tests/TestPasswordGenerator.cpp
+++ b/tests/TestPasswordGenerator.cpp
@@ -19,8 +19,8 @@
#include "core/PasswordGenerator.h"
#include "crypto/Crypto.h"
-#include <QTest>
#include <QRegularExpression>
+#include <QTest>
QTEST_GUILESS_MAIN(TestPasswordGenerator)
@@ -89,14 +89,14 @@ void TestPasswordGenerator::testCharClasses()
regex.setPattern(R"(^[^a-zA-Z0-9\.,:;"'\-/\\_|!\*\+\-<=>\?#`~%&^$@]+$)");
QVERIFY(regex.match(password).hasMatch());
- generator.setCharClasses(PasswordGenerator::CharClass::LowerLetters
- | PasswordGenerator::CharClass::UpperLetters | PasswordGenerator::CharClass::Braces);
+ generator.setCharClasses(PasswordGenerator::CharClass::LowerLetters | PasswordGenerator::CharClass::UpperLetters
+ | PasswordGenerator::CharClass::Braces);
password = generator.generatePassword();
regex.setPattern(R"(^[a-zA-Z\(\)\[\]\{\}]+$)");
QVERIFY(regex.match(password).hasMatch());
- generator.setCharClasses(PasswordGenerator::CharClass::Quotes
- | PasswordGenerator::CharClass::Numbers | PasswordGenerator::CharClass::Dashes);
+ generator.setCharClasses(PasswordGenerator::CharClass::Quotes | PasswordGenerator::CharClass::Numbers
+ | PasswordGenerator::CharClass::Dashes);
password = generator.generatePassword();
regex.setPattern(R"(^["'\d\-/\\_|]+$)");
QVERIFY(regex.match(password).hasMatch());
@@ -116,15 +116,14 @@ void TestPasswordGenerator::testLookalikeExclusion()
QRegularExpression regex("^[^lI0]+$");
QVERIFY(regex.match(password).hasMatch());
- generator.setCharClasses(PasswordGenerator::CharClass::LowerLetters |
- PasswordGenerator::CharClass::UpperLetters | PasswordGenerator::CharClass::Numbers);
+ generator.setCharClasses(PasswordGenerator::CharClass::LowerLetters | PasswordGenerator::CharClass::UpperLetters
+ | PasswordGenerator::CharClass::Numbers);
password = generator.generatePassword();
regex.setPattern("^[^lI01]+$");
QVERIFY(regex.match(password).hasMatch());
- generator.setCharClasses(PasswordGenerator::CharClass::LowerLetters
- | PasswordGenerator::CharClass::UpperLetters | PasswordGenerator::CharClass::Numbers
- | PasswordGenerator::CharClass::EASCII);
+ generator.setCharClasses(PasswordGenerator::CharClass::LowerLetters | PasswordGenerator::CharClass::UpperLetters
+ | PasswordGenerator::CharClass::Numbers | PasswordGenerator::CharClass::EASCII);
password = generator.generatePassword();
regex.setPattern("^[^lI01﹒]+$");
QVERIFY(regex.match(password).hasMatch());
diff --git a/tests/TestPasswordGenerator.h b/tests/TestPasswordGenerator.h
index 5287e5bde..56c4d65a1 100644
--- a/tests/TestPasswordGenerator.h
+++ b/tests/TestPasswordGenerator.h
@@ -30,4 +30,4 @@ private slots:
void testLookalikeExclusion();
};
-#endif //KEEPASSXC_TESTPASSWORDGENERATOR_H
+#endif // KEEPASSXC_TESTPASSWORDGENERATOR_H
diff --git a/tests/TestSymmetricCipher.cpp b/tests/TestSymmetricCipher.cpp
index b69e463b1..752fc09df 100644
--- a/tests/TestSymmetricCipher.cpp
+++ b/tests/TestSymmetricCipher.cpp
@@ -44,6 +44,7 @@ void TestSymmetricCipher::testAlgorithmToCipher()
QCOMPARE(SymmetricCipher::algorithmToCipher(SymmetricCipher::Algorithm::InvalidAlgorithm), QUuid());
}
+// clang-format off
void TestSymmetricCipher::testEncryptionDecryption_data()
{
QTest::addColumn<SymmetricCipher::Algorithm>("algorithm");
@@ -109,6 +110,7 @@ void TestSymmetricCipher::testEncryptionDecryption_data()
<< QByteArray::fromHex("601ec313775789a5b7a7f504bbf3d228f443e3ca4d62b59aca84e990cacaf5c5")
<< QByteArray::fromHex("6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e51");
}
+// clang-format on
void TestSymmetricCipher::testEncryptionDecryption()
{
@@ -165,19 +167,17 @@ void TestSymmetricCipher::testAesCbcPadding_data()
QTest::addColumn<QByteArray>("plainText");
QTest::addColumn<QByteArray>("padding");
- QTest::newRow("AES128")
- << QByteArray::fromHex("2b7e151628aed2a6abf7158809cf4f3c")
- << QByteArray::fromHex("000102030405060708090a0b0c0d0e0f")
- << QByteArray::fromHex("7649abac8119b246cee98e9b12e9197d5086cb9b507219ee95db113a917678b2")
- << QByteArray::fromHex("6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e51")
- << QByteArray::fromHex("55e21d7100b988ffec32feeafaf23538");
-
- QTest::newRow("AES256")
- << QByteArray::fromHex("603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4")
- << QByteArray::fromHex("000102030405060708090a0b0c0d0e0f")
- << QByteArray::fromHex("f58c4c04d6e5f1ba779eabfb5f7bfbd69cfc4e967edb808d679f777bc6702c7d")
- << QByteArray::fromHex("6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e51")
- << QByteArray::fromHex("3a3aa5e0213db1a9901f9036cf5102d2");
+ QTest::newRow("AES128") << QByteArray::fromHex("2b7e151628aed2a6abf7158809cf4f3c")
+ << QByteArray::fromHex("000102030405060708090a0b0c0d0e0f")
+ << QByteArray::fromHex("7649abac8119b246cee98e9b12e9197d5086cb9b507219ee95db113a917678b2")
+ << QByteArray::fromHex("6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e51")
+ << QByteArray::fromHex("55e21d7100b988ffec32feeafaf23538");
+
+ QTest::newRow("AES256") << QByteArray::fromHex("603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4")
+ << QByteArray::fromHex("000102030405060708090a0b0c0d0e0f")
+ << QByteArray::fromHex("f58c4c04d6e5f1ba779eabfb5f7bfbd69cfc4e967edb808d679f777bc6702c7d")
+ << QByteArray::fromHex("6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e51")
+ << QByteArray::fromHex("3a3aa5e0213db1a9901f9036cf5102d2");
}
void TestSymmetricCipher::testAesCbcPadding()
@@ -215,17 +215,16 @@ void TestSymmetricCipher::testInplaceEcb_data()
QTest::addColumn<QByteArray>("plainText");
QTest::addColumn<QByteArray>("cipherText");
- QTest::newRow("AES128")
- << QByteArray::fromHex("2b7e151628aed2a6abf7158809cf4f3c")
- << QByteArray::fromHex("6bc1bee22e409f96e93d7e117393172a")
- << QByteArray::fromHex("3ad77bb40d7a3660a89ecaf32466ef97");
+ QTest::newRow("AES128") << QByteArray::fromHex("2b7e151628aed2a6abf7158809cf4f3c")
+ << QByteArray::fromHex("6bc1bee22e409f96e93d7e117393172a")
+ << QByteArray::fromHex("3ad77bb40d7a3660a89ecaf32466ef97");
}
void TestSymmetricCipher::testInplaceEcb()
{
- QFETCH(QByteArray, key);
- QFETCH(QByteArray, plainText);
- QFETCH(QByteArray, cipherText);
+ QFETCH(QByteArray, key);
+ QFETCH(QByteArray, plainText);
+ QFETCH(QByteArray, cipherText);
SymmetricCipher cipherInPlaceEnc(SymmetricCipher::Aes128, SymmetricCipher::Ecb, SymmetricCipher::Encrypt);
QVERIFY(cipherInPlaceEnc.init(key, QByteArray(16, 0)));
diff --git a/tests/TestTools.cpp b/tests/TestTools.cpp
index c3acd3c6d..de5a80c0a 100644
--- a/tests/TestTools.cpp
+++ b/tests/TestTools.cpp
@@ -28,7 +28,7 @@ namespace
{
return wholes + QLocale().decimalPoint() + fractions + " " + unit;
}
-}
+} // namespace
void TestTools::testHumanReadableFileSize()
{
diff --git a/tests/gui/TestGui.cpp b/tests/gui/TestGui.cpp
index 48c308243..3fa8df09a 100644
--- a/tests/gui/TestGui.cpp
+++ b/tests/gui/TestGui.cpp
@@ -49,12 +49,7 @@
#include "crypto/Crypto.h"
#include "crypto/kdf/AesKdf.h"
#include "format/KeePass2Reader.h"
-#include "keys/PasswordKey.h"
-#include "keys/FileKey.h"
#include "gui/ApplicationSettingsWidget.h"
-#include "gui/dbsettings/DatabaseSettingsDialog.h"
-#include "gui/masterkey/PasswordEditWidget.h"
-#include "gui/masterkey/KeyFileEditWidget.h"
#include "gui/CategoryListWidget.h"
#include "gui/CloneDialog.h"
#include "gui/DatabaseTabWidget.h"
@@ -63,15 +58,19 @@
#include "gui/MessageBox.h"
#include "gui/PasswordEdit.h"
#include "gui/SearchWidget.h"
-#include "gui/TotpSetupDialog.h"
#include "gui/TotpDialog.h"
+#include "gui/TotpSetupDialog.h"
+#include "gui/dbsettings/DatabaseSettingsDialog.h"
#include "gui/entry/EditEntryWidget.h"
#include "gui/entry/EntryView.h"
#include "gui/group/EditGroupWidget.h"
#include "gui/group/GroupModel.h"
#include "gui/group/GroupView.h"
-#include "gui/wizard/NewDatabaseWizard.h"
#include "gui/masterkey/KeyComponentWidget.h"
+#include "gui/masterkey/KeyFileEditWidget.h"
+#include "gui/masterkey/PasswordEditWidget.h"
+#include "gui/wizard/NewDatabaseWizard.h"
+#include "keys/FileKey.h"
#include "keys/PasswordKey.h"
QTEST_MAIN(TestGui)
@@ -159,7 +158,7 @@ void TestGui::testSettingsDefaultTabOrder()
auto* settingsWidget = m_mainWindow->findChild<ApplicationSettingsWidget*>();
QVERIFY(settingsWidget->isVisible());
QCOMPARE(settingsWidget->findChild<CategoryListWidget*>("categoryList")->currentCategory(), 0);
- for (auto* w: settingsWidget->findChildren<QTabWidget*>()) {
+ for (auto* w : settingsWidget->findChildren<QTabWidget*>()) {
if (w->currentIndex() != 0) {
QFAIL("Application settings contain QTabWidgets whose default index is not 0");
}
@@ -171,7 +170,7 @@ void TestGui::testSettingsDefaultTabOrder()
auto* dbSettingsWidget = m_mainWindow->findChild<DatabaseSettingsDialog*>();
QVERIFY(dbSettingsWidget->isVisible());
QCOMPARE(dbSettingsWidget->findChild<CategoryListWidget*>("categoryList")->currentCategory(), 0);
- for (auto* w: dbSettingsWidget->findChildren<QTabWidget*>()) {
+ for (auto* w : dbSettingsWidget->findChildren<QTabWidget*>()) {
if (w->currentIndex() != 0) {
QFAIL("Database settings contain QTabWidgets whose default index is not 0");
}
@@ -1091,7 +1090,11 @@ void TestGui::testDragAndDropGroup()
// dropping parent on child is supposed to fail
dragAndDropGroup(groupModel->index(0, 0, rootIndex),
- groupModel->index(0, 0, groupModel->index(0, 0, rootIndex)), -1, false, "NewDatabase", 0);
+ groupModel->index(0, 0, groupModel->index(0, 0, rootIndex)),
+ -1,
+ false,
+ "NewDatabase",
+ 0);
dragAndDropGroup(groupModel->index(1, 0, rootIndex), rootIndex, 0, true, "NewDatabase", 0);
diff --git a/tests/mock/MockChallengeResponseKey.cpp b/tests/mock/MockChallengeResponseKey.cpp
index 628504d85..1fa79dc84 100644
--- a/tests/mock/MockChallengeResponseKey.cpp
+++ b/tests/mock/MockChallengeResponseKey.cpp
@@ -13,7 +13,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ */
#include "MockChallengeResponseKey.h"
diff --git a/tests/mock/MockChallengeResponseKey.h b/tests/mock/MockChallengeResponseKey.h
index 1ef11bf60..a9aeeb412 100644
--- a/tests/mock/MockChallengeResponseKey.h
+++ b/tests/mock/MockChallengeResponseKey.h
@@ -13,7 +13,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ */
#ifndef KEEPASSXC_MOCKCHALLENGERESPONSEKEY_H
#define KEEPASSXC_MOCKCHALLENGERESPONSEKEY_H
diff --git a/tests/util/TemporaryFile.h b/tests/util/TemporaryFile.h
index 4e39a9ae7..1fca110a5 100644
--- a/tests/util/TemporaryFile.h
+++ b/tests/util/TemporaryFile.h
@@ -47,4 +47,4 @@ public:
#endif
};
-#endif //KEEPASSXC_TEMPORARYFILE_H
+#endif // KEEPASSXC_TEMPORARYFILE_H