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
path: root/src
diff options
context:
space:
mode:
authorJonathan White <support@dmapps.us>2019-01-20 17:50:20 +0300
committerJonathan White <support@dmapps.us>2019-01-29 06:38:59 +0300
commit7e1b16250c8a3b7854030c86af941d0b83d4a0b9 (patch)
tree83fe30abc4e1e22f6ae5891cb2bf354e0dc90260 /src
parentc74664097b010b1c463011ec6ea07fd5c392a178 (diff)
Performed project-wide code formatting
* Updated format CMake command to properly ignore new directories and files * Added output when command is run * Resolves #2623
Diffstat (limited to 'src')
-rw-r--r--src/browser/BrowserService.cpp50
-rw-r--r--src/browser/BrowserService.h5
-rw-r--r--src/cli/Command.cpp9
-rw-r--r--src/cli/Create.cpp2
-rw-r--r--src/cli/Extract.cpp6
-rw-r--r--src/cli/Utils.cpp101
-rw-r--r--src/cli/Utils.h6
-rw-r--r--src/core/Bootstrap.cpp11
-rw-r--r--src/core/Database.cpp2
-rw-r--r--src/core/Database.h11
-rw-r--r--src/core/Entry.cpp14
-rw-r--r--src/core/EntrySearcher.cpp20
-rw-r--r--src/core/EntrySearcher.h7
-rw-r--r--src/core/FileWatcher.cpp10
-rw-r--r--src/core/FileWatcher.h11
-rw-r--r--src/core/Group.cpp49
-rw-r--r--src/core/ScreenLockListenerMac.cpp8
-rw-r--r--src/core/ScreenLockListenerMac.h10
-rw-r--r--src/core/TimeInfo.cpp2
-rw-r--r--src/core/Tools.cpp11
-rw-r--r--src/core/Translator.cpp3
-rw-r--r--src/crypto/ssh/ASN1Key.h2
-rw-r--r--src/crypto/ssh/OpenSSHKey.cpp108
-rw-r--r--src/format/Kdbx4Reader.cpp2
-rw-r--r--src/format/KdbxXmlWriter.h2
-rw-r--r--src/format/KeePass1Reader.cpp12
-rw-r--r--src/format/KeePass2Writer.cpp4
-rw-r--r--src/gui/AboutDialog.cpp12
-rw-r--r--src/gui/ApplicationSettingsWidget.cpp4
-rw-r--r--src/gui/DatabaseOpenWidget.cpp8
-rw-r--r--src/gui/DatabaseTabWidget.cpp16
-rw-r--r--src/gui/DatabaseTabWidget.h4
-rw-r--r--src/gui/DatabaseWidget.cpp113
-rw-r--r--src/gui/DatabaseWidget.h1
-rw-r--r--src/gui/EditWidgetIcons.cpp3
-rw-r--r--src/gui/EditWidgetProperties.cpp6
-rw-r--r--src/gui/EntryPreviewWidget.cpp11
-rw-r--r--src/gui/FileDialog.cpp3
-rw-r--r--src/gui/FileDialog.h4
-rw-r--r--src/gui/MainWindowAdaptor.cpp17
-rw-r--r--src/gui/MainWindowAdaptor.h56
-rw-r--r--src/gui/MessageBox.cpp70
-rw-r--r--src/gui/MessageBox.h67
-rw-r--r--src/gui/SearchWidget.cpp6
-rw-r--r--src/gui/WelcomeWidget.cpp5
-rw-r--r--src/gui/WelcomeWidget.h2
-rw-r--r--src/gui/dbsettings/DatabaseSettingsDialog.cpp7
-rw-r--r--src/gui/dbsettings/DatabaseSettingsWidgetBrowser.cpp24
-rw-r--r--src/gui/entry/EditEntryWidget.cpp19
-rw-r--r--src/gui/entry/EditEntryWidget.h7
-rw-r--r--src/gui/entry/EntryAttachmentsWidget.cpp7
-rw-r--r--src/gui/entry/EntryModel.cpp4
-rw-r--r--src/gui/group/EditGroupWidget.cpp16
-rw-r--r--src/gui/widgets/PopupHelpWidget.h5
-rw-r--r--src/gui/wizard/NewDatabaseWizard.cpp2
-rw-r--r--src/keeshare/ShareObserver.cpp8
-rw-r--r--src/keys/YkChallengeResponseKey.cpp5
-rw-r--r--src/keys/drivers/YubiKey.cpp2
-rw-r--r--src/sshagent/SSHAgent.cpp8
-rw-r--r--src/sshagent/SSHAgent.h4
60 files changed, 521 insertions, 483 deletions
diff --git a/src/browser/BrowserService.cpp b/src/browser/BrowserService.cpp
index a1ea5d684..e84a1dadb 100644
--- a/src/browser/BrowserService.cpp
+++ b/src/browser/BrowserService.cpp
@@ -77,7 +77,8 @@ bool BrowserService::isDatabaseOpened() const
return false;
}
- return dbWidget->currentMode() == DatabaseWidget::Mode::ViewMode || dbWidget->currentMode() == DatabaseWidget::Mode::EditMode;
+ return dbWidget->currentMode() == DatabaseWidget::Mode::ViewMode
+ || dbWidget->currentMode() == DatabaseWidget::Mode::EditMode;
}
bool BrowserService::openDatabase(bool triggerUnlock)
@@ -91,7 +92,8 @@ bool BrowserService::openDatabase(bool triggerUnlock)
return false;
}
- if (dbWidget->currentMode() == DatabaseWidget::Mode::ViewMode || dbWidget->currentMode() == DatabaseWidget::Mode::EditMode) {
+ if (dbWidget->currentMode() == DatabaseWidget::Mode::ViewMode
+ || dbWidget->currentMode() == DatabaseWidget::Mode::EditMode) {
return true;
}
@@ -114,7 +116,8 @@ void BrowserService::lockDatabase()
return;
}
- if (dbWidget->currentMode() == DatabaseWidget::Mode::ViewMode || dbWidget->currentMode() == DatabaseWidget::Mode::EditMode) {
+ if (dbWidget->currentMode() == DatabaseWidget::Mode::ViewMode
+ || dbWidget->currentMode() == DatabaseWidget::Mode::EditMode) {
dbWidget->lock();
}
}
@@ -289,9 +292,12 @@ QJsonArray BrowserService::findMatchingEntries(const QString& id,
return result;
}
-void BrowserService::addEntry(const QString& id, const QString& login,
- const QString& password, const QString& url,
- const QString& submitUrl, const QString& realm,
+void BrowserService::addEntry(const QString& id,
+ const QString& login,
+ const QString& password,
+ const QString& url,
+ const QString& submitUrl,
+ const QString& realm,
QSharedPointer<Database> selectedDb)
{
if (thread() != QThread::currentThread()) {
@@ -392,12 +398,13 @@ void BrowserService::updateEntry(const QString& id,
MessageBox::Button dialogResult = MessageBox::No;
if (!browserSettings()->alwaysAllowUpdate()) {
raiseWindow();
- dialogResult = MessageBox::question(nullptr,
- tr("KeePassXC: Update Entry"),
- tr("Do you want to update the information in %1 - %2?")
- .arg(QUrl(url).host(), username),
- MessageBox::Save | MessageBox::Cancel,
- MessageBox::Cancel, MessageBox::Raise);
+ dialogResult = MessageBox::question(
+ nullptr,
+ tr("KeePassXC: Update Entry"),
+ tr("Do you want to update the information in %1 - %2?").arg(QUrl(url).host(), username),
+ MessageBox::Save | MessageBox::Cancel,
+ MessageBox::Cancel,
+ MessageBox::Raise);
}
if (browserSettings()->alwaysAllowUpdate() || dialogResult == MessageBox::Save) {
@@ -453,7 +460,7 @@ QList<Entry*> BrowserService::searchEntries(const QString& url, const StringPair
for (int i = 0; i < count; ++i) {
if (auto* dbWidget = qobject_cast<DatabaseWidget*>(m_dbTabWidget->widget(i))) {
if (const auto& db = dbWidget->database()) {
- // Check if database is connected with KeePassXC-Browser
+ // 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);
@@ -680,10 +687,7 @@ QJsonObject BrowserService::prepareEntry(const Entry* entry)
}
BrowserService::Access
-BrowserService::checkAccess(const Entry* entry,
- const QString& host,
- const QString& submitHost,
- const QString& realm)
+BrowserService::checkAccess(const Entry* entry, const QString& host, const QString& submitHost, const QString& realm)
{
BrowserEntryConfig config;
if (!config.load(entry)) {
@@ -841,12 +845,12 @@ QSharedPointer<Database> BrowserService::getDatabase()
QSharedPointer<Database> BrowserService::selectedDatabase()
{
QList<DatabaseWidget*> databaseWidgets;
- for (int i = 0; ; ++i) {
+ for (int i = 0;; ++i) {
auto* dbWidget = m_dbTabWidget->databaseWidgetFromIndex(i);
// Add only open databases
- if (dbWidget && dbWidget->database()->hasKey() &&
- (dbWidget->currentMode() == DatabaseWidget::Mode::ViewMode ||
- dbWidget->currentMode() == DatabaseWidget::Mode::EditMode)) {
+ if (dbWidget && dbWidget->database()->hasKey()
+ && (dbWidget->currentMode() == DatabaseWidget::Mode::ViewMode
+ || dbWidget->currentMode() == DatabaseWidget::Mode::EditMode)) {
databaseWidgets.push_back(dbWidget);
continue;
}
@@ -919,8 +923,8 @@ bool BrowserService::checkLegacySettings()
bool legacySettingsFound = false;
QList<Entry*> entries = db->rootGroup()->entriesRecursive();
for (const auto& e : entries) {
- if ((e->attributes()->contains(KEEPASSHTTP_NAME) || e->attributes()->contains(KEEPASSXCBROWSER_NAME)) ||
- (e->title() == KEEPASSHTTP_NAME || e->title().contains(KEEPASSXCBROWSER_NAME, Qt::CaseInsensitive))) {
+ if ((e->attributes()->contains(KEEPASSHTTP_NAME) || e->attributes()->contains(KEEPASSXCBROWSER_NAME))
+ || (e->title() == KEEPASSHTTP_NAME || e->title().contains(KEEPASSXCBROWSER_NAME, Qt::CaseInsensitive))) {
legacySettingsFound = true;
break;
}
diff --git a/src/browser/BrowserService.h b/src/browser/BrowserService.h
index 8e1c45f4a..3ec839563 100644
--- a/src/browser/BrowserService.h
+++ b/src/browser/BrowserService.h
@@ -102,10 +102,7 @@ private:
const QString& submitHost,
const QString& realm);
QJsonObject prepareEntry(const Entry* entry);
- Access checkAccess(const Entry* entry,
- const QString& host,
- const QString& submitHost,
- const QString& realm);
+ Access checkAccess(const Entry* entry, const QString& host, const QString& submitHost, const QString& realm);
Group* findCreateAddEntryGroup(QSharedPointer<Database> selectedDb = {});
int
sortPriority(const Entry* entry, const QString& host, const QString& submitUrl, const QString& baseSubmitUrl) const;
diff --git a/src/cli/Command.cpp b/src/cli/Command.cpp
index 2d34770ac..79d56c360 100644
--- a/src/cli/Command.cpp
+++ b/src/cli/Command.cpp
@@ -41,11 +41,10 @@ const QCommandLineOption Command::QuietOption =
<< "quiet",
QObject::tr("Silence password prompt and other secondary outputs."));
-const QCommandLineOption Command::KeyFileOption =
- QCommandLineOption(QStringList() << "k"
- << "key-file",
- QObject::tr("Key file of the database."),
- QObject::tr("path"));
+const QCommandLineOption Command::KeyFileOption = QCommandLineOption(QStringList() << "k"
+ << "key-file",
+ QObject::tr("Key file of the database."),
+ QObject::tr("path"));
QMap<QString, Command*> commands;
diff --git a/src/cli/Create.cpp b/src/cli/Create.cpp
index 9bea1f9eb..39aca63b6 100644
--- a/src/cli/Create.cpp
+++ b/src/cli/Create.cpp
@@ -88,7 +88,7 @@ int Create::execute(const QStringList& arguments)
}
QSharedPointer<FileKey> fileKey;
- if(parser.isSet(Command::KeyFileOption)) {
+ if (parser.isSet(Command::KeyFileOption)) {
if (!loadFileKey(parser.value(Command::KeyFileOption), fileKey)) {
err << QObject::tr("Loading the key file failed") << endl;
return EXIT_FAILURE;
diff --git a/src/cli/Extract.cpp b/src/cli/Extract.cpp
index d7099cd52..be5abb920 100644
--- a/src/cli/Extract.cpp
+++ b/src/cli/Extract.cpp
@@ -83,9 +83,9 @@ int Extract::execute(const QStringList& arguments)
if (fileKey->type() != FileKey::Hashed) {
errorTextStream << 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;
+ "unsupported in the future.\n\n"
+ "Please consider generating a new key file.")
+ << endl;
}
// LCOV_EXCL_STOP
diff --git a/src/cli/Utils.cpp b/src/cli/Utils.cpp
index a1513a7f8..aac4e38c2 100644
--- a/src/cli/Utils.cpp
+++ b/src/cli/Utils.cpp
@@ -47,14 +47,13 @@ namespace Utils
* DEVNULL file handle for the CLI.
*/
#ifdef Q_OS_WIN
-FILE* DEVNULL = fopen("nul", "w");
+ FILE* DEVNULL = fopen("nul", "w");
#else
-FILE* DEVNULL = fopen("/dev/null", "w");
+ FILE* DEVNULL = fopen("/dev/null", "w");
#endif
-
-void setStdinEcho(bool enable = true)
-{
+ void setStdinEcho(bool enable = true)
+ {
#ifdef Q_OS_WIN
HANDLE hIn = GetStdHandle(STD_INPUT_HANDLE);
DWORD mode;
@@ -98,61 +97,61 @@ void setStdinEcho(bool enable = true)
}
} // namespace Test
-QSharedPointer<Database> unlockDatabase(const QString& databaseFilename,
- const QString& keyFilename,
- FILE* outputDescriptor,
- FILE* errorDescriptor)
-{
- auto compositeKey = QSharedPointer<CompositeKey>::create();
- TextStream out(outputDescriptor);
- TextStream err(errorDescriptor);
-
- out << QObject::tr("Insert password to unlock %1: ").arg(databaseFilename) << flush;
-
- QString line = Utils::getPassword(outputDescriptor);
- auto passwordKey = QSharedPointer<PasswordKey>::create();
- passwordKey->setPassword(line);
- compositeKey->addKey(passwordKey);
-
- if (!keyFilename.isEmpty()) {
- auto fileKey = QSharedPointer<FileKey>::create();
- QString errorMessage;
- // LCOV_EXCL_START
- if (!fileKey->load(keyFilename, &errorMessage)) {
- 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;
+ QSharedPointer<Database> unlockDatabase(const QString& databaseFilename,
+ const QString& keyFilename,
+ FILE* outputDescriptor,
+ FILE* errorDescriptor)
+ {
+ auto compositeKey = QSharedPointer<CompositeKey>::create();
+ TextStream out(outputDescriptor);
+ TextStream err(errorDescriptor);
+
+ out << QObject::tr("Insert password to unlock %1: ").arg(databaseFilename) << flush;
+
+ QString line = Utils::getPassword(outputDescriptor);
+ auto passwordKey = QSharedPointer<PasswordKey>::create();
+ passwordKey->setPassword(line);
+ compositeKey->addKey(passwordKey);
+
+ if (!keyFilename.isEmpty()) {
+ auto fileKey = QSharedPointer<FileKey>::create();
+ QString errorMessage;
+ // LCOV_EXCL_START
+ if (!fileKey->load(keyFilename, &errorMessage)) {
+ 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;
+ }
+ // LCOV_EXCL_STOP
+
+ compositeKey->addKey(fileKey);
}
- // LCOV_EXCL_STOP
-
- compositeKey->addKey(fileKey);
- }
- auto db = QSharedPointer<Database>::create();
- QString error;
+ auto db = QSharedPointer<Database>::create();
+ QString error;
if (db->open(databaseFilename, compositeKey, &error, false)) {
return db;
- } else {
+ }else {
err << error << endl;
return {};
}
}
-/**
- * Read a user password from STDIN or return a password previously
- * set by \link setNextPassword().
- *
- * @return the password
- */
-QString getPassword(FILE* outputDescriptor)
-{
- TextStream out(outputDescriptor, QIODevice::WriteOnly);
+ /**
+ * Read a user password from STDIN or return a password previously
+ * set by \link setNextPassword().
+ *
+ * @return the password
+ */
+ QString getPassword(FILE* outputDescriptor)
+ {
+ TextStream out(outputDescriptor, QIODevice::WriteOnly);
// return preset password if one is set
if (!Test::nextPasswords.isEmpty()) {
diff --git a/src/cli/Utils.h b/src/cli/Utils.h
index 3d240c2c0..bb4d8f09a 100644
--- a/src/cli/Utils.h
+++ b/src/cli/Utils.h
@@ -36,9 +36,9 @@ namespace Utils
QString getPassword(FILE* outputDescriptor = STDOUT);
int clipText(const QString& text);
QSharedPointer<Database> unlockDatabase(const QString& databaseFilename,
- const QString& keyFilename = {},
- FILE* outputDescriptor = STDOUT,
- FILE* errorDescriptor = STDERR);
+ const QString& keyFilename = {},
+ FILE* outputDescriptor = STDOUT,
+ FILE* errorDescriptor = STDERR);
namespace Test
{
diff --git a/src/core/Bootstrap.cpp b/src/core/Bootstrap.cpp
index 10dd9b2d8..1950735ae 100644
--- a/src/core/Bootstrap.cpp
+++ b/src/core/Bootstrap.cpp
@@ -229,12 +229,11 @@ namespace Bootstrap
#ifdef WITH_XC_SSHAGENT
// OpenSSH for Windows ssh-agent service is running as LocalSystem
- if (!AddAccessAllowedAce(
- pACL,
- ACL_REVISION,
- PROCESS_QUERY_INFORMATION | PROCESS_DUP_HANDLE, // just enough for ssh-agent
- pLocalSystemSid // known LocalSystem sid
- )) {
+ if (!AddAccessAllowedAce(pACL,
+ ACL_REVISION,
+ PROCESS_QUERY_INFORMATION | PROCESS_DUP_HANDLE, // just enough for ssh-agent
+ pLocalSystemSid // known LocalSystem sid
+ )) {
goto Cleanup;
}
#endif
diff --git a/src/core/Database.cpp b/src/core/Database.cpp
index 261f2757a..13dea7d1c 100644
--- a/src/core/Database.cpp
+++ b/src/core/Database.cpp
@@ -28,11 +28,11 @@
#include "keys/PasswordKey.h"
#include <QFile>
+#include <QFileInfo>
#include <QSaveFile>
#include <QTemporaryFile>
#include <QTimer>
#include <QXmlStreamReader>
-#include <QFileInfo>
QHash<QUuid, QPointer<Database>> Database::s_uuidMap;
QHash<QString, QPointer<Database>> Database::s_filePathMap;
diff --git a/src/core/Database.h b/src/core/Database.h
index 8fbeb17ad..84e2f90ef 100644
--- a/src/core/Database.h
+++ b/src/core/Database.h
@@ -25,10 +25,10 @@
#include <QPointer>
#include "config-keepassx.h"
+#include "crypto/kdf/AesKdf.h"
#include "crypto/kdf/Kdf.h"
#include "format/KeePass2.h"
#include "keys/CompositeKey.h"
-#include "crypto/kdf/AesKdf.h"
class Entry;
enum class EntryReferenceType;
@@ -66,7 +66,10 @@ public:
~Database() override;
bool open(QSharedPointer<const CompositeKey> key, QString* error = nullptr, bool readOnly = false);
- bool open(const QString& filePath, QSharedPointer<const CompositeKey> key, QString* error = nullptr, bool readOnly = false);
+ bool open(const QString& filePath,
+ QSharedPointer<const CompositeKey> key,
+ QString* error = nullptr,
+ bool readOnly = false);
bool save(QString* error = nullptr, bool atomic = true, bool backup = false);
bool save(const QString& filePath, QString* error = nullptr, bool atomic = true, bool backup = false);
@@ -103,7 +106,9 @@ public:
bool hasKey() const;
QSharedPointer<const CompositeKey> key() const;
- bool setKey(const QSharedPointer<const CompositeKey>& key, bool updateChangedTime = true, bool updateTransformSalt = false);
+ bool setKey(const QSharedPointer<const CompositeKey>& key,
+ bool updateChangedTime = true,
+ bool updateTransformSalt = false);
QByteArray challengeResponseKey() const;
bool challengeMasterSeed(const QByteArray& masterSeed);
bool verifyKey(const QSharedPointer<CompositeKey>& key) const;
diff --git a/src/core/Entry.cpp b/src/core/Entry.cpp
index d7a3089cb..2fd2e8c44 100644
--- a/src/core/Entry.cpp
+++ b/src/core/Entry.cpp
@@ -726,17 +726,15 @@ Entry* Entry::clone(CloneFlags flags) const
entry->m_attachments->copyDataFrom(m_attachments);
if (flags & CloneUserAsRef) {
- entry->m_attributes->set(
- EntryAttributes::UserNameKey,
- buildReference(uuid(), EntryAttributes::UserNameKey),
- m_attributes->isProtected(EntryAttributes::UserNameKey));
+ entry->m_attributes->set(EntryAttributes::UserNameKey,
+ buildReference(uuid(), EntryAttributes::UserNameKey),
+ m_attributes->isProtected(EntryAttributes::UserNameKey));
}
if (flags & ClonePassAsRef) {
- entry->m_attributes->set(
- EntryAttributes::PasswordKey,
- buildReference(uuid(), EntryAttributes::PasswordKey),
- m_attributes->isProtected(EntryAttributes::PasswordKey));
+ entry->m_attributes->set(EntryAttributes::PasswordKey,
+ buildReference(uuid(), EntryAttributes::PasswordKey),
+ m_attributes->isProtected(EntryAttributes::PasswordKey));
}
entry->m_autoTypeAssociations->copyDataFrom(m_autoTypeAssociations);
diff --git a/src/core/EntrySearcher.cpp b/src/core/EntrySearcher.cpp
index 82e6eaa0c..a639afd8b 100644
--- a/src/core/EntrySearcher.cpp
+++ b/src/core/EntrySearcher.cpp
@@ -24,7 +24,7 @@
EntrySearcher::EntrySearcher(bool caseSensitive)
: m_caseSensitive(caseSensitive)
, m_termParser(R"re(([-!*+]+)?(?:(\w*):)?(?:(?=")"((?:[^"\\]|\\.)*)"|([^ ]*))( |$))re")
- // Group 1 = modifiers, Group 2 = field, Group 3 = quoted string, Group 4 = unquoted string
+// Group 1 = modifiers, Group 2 = field, Group 3 = quoted string, Group 4 = unquoted string
{
}
@@ -46,9 +46,9 @@ QList<Entry*> EntrySearcher::searchEntries(const QString& searchString, const QL
{
QList<Entry*> results;
for (Entry* entry : entries) {
- if (searchEntryImpl(searchString, entry)) {
- results.append(entry);
- }
+ if (searchEntryImpl(searchString, entry)) {
+ results.append(entry);
+ }
}
return results;
}
@@ -97,10 +97,10 @@ bool EntrySearcher::searchEntryImpl(const QString& searchString, Entry* entry)
break;
default:
// Terms without a specific field try to match title, username, url, and notes
- found = term->regex.match(entry->resolvePlaceholder(entry->title())).hasMatch() ||
- term->regex.match(entry->resolvePlaceholder(entry->username())).hasMatch() ||
- term->regex.match(entry->resolvePlaceholder(entry->url())).hasMatch() ||
- term->regex.match(entry->notes()).hasMatch();
+ found = term->regex.match(entry->resolvePlaceholder(entry->title())).hasMatch()
+ || term->regex.match(entry->resolvePlaceholder(entry->username())).hasMatch()
+ || term->regex.match(entry->resolvePlaceholder(entry->url())).hasMatch()
+ || term->regex.match(entry->notes()).hasMatch();
}
// Short circuit if we failed to match or we matched and are excluding this term
@@ -112,9 +112,9 @@ bool EntrySearcher::searchEntryImpl(const QString& searchString, Entry* entry)
return true;
}
-QList<QSharedPointer<EntrySearcher::SearchTerm> > EntrySearcher::parseSearchTerms(const QString& searchString)
+QList<QSharedPointer<EntrySearcher::SearchTerm>> EntrySearcher::parseSearchTerms(const QString& searchString)
{
- auto terms = QList<QSharedPointer<SearchTerm> >();
+ auto terms = QList<QSharedPointer<SearchTerm>>();
auto results = m_termParser.globalMatch(searchString);
while (results.hasNext()) {
diff --git a/src/core/EntrySearcher.h b/src/core/EntrySearcher.h
index ec71a7ce1..d5a9951f9 100644
--- a/src/core/EntrySearcher.h
+++ b/src/core/EntrySearcher.h
@@ -19,8 +19,8 @@
#ifndef KEEPASSX_ENTRYSEARCHER_H
#define KEEPASSX_ENTRYSEARCHER_H
-#include <QString>
#include <QRegularExpression>
+#include <QString>
class Group;
class Entry;
@@ -39,7 +39,8 @@ public:
private:
bool searchEntryImpl(const QString& searchString, Entry* entry);
- enum class Field {
+ enum class Field
+ {
Undefined,
Title,
Username,
@@ -58,7 +59,7 @@ private:
bool exclude;
};
- QList<QSharedPointer<SearchTerm> > parseSearchTerms(const QString& searchString);
+ QList<QSharedPointer<SearchTerm>> parseSearchTerms(const QString& searchString);
bool m_caseSensitive;
QRegularExpression m_termParser;
diff --git a/src/core/FileWatcher.cpp b/src/core/FileWatcher.cpp
index d57d7de52..d7056f9c7 100644
--- a/src/core/FileWatcher.cpp
+++ b/src/core/FileWatcher.cpp
@@ -29,7 +29,7 @@ namespace
{
const int FileChangeDelay = 500;
const int TimerResolution = 100;
-}
+} // namespace
DelayingFileWatcher::DelayingFileWatcher(QObject* parent)
: QObject(parent)
@@ -238,13 +238,13 @@ void BulkFileWatcher::emitSignals()
{
QMap<QString, QList<Signal>> queued;
m_pendingSignals.swap(queued);
- for (const auto& path : queued.keys()){
- const auto &signal = queued[path];
+ for (const auto& path : queued.keys()) {
+ const auto& signal = queued[path];
if (signal.last() == Removed) {
emit fileRemoved(path);
continue;
}
- if (signal.first() == Created){
+ if (signal.first() == Created) {
emit fileCreated(path);
continue;
}
@@ -252,7 +252,7 @@ void BulkFileWatcher::emitSignals()
}
}
-void BulkFileWatcher::scheduleSignal(Signal signal, const QString &path)
+void BulkFileWatcher::scheduleSignal(Signal signal, const QString& path)
{
// we need to collect signals since the file watcher API may send multiple signals for a "single" change
// therefore we wait until the event loop finished before starting to import any changes
diff --git a/src/core/FileWatcher.h b/src/core/FileWatcher.h
index 1ef46785c..00d6a6c69 100644
--- a/src/core/FileWatcher.h
+++ b/src/core/FileWatcher.h
@@ -58,11 +58,13 @@ class BulkFileWatcher : public QObject
{
Q_OBJECT
- enum Signal {
+ enum Signal
+ {
Created,
Updated,
Removed
};
+
public:
explicit BulkFileWatcher(QObject* parent = nullptr);
@@ -71,7 +73,6 @@ public:
void removePath(const QString& path);
void addPath(const QString& path);
-
void ignoreFileChanges(const QString& path);
signals:
@@ -88,7 +89,7 @@ private slots:
void emitSignals();
private:
- void scheduleSignal(Signal event, const QString &path);
+ void scheduleSignal(Signal event, const QString& path);
private:
QMap<QString, bool> m_watchedPaths;
@@ -96,9 +97,9 @@ private:
QFileSystemWatcher m_fileWatcher;
QMap<QString, QMap<QString, bool>> m_watchedFilesInDirectory;
// needed for Import/Export-References to prevent update after self-write
- QTimer m_fileWatchUnblockTimer;
+ QTimer m_fileWatchUnblockTimer;
// needed to tolerate multiple signals for same event
- QTimer m_pendingSignalsTimer;
+ QTimer m_pendingSignalsTimer;
QMap<QString, QList<Signal>> m_pendingSignals;
};
diff --git a/src/core/Group.cpp b/src/core/Group.cpp
index 6c4adbad7..9cfce863e 100644
--- a/src/core/Group.cpp
+++ b/src/core/Group.cpp
@@ -554,7 +554,8 @@ QList<Entry*> Group::entriesRecursive(bool includeHistoryItems) const
QList<Entry*> Group::referencesRecursive(const Entry* entry) const
{
auto entries = entriesRecursive();
- return QtConcurrent::blockingFiltered(entries, [entry](const Entry* e) { return e->hasReferencesTo(entry->uuid()); });
+ return QtConcurrent::blockingFiltered(entries,
+ [entry](const Entry* e) { return e->hasReferencesTo(entry->uuid()); });
}
Entry* Group::findEntryByUuid(const QUuid& uuid) const
@@ -600,29 +601,29 @@ Entry* Group::findEntryBySearchTerm(const QString& term, EntryReferenceType refe
const QList<Entry*>& entryList = group->entries();
for (Entry* entry : entryList) {
switch (referenceType) {
- case EntryReferenceType::Unknown:
- return nullptr;
- case EntryReferenceType::Title:
- found = entry->title() == term;
- break;
- case EntryReferenceType::UserName:
- found = entry->username() == term;
- break;
- case EntryReferenceType::Password:
- found = entry->password() == term;
- break;
- case EntryReferenceType::Url:
- found = entry->url() == term;
- break;
- case EntryReferenceType::Notes:
- found = entry->notes() == term;
- break;
- case EntryReferenceType::QUuid:
- found = entry->uuid() == QUuid::fromRfc4122(QByteArray::fromHex(term.toLatin1()));
- break;
- case EntryReferenceType::CustomAttributes:
- found = entry->attributes()->containsValue(term);
- break;
+ case EntryReferenceType::Unknown:
+ return nullptr;
+ case EntryReferenceType::Title:
+ found = entry->title() == term;
+ break;
+ case EntryReferenceType::UserName:
+ found = entry->username() == term;
+ break;
+ case EntryReferenceType::Password:
+ found = entry->password() == term;
+ break;
+ case EntryReferenceType::Url:
+ found = entry->url() == term;
+ break;
+ case EntryReferenceType::Notes:
+ found = entry->notes() == term;
+ break;
+ case EntryReferenceType::QUuid:
+ found = entry->uuid() == QUuid::fromRfc4122(QByteArray::fromHex(term.toLatin1()));
+ break;
+ case EntryReferenceType::CustomAttributes:
+ found = entry->attributes()->containsValue(term);
+ break;
}
if (found) {
diff --git a/src/core/ScreenLockListenerMac.cpp b/src/core/ScreenLockListenerMac.cpp
index dce05de3f..08e4d1eee 100644
--- a/src/core/ScreenLockListenerMac.cpp
+++ b/src/core/ScreenLockListenerMac.cpp
@@ -17,8 +17,8 @@
#include "ScreenLockListenerMac.h"
-#include <QMutexLocker>
#include <CoreFoundation/CoreFoundation.h>
+#include <QMutexLocker>
ScreenLockListenerMac* ScreenLockListenerMac::instance()
{
@@ -32,8 +32,10 @@ ScreenLockListenerMac* ScreenLockListenerMac::instance()
return m_ptr;
}
-void ScreenLockListenerMac::notificationCenterCallBack(CFNotificationCenterRef, void*,
- CFStringRef, const void*,
+void ScreenLockListenerMac::notificationCenterCallBack(CFNotificationCenterRef,
+ void*,
+ CFStringRef,
+ const void*,
CFDictionaryRef)
{
instance()->onSignalReception();
diff --git a/src/core/ScreenLockListenerMac.h b/src/core/ScreenLockListenerMac.h
index cd36ce9e6..d2bee79b8 100644
--- a/src/core/ScreenLockListenerMac.h
+++ b/src/core/ScreenLockListenerMac.h
@@ -24,19 +24,21 @@
#include "ScreenLockListenerPrivate.h"
-class ScreenLockListenerMac: public ScreenLockListenerPrivate {
+class ScreenLockListenerMac : public ScreenLockListenerPrivate
+{
Q_OBJECT
public:
static ScreenLockListenerMac* instance();
- static void notificationCenterCallBack(CFNotificationCenterRef center, void* observer,
- CFStringRef name, const void* object,
+ static void notificationCenterCallBack(CFNotificationCenterRef center,
+ void* observer,
+ CFStringRef name,
+ const void* object,
CFDictionaryRef userInfo);
private:
ScreenLockListenerMac(QWidget* parent = nullptr);
void onSignalReception();
-
};
#endif // SCREENLOCKLISTENERMAC_H
diff --git a/src/core/TimeInfo.cpp b/src/core/TimeInfo.cpp
index b48ad42ea..9f4faf3a4 100644
--- a/src/core/TimeInfo.cpp
+++ b/src/core/TimeInfo.cpp
@@ -118,6 +118,7 @@ bool TimeInfo::operator!=(const TimeInfo& other) const
bool TimeInfo::equals(const TimeInfo& other, CompareItemOptions options) const
{
+ // clang-format off
if (::compare(m_lastModificationTime, other.m_lastModificationTime, options) != 0) {
return false;
}
@@ -137,4 +138,5 @@ bool TimeInfo::equals(const TimeInfo& other, CompareItemOptions options) const
return false;
}
return true;
+ // clang-format on
}
diff --git a/src/core/Tools.cpp b/src/core/Tools.cpp
index 7fc2a3462..e72901a61 100644
--- a/src/core/Tools.cpp
+++ b/src/core/Tools.cpp
@@ -208,7 +208,8 @@ namespace Tools
return regex;
}
- QString uuidToHex(const QUuid& uuid) {
+ QString uuidToHex(const QUuid& uuid)
+ {
return QString::fromLatin1(uuid.toRfc4122().toHex());
}
@@ -216,7 +217,6 @@ namespace Tools
: raw(nullptr)
, size(0)
{
-
}
Buffer::~Buffer()
@@ -226,15 +226,16 @@ namespace Tools
void Buffer::clear()
{
- if(size > 0){
+ if (size > 0) {
free(raw);
}
- raw = nullptr; size = 0;
+ raw = nullptr;
+ size = 0;
}
QByteArray Buffer::content() const
{
- return QByteArray(reinterpret_cast<char*>(raw), size );
+ return QByteArray(reinterpret_cast<char*>(raw), size);
}
} // namespace Tools
diff --git a/src/core/Translator.cpp b/src/core/Translator.cpp
index f64a7a44c..595dadfa1 100644
--- a/src/core/Translator.cpp
+++ b/src/core/Translator.cpp
@@ -47,8 +47,7 @@ void Translator::installTranslators()
#ifdef QT_DEBUG
QString("%1/share/translations").arg(KEEPASSX_BINARY_DIR),
#endif
- filePath()->dataPath("translations")
- };
+ filePath()->dataPath("translations")};
bool translationsLoaded = false;
for (const QString& path : paths) {
diff --git a/src/crypto/ssh/ASN1Key.h b/src/crypto/ssh/ASN1Key.h
index 54a2bde4e..0a199d357 100644
--- a/src/crypto/ssh/ASN1Key.h
+++ b/src/crypto/ssh/ASN1Key.h
@@ -27,6 +27,6 @@ namespace ASN1Key
bool parseDSA(QByteArray& ba, OpenSSHKey& key);
bool parsePrivateRSA(QByteArray& ba, OpenSSHKey& key);
bool parsePublicRSA(QByteArray& ba, OpenSSHKey& key);
-}
+} // namespace ASN1Key
#endif // KEEPASSXC_ASN1KEY_H
diff --git a/src/crypto/ssh/OpenSSHKey.cpp b/src/crypto/ssh/OpenSSHKey.cpp
index fec0a0fd8..7cabf38c6 100644
--- a/src/crypto/ssh/OpenSSHKey.cpp
+++ b/src/crypto/ssh/OpenSSHKey.cpp
@@ -36,39 +36,39 @@ const QString OpenSSHKey::TYPE_OPENSSH_PRIVATE = "OPENSSH PRIVATE KEY";
namespace
{
-QPair<QString, QList<QByteArray>> binaryDeserialize(const QByteArray& serialized)
-{
- if (serialized.isEmpty()) {
- return {};
+ QPair<QString, QList<QByteArray>> binaryDeserialize(const QByteArray& serialized)
+ {
+ if (serialized.isEmpty()) {
+ return {};
+ }
+ QBuffer buffer;
+ buffer.setData(serialized);
+ buffer.open(QBuffer::ReadOnly);
+ BinaryStream stream(&buffer);
+ QString type;
+ stream.readString(type);
+ QByteArray temp;
+ QList<QByteArray> data;
+ while (stream.readString(temp)) {
+ data << temp;
+ }
+ return ::qMakePair(type, data);
}
- QBuffer buffer;
- buffer.setData(serialized);
- buffer.open(QBuffer::ReadOnly);
- BinaryStream stream(&buffer);
- QString type;
- stream.readString(type);
- QByteArray temp;
- QList<QByteArray> data;
- while (stream.readString(temp)) {
- data << temp;
- }
- return ::qMakePair(type, data);
-}
-QByteArray binarySerialize(const QString& type, const QList<QByteArray>& data)
-{
- if (type.isEmpty() && data.isEmpty()) {
- return {};
- }
- QByteArray buffer;
- BinaryStream stream(&buffer);
- stream.writeString(type);
- for (const QByteArray& part : data) {
- stream.writeString(part);
+ QByteArray binarySerialize(const QString& type, const QList<QByteArray>& data)
+ {
+ if (type.isEmpty() && data.isEmpty()) {
+ return {};
+ }
+ QByteArray buffer;
+ BinaryStream stream(&buffer);
+ stream.writeString(type);
+ for (const QByteArray& part : data) {
+ stream.writeString(part);
+ }
+ return buffer;
}
- return buffer;
-}
-}
+} // namespace
// bcrypt_pbkdf.cpp
int bcrypt_pbkdf(const QByteArray& pass, const QByteArray& salt, QByteArray& key, quint32 rounds);
@@ -95,7 +95,9 @@ OpenSSHKey OpenSSHKey::generate(bool secure)
Tools::Map<Index, gcry_mpi_t, &gcry_mpi_release> mpi;
Tools::Map<Index, gcry_sexp_t, &gcry_sexp_release> sexp;
gcry_error_t rc = GPG_ERR_NO_ERROR;
- rc = gcry_sexp_build(&sexp[Params], NULL, secure ? "(genkey (rsa (nbits 4:2048)))" : "(genkey (rsa (transient-key) (nbits 4:2048)))");
+ rc = gcry_sexp_build(&sexp[Params],
+ NULL,
+ secure ? "(genkey (rsa (nbits 4:2048)))" : "(genkey (rsa (transient-key) (nbits 4:2048)))");
if (rc != GPG_ERR_NO_ERROR) {
qWarning() << "Could not create ssh key" << gcry_err_code(rc);
return OpenSSHKey();
@@ -204,32 +206,32 @@ OpenSSHKey OpenSSHKey::generate(bool secure)
}
OpenSSHKey::OpenSSHKey(QObject* parent)
- : QObject(parent)
- , m_type(QString())
- , m_cipherName(QString("none"))
- , m_kdfName(QString("none"))
- , m_kdfOptions(QByteArray())
- , m_rawType(QString())
- , m_rawData(QByteArray())
- , m_rawPublicData(QList<QByteArray>())
- , m_rawPrivateData(QList<QByteArray>())
- , m_comment(QString())
- , m_error(QString())
+ : QObject(parent)
+ , m_type(QString())
+ , m_cipherName(QString("none"))
+ , m_kdfName(QString("none"))
+ , m_kdfOptions(QByteArray())
+ , m_rawType(QString())
+ , m_rawData(QByteArray())
+ , m_rawPublicData(QList<QByteArray>())
+ , m_rawPrivateData(QList<QByteArray>())
+ , m_comment(QString())
+ , m_error(QString())
{
}
OpenSSHKey::OpenSSHKey(const OpenSSHKey& other)
- : QObject(nullptr)
- , m_type(other.m_type)
- , m_cipherName(other.m_cipherName)
- , m_kdfName(other.m_kdfName)
- , m_kdfOptions(other.m_kdfOptions)
- , m_rawType(other.m_rawType)
- , m_rawData(other.m_rawData)
- , m_rawPublicData(other.m_rawPublicData)
- , m_rawPrivateData(other.m_rawPrivateData)
- , m_comment(other.m_comment)
- , m_error(other.m_error)
+ : QObject(nullptr)
+ , m_type(other.m_type)
+ , m_cipherName(other.m_cipherName)
+ , m_kdfName(other.m_kdfName)
+ , m_kdfOptions(other.m_kdfOptions)
+ , m_rawType(other.m_rawType)
+ , m_rawData(other.m_rawData)
+ , m_rawPublicData(other.m_rawPublicData)
+ , m_rawPrivateData(other.m_rawPrivateData)
+ , m_comment(other.m_comment)
+ , m_error(other.m_error)
{
}
diff --git a/src/format/Kdbx4Reader.cpp b/src/format/Kdbx4Reader.cpp
index fe7e40313..fbdf865bc 100644
--- a/src/format/Kdbx4Reader.cpp
+++ b/src/format/Kdbx4Reader.cpp
@@ -68,6 +68,7 @@ bool Kdbx4Reader::readDatabaseImpl(QIODevice* device,
return false;
}
+ // clang-format off
QByteArray hmacKey = KeePass2::hmacKey(m_masterSeed, db->transformedMasterKey());
if (headerHmac != CryptoHash::hmac(headerData, HmacBlockStream::getHmacKey(UINT64_MAX, hmacKey), CryptoHash::Sha256)) {
raiseError(tr("Wrong key or database file is corrupt. (HMAC mismatch)"));
@@ -93,6 +94,7 @@ bool Kdbx4Reader::readDatabaseImpl(QIODevice* device,
raiseError(cipherStream.errorString());
return false;
}
+ // clang-format on
QIODevice* xmlDevice = nullptr;
QScopedPointer<QtIOCompressor> ioCompressor;
diff --git a/src/format/KdbxXmlWriter.h b/src/format/KdbxXmlWriter.h
index 1fbb36254..1a367a263 100644
--- a/src/format/KdbxXmlWriter.h
+++ b/src/format/KdbxXmlWriter.h
@@ -37,7 +37,7 @@ public:
explicit KdbxXmlWriter(quint32 version);
void writeDatabase(QIODevice* device,
- const Database *db,
+ const Database* db,
KeePass2RandomStream* randomStream = nullptr,
const QByteArray& headerHash = QByteArray());
void writeDatabase(const QString& filename, Database* db);
diff --git a/src/format/KeePass1Reader.cpp b/src/format/KeePass1Reader.cpp
index dc80627d0..e42449358 100644
--- a/src/format/KeePass1Reader.cpp
+++ b/src/format/KeePass1Reader.cpp
@@ -56,7 +56,8 @@ KeePass1Reader::KeePass1Reader()
{
}
-QSharedPointer<Database> KeePass1Reader::readDatabase(QIODevice* device, const QString& password, QIODevice* keyfileDevice)
+QSharedPointer<Database>
+KeePass1Reader::readDatabase(QIODevice* device, const QString& password, QIODevice* keyfileDevice)
{
m_error = false;
m_errorStr.clear();
@@ -248,7 +249,8 @@ QSharedPointer<Database> KeePass1Reader::readDatabase(QIODevice* device, const Q
return db;
}
-QSharedPointer<Database> KeePass1Reader::readDatabase(QIODevice* device, const QString& password, const QString& keyfileName)
+QSharedPointer<Database>
+KeePass1Reader::readDatabase(QIODevice* device, const QString& password, const QString& keyfileName)
{
QScopedPointer<QFile> keyFile;
if (!keyfileName.isEmpty()) {
@@ -262,7 +264,8 @@ QSharedPointer<Database> KeePass1Reader::readDatabase(QIODevice* device, const Q
return QSharedPointer<Database>(readDatabase(device, password, keyFile.data()));
}
-QSharedPointer<Database> KeePass1Reader::readDatabase(const QString& filename, const QString& password, const QString& keyfileName)
+QSharedPointer<Database>
+KeePass1Reader::readDatabase(const QString& filename, const QString& password, const QString& keyfileName)
{
QFile dbFile(filename);
if (!dbFile.open(QFile::ReadOnly)) {
@@ -290,7 +293,8 @@ QString KeePass1Reader::errorString()
return m_errorStr;
}
-SymmetricCipherStream* KeePass1Reader::testKeys(const QString& password, const QByteArray& keyfileData, qint64 contentPos)
+SymmetricCipherStream*
+KeePass1Reader::testKeys(const QString& password, const QByteArray& keyfileData, qint64 contentPos)
{
const QList<PasswordEncoding> encodings = {Windows1252, Latin1, UTF8};
diff --git a/src/format/KeePass2Writer.cpp b/src/format/KeePass2Writer.cpp
index 46bb8ba22..0bd247280 100644
--- a/src/format/KeePass2Writer.cpp
+++ b/src/format/KeePass2Writer.cpp
@@ -48,10 +48,10 @@ bool KeePass2Writer::writeDatabase(const QString& filename, Database* db)
*/
bool KeePass2Writer::implicitUpgradeNeeded(Database const* db) const
{
- if (db->kdf()->uuid() != KeePass2::KDF_AES_KDBX3 ) {
+ if (db->kdf()->uuid() != KeePass2::KDF_AES_KDBX3) {
return false;
}
-
+
if (!db->publicCustomData().isEmpty()) {
return true;
}
diff --git a/src/gui/AboutDialog.cpp b/src/gui/AboutDialog.cpp
index 7139a0224..97fa135fc 100644
--- a/src/gui/AboutDialog.cpp
+++ b/src/gui/AboutDialog.cpp
@@ -65,15 +65,15 @@ AboutDialog::AboutDialog(QWidget* parent)
#endif
debugInfo.append("\n").append(
- QString("%1\n- Qt %2\n- %3\n\n")
- .arg(tr("Libraries:"), QString::fromLocal8Bit(qVersion()), Crypto::backendVersion()));
+ 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")
- .arg(QSysInfo::prettyProductName(),
- QSysInfo::currentCpuArchitecture(),
- QSysInfo::kernelType(),
- QSysInfo::kernelVersion()));
+ .arg(QSysInfo::prettyProductName(),
+ QSysInfo::currentCpuArchitecture(),
+ QSysInfo::kernelType(),
+ QSysInfo::kernelVersion()));
debugInfo.append("\n\n");
#endif
diff --git a/src/gui/ApplicationSettingsWidget.cpp b/src/gui/ApplicationSettingsWidget.cpp
index 84e09b837..806512b5a 100644
--- a/src/gui/ApplicationSettingsWidget.cpp
+++ b/src/gui/ApplicationSettingsWidget.cpp
@@ -248,7 +248,8 @@ void ApplicationSettingsWidget::saveSettings()
config()->set("GUI/MovableToolbar", m_generalUi->toolbarMovableCheckBox->isChecked());
int currentToolButtonStyleIndex = m_generalUi->toolButtonStyleComboBox->currentIndex();
- config()->set("GUI/ToolButtonStyle", m_generalUi->toolButtonStyleComboBox->itemData(currentToolButtonStyleIndex).toString());
+ config()->set("GUI/ToolButtonStyle",
+ m_generalUi->toolButtonStyleComboBox->itemData(currentToolButtonStyleIndex).toString());
config()->set("GUI/ShowTrayIcon", m_generalUi->systrayShowCheckBox->isChecked());
config()->set("GUI/DarkTrayIcon", m_generalUi->systrayDarkIconCheckBox->isChecked());
@@ -329,4 +330,3 @@ void ApplicationSettingsWidget::enableToolbarSettings(bool checked)
m_generalUi->toolButtonStyleComboBox->setEnabled(!checked);
m_generalUi->toolButtonStyleLabel->setEnabled(!checked);
}
-
diff --git a/src/gui/DatabaseOpenWidget.cpp b/src/gui/DatabaseOpenWidget.cpp
index 0983ad855..96be7dc1e 100644
--- a/src/gui/DatabaseOpenWidget.cpp
+++ b/src/gui/DatabaseOpenWidget.cpp
@@ -202,9 +202,8 @@ void DatabaseOpenWidget::openDatabase()
bool ok = m_db->open(m_filename, masterKey, &error, false);
QApplication::restoreOverrideCursor();
if (!ok) {
- m_ui->messageWidget->showMessage(
- tr("Unable to open the database:\n%1").arg(error),
- MessageWidget::MessageType::Error);
+ m_ui->messageWidget->showMessage(tr("Unable to open the database:\n%1").arg(error),
+ MessageWidget::MessageType::Error);
return;
}
@@ -232,8 +231,7 @@ void DatabaseOpenWidget::openDatabase()
}
emit dialogFinished(true);
} else {
- m_ui->messageWidget->showMessage(tr("Unable to open the database:\n%1").arg(error),
- MessageWidget::Error);
+ m_ui->messageWidget->showMessage(tr("Unable to open the database:\n%1").arg(error), MessageWidget::Error);
m_ui->editPassword->setText("");
#ifdef WITH_XC_TOUCHID
diff --git a/src/gui/DatabaseTabWidget.cpp b/src/gui/DatabaseTabWidget.cpp
index 65f17c71a..c908a82ec 100644
--- a/src/gui/DatabaseTabWidget.cpp
+++ b/src/gui/DatabaseTabWidget.cpp
@@ -31,12 +31,12 @@
#include "core/Tools.h"
#include "format/CsvExporter.h"
#include "gui/Clipboard.h"
+#include "gui/DatabaseOpenDialog.h"
#include "gui/DatabaseWidget.h"
#include "gui/DatabaseWidgetStateSync.h"
#include "gui/DragTabBar.h"
#include "gui/FileDialog.h"
#include "gui/MessageBox.h"
-#include "gui/DatabaseOpenDialog.h"
#include "gui/entry/EntryView.h"
#include "gui/group/GroupView.h"
#ifdef Q_OS_MACOS
@@ -54,12 +54,15 @@ DatabaseTabWidget::DatabaseTabWidget(QWidget* parent)
setTabBar(tabBar);
setDocumentMode(true);
+ // clang-format off
connect(this, SIGNAL(tabCloseRequested(int)), SLOT(closeDatabaseTab(int)));
connect(this, SIGNAL(currentChanged(int)), SLOT(emitActivateDatabaseChanged()));
- connect(this, SIGNAL(activateDatabaseChanged(DatabaseWidget*)), m_dbWidgetStateSync, SLOT(setActive(DatabaseWidget*)));
+ connect(this, SIGNAL(activateDatabaseChanged(DatabaseWidget*)),
+ m_dbWidgetStateSync, SLOT(setActive(DatabaseWidget*)));
connect(autoType(), SIGNAL(globalShortcutTriggered()), SLOT(performGlobalAutoType()));
connect(autoType(), SIGNAL(autotypePerformed()), SLOT(relockPendingDatabase()));
connect(autoType(), SIGNAL(autotypeRejected()), SLOT(relockPendingDatabase()));
+ // clang-format on
}
DatabaseTabWidget::~DatabaseTabWidget()
@@ -186,8 +189,9 @@ void DatabaseTabWidget::addDatabaseTab(DatabaseWidget* dbWidget, bool inBackgrou
setCurrentIndex(index);
}
- connect(dbWidget, SIGNAL(databaseFilePathChanged(QString,QString)), SLOT(updateTabName()));
- connect(dbWidget, SIGNAL(requestOpenDatabase(QString,bool,QString)), SLOT(addDatabaseTab(QString,bool,QString)));
+ connect(dbWidget, SIGNAL(databaseFilePathChanged(QString, QString)), SLOT(updateTabName()));
+ connect(
+ dbWidget, SIGNAL(requestOpenDatabase(QString, bool, QString)), SLOT(addDatabaseTab(QString, bool, QString)));
connect(dbWidget, SIGNAL(closeRequest()), SLOT(closeDatabaseTabFromSender()));
connect(dbWidget, SIGNAL(databaseModified()), SLOT(updateTabName()));
connect(dbWidget, SIGNAL(databaseSaved()), SLOT(updateTabName()));
@@ -520,7 +524,6 @@ void DatabaseTabWidget::lockDatabases()
// If we locked a database without a file close the tab
closeDatabaseTab(dbWidget);
}
-
}
}
@@ -542,7 +545,8 @@ void DatabaseTabWidget::unlockDatabaseInDialog(DatabaseWidget* dbWidget, Databas
* @param intent intent for unlocking
* @param file path of the database to be unlocked
*/
-void DatabaseTabWidget::unlockDatabaseInDialog(DatabaseWidget* dbWidget, DatabaseOpenDialog::Intent intent,
+void DatabaseTabWidget::unlockDatabaseInDialog(DatabaseWidget* dbWidget,
+ DatabaseOpenDialog::Intent intent,
const QString& filePath)
{
m_databaseOpenDialog->setTargetDatabaseWidget(dbWidget);
diff --git a/src/gui/DatabaseTabWidget.h b/src/gui/DatabaseTabWidget.h
index a659e4fe6..eda28839a 100644
--- a/src/gui/DatabaseTabWidget.h
+++ b/src/gui/DatabaseTabWidget.h
@@ -18,11 +18,11 @@
#ifndef KEEPASSX_DATABASETABWIDGET_H
#define KEEPASSX_DATABASETABWIDGET_H
-#include "gui/MessageWidget.h"
#include "DatabaseOpenDialog.h"
+#include "gui/MessageWidget.h"
-#include <QTabWidget>
#include <QPointer>
+#include <QTabWidget>
class Database;
class DatabaseWidget;
diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp
index ded0cc23a..134cbb126 100644
--- a/src/gui/DatabaseWidget.cpp
+++ b/src/gui/DatabaseWidget.cpp
@@ -32,8 +32,8 @@
#include <QSplitter>
#include "autotype/AutoType.h"
-#include "core/Database.h"
#include "core/Config.h"
+#include "core/Database.h"
#include "core/EntrySearcher.h"
#include "core/FilePath.h"
#include "core/FileWatcher.h"
@@ -42,18 +42,18 @@
#include "core/Metadata.h"
#include "core/Tools.h"
#include "format/KeePass2Reader.h"
-#include "gui/FileDialog.h"
#include "gui/Clipboard.h"
#include "gui/CloneDialog.h"
-#include "gui/DatabaseOpenWidget.h"
#include "gui/DatabaseOpenDialog.h"
-#include "gui/dbsettings/DatabaseSettingsDialog.h"
+#include "gui/DatabaseOpenWidget.h"
#include "gui/EntryPreviewWidget.h"
+#include "gui/FileDialog.h"
#include "gui/KeePass1OpenWidget.h"
#include "gui/MessageBox.h"
#include "gui/TotpDialog.h"
-#include "gui/TotpSetupDialog.h"
#include "gui/TotpExportSettingsDialog.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"
@@ -443,7 +443,7 @@ void DatabaseWidget::deleteSelectedEntries()
// Confirm entry removal before moving forward
auto* recycleBin = m_db->metadata()->recycleBin();
bool permanent = (recycleBin && recycleBin->findEntryByUuid(selectedEntries.first()->uuid()))
- || !m_db->metadata()->recycleBinEnabled();
+ || !m_db->metadata()->recycleBinEnabled();
if (!confirmDeleteEntries(selectedEntries, permanent)) {
return;
@@ -462,15 +462,16 @@ void DatabaseWidget::deleteSelectedEntries()
if (!references.isEmpty()) {
// Prompt for reference handling
auto result = MessageBox::question(
- this,
- tr("Replace references to entry?"),
- tr("Entry \"%1\" has %2 reference(s). "
- "Do you want to overwrite references with values, skip this entry, or delete anyway?", "",
- references.size())
- .arg((*it)->title().toHtmlEscaped())
- .arg(references.size()),
- MessageBox::Overwrite | MessageBox::Skip | MessageBox::Delete,
- MessageBox::Overwrite);
+ this,
+ tr("Replace references to entry?"),
+ tr("Entry \"%1\" has %2 reference(s). "
+ "Do you want to overwrite references with values, skip this entry, or delete anyway?",
+ "",
+ references.size())
+ .arg((*it)->title().toHtmlEscaped())
+ .arg(references.size()),
+ MessageBox::Overwrite | MessageBox::Skip | MessageBox::Delete,
+ MessageBox::Overwrite);
if (result == MessageBox::Overwrite) {
for (auto* entry : references) {
@@ -590,8 +591,7 @@ void DatabaseWidget::copyAttribute(QAction* action)
Entry* currentEntry = m_entryView->currentEntry();
if (currentEntry) {
setClipboardTextAndMinimize(
- currentEntry->resolveMultiplePlaceholders(
- currentEntry->attributes()->value(action->data().toString())));
+ currentEntry->resolveMultiplePlaceholders(currentEntry->attributes()->value(action->data().toString())));
}
}
@@ -707,12 +707,12 @@ void DatabaseWidget::deleteGroup()
bool isRecycleBin = recycleBin && (currentGroup == recycleBin);
bool isRecycleBinSubgroup = recycleBin && currentGroup->findGroupByUuid(recycleBin->uuid());
if (inRecycleBin || isRecycleBin || isRecycleBinSubgroup || !m_db->metadata()->recycleBinEnabled()) {
- auto result = MessageBox::question(this,
- tr("Delete group"),
- tr("Do you really want to delete the group \"%1\" for good?")
- .arg(currentGroup->name().toHtmlEscaped()),
- MessageBox::Delete | MessageBox::Cancel,
- MessageBox::Cancel);
+ auto result = MessageBox::question(
+ this,
+ tr("Delete group"),
+ tr("Do you really want to delete the group \"%1\" for good?").arg(currentGroup->name().toHtmlEscaped()),
+ MessageBox::Delete | MessageBox::Cancel,
+ MessageBox::Cancel);
if (result == MessageBox::Delete) {
delete currentGroup;
@@ -722,7 +722,7 @@ void DatabaseWidget::deleteGroup()
tr("Move group to recycle bin?"),
tr("Do you really want to move the group "
"\"%1\" to the recycle bin?")
- .arg(currentGroup->name().toHtmlEscaped()),
+ .arg(currentGroup->name().toHtmlEscaped()),
MessageBox::Move | MessageBox::Cancel,
MessageBox::Cancel);
if (result == MessageBox::Move) {
@@ -815,7 +815,10 @@ void DatabaseWidget::switchToGroupEdit(Group* group, bool create)
void DatabaseWidget::connectDatabaseSignals()
{
// relayed Database events
- connect(m_db.data(), SIGNAL(filePathChanged(QString,QString)), SIGNAL(databaseFilePathChanged(QString,QString)));
+ connect(m_db.data(),
+ SIGNAL(filePathChanged(QString, QString)),
+
+ SIGNAL(databaseFilePathChanged(QString, QString)));
connect(m_db.data(), SIGNAL(databaseModified()), SIGNAL(databaseModified()));
connect(m_db.data(), SIGNAL(databaseModified()), SLOT(onDatabaseModified()));
connect(m_db.data(), SIGNAL(databaseSaved()), SIGNAL(databaseSaved()));
@@ -1208,9 +1211,11 @@ bool DatabaseWidget::lock()
clipboard()->clearCopiedText();
if (currentMode() == DatabaseWidget::Mode::EditMode) {
- auto result = MessageBox::question(this, tr("Lock Database?"),
- tr("You are editing an entry. Discard changes and lock anyway?"),
- MessageBox::Discard | MessageBox::Cancel, MessageBox::Cancel);
+ auto result = MessageBox::question(this,
+ tr("Lock Database?"),
+ tr("You are editing an entry. Discard changes and lock anyway?"),
+ MessageBox::Discard | MessageBox::Cancel,
+ MessageBox::Cancel);
if (result == MessageBox::Cancel) {
return false;
}
@@ -1228,8 +1233,11 @@ bool DatabaseWidget::lock()
} else {
msg = tr("Database was modified.\nSave changes?");
}
- auto result = MessageBox::question(this, tr("Save changes?"), msg,
- MessageBox::Save | MessageBox::Discard | MessageBox::Cancel, MessageBox::Save);
+ auto result = MessageBox::question(this,
+ tr("Save changes?"),
+ msg,
+ MessageBox::Save | MessageBox::Discard | MessageBox::Cancel,
+ MessageBox::Save);
if (result == MessageBox::Save) {
if (!save()) {
return false;
@@ -1288,9 +1296,9 @@ void DatabaseWidget::reloadDatabaseFile()
if (!config()->get("AutoReloadOnChange").toBool()) {
// Ask if we want to reload the db
auto result = MessageBox::question(this,
- tr("File has changed"),
- tr("The database file has changed. Do you want to load the changes?"),
- MessageBox::Yes | MessageBox::No);
+ tr("File has changed"),
+ tr("The database file has changed. Do you want to load the changes?"),
+ MessageBox::Yes | MessageBox::No);
if (result == MessageBox::No) {
// Notify everyone the database does not match the file
@@ -1306,7 +1314,8 @@ void DatabaseWidget::reloadDatabaseFile()
if (db->open(database()->key(), &error, true)) {
if (m_db->isModified()) {
// Ask if we want to merge changes into new database
- auto result = MessageBox::question(this,
+ auto result = MessageBox::question(
+ this,
tr("Merge Request"),
tr("The database file has changed and you have unsaved changes.\nDo you want to merge your changes?"),
MessageBox::Merge | MessageBox::Cancel,
@@ -1336,9 +1345,8 @@ void DatabaseWidget::reloadDatabaseFile()
m_db->setReadOnly(isReadOnly);
restoreGroupEntryFocus(groupBeforeReload, entryBeforeReload);
} else {
- showMessage(
- tr("Could not open the new database file while attempting to autoreload.\nError: %1").arg(error),
- MessageWidget::Error);
+ showMessage(tr("Could not open the new database file while attempting to autoreload.\nError: %1").arg(error),
+ MessageWidget::Error);
// Mark db as modified since existing data may differ from file or file was deleted
m_db->markAsModified();
}
@@ -1525,12 +1533,16 @@ bool DatabaseWidget::saveAs()
while (true) {
QString oldFilePath = m_db->filePath();
if (!QFileInfo(oldFilePath).exists()) {
- oldFilePath = QDir::toNativeSeparators(config()->get("LastDir", QDir::homePath()).toString()
- + "/" + tr("Passwords").append(".kdbx"));
+ oldFilePath = QDir::toNativeSeparators(config()->get("LastDir", QDir::homePath()).toString() + "/"
+ + tr("Passwords").append(".kdbx"));
}
- QString newFilePath = fileDialog()->getSaveFileName(
- this, tr("Save database as"), oldFilePath,
- tr("KeePass 2 Database").append(" (*.kdbx)"), nullptr, nullptr, "kdbx");
+ QString newFilePath = fileDialog()->getSaveFileName(this,
+ tr("Save database as"),
+ oldFilePath,
+ tr("KeePass 2 Database").append(" (*.kdbx)"),
+ nullptr,
+ nullptr,
+ "kdbx");
if (!newFilePath.isEmpty()) {
// Ensure we don't recurse back into this function
@@ -1550,8 +1562,10 @@ bool DatabaseWidget::saveAs()
}
}
-void DatabaseWidget::showMessage(const QString& text, MessageWidget::MessageType type,
- bool showClosebutton, int autoHideTimeout)
+void DatabaseWidget::showMessage(const QString& text,
+ MessageWidget::MessageType type,
+ bool showClosebutton,
+ int autoHideTimeout)
{
m_messageWidget->setCloseButtonVisible(showClosebutton);
m_messageWidget->showMessage(text, type, autoHideTimeout);
@@ -1580,11 +1594,12 @@ void DatabaseWidget::emptyRecycleBin()
return;
}
- auto result = MessageBox::question(this,
- tr("Empty recycle bin?"),
- tr("Are you sure you want to permanently delete everything from your recycle bin?"),
- MessageBox::Empty | MessageBox::Cancel,
- MessageBox::Cancel);
+ auto result =
+ MessageBox::question(this,
+ tr("Empty recycle bin?"),
+ tr("Are you sure you want to permanently delete everything from your recycle bin?"),
+ MessageBox::Empty | MessageBox::Cancel,
+ MessageBox::Cancel);
if (result == MessageBox::Empty) {
m_db->emptyRecycleBin();
diff --git a/src/gui/DatabaseWidget.h b/src/gui/DatabaseWidget.h
index 1eadc9aa3..f8c6a26fe 100644
--- a/src/gui/DatabaseWidget.h
+++ b/src/gui/DatabaseWidget.h
@@ -25,7 +25,6 @@
#include <QTimer>
#include "DatabaseOpenDialog.h"
-#include "gui/entry/EntryModel.h"
#include "gui/MessageWidget.h"
#include "gui/csvImport/CsvImportWizard.h"
#include "gui/entry/EntryModel.h"
diff --git a/src/gui/EditWidgetIcons.cpp b/src/gui/EditWidgetIcons.cpp
index 6ac298255..ecf6d445f 100644
--- a/src/gui/EditWidgetIcons.cpp
+++ b/src/gui/EditWidgetIcons.cpp
@@ -30,8 +30,8 @@
#include "gui/MessageBox.h"
#ifdef WITH_XC_NETWORKING
-#include <QtNetwork>
#include <QNetworkAccessManager>
+#include <QtNetwork>
#endif
IconStruct::IconStruct()
@@ -417,7 +417,6 @@ void EditWidgetIcons::removeCustomIcon()
int iconUseCount = entriesWithSameIcon.size() + groupsWithSameIcon.size();
if (iconUseCount > 0) {
-
auto result = MessageBox::question(this,
tr("Confirm Delete"),
tr("This icon is used by %n entry(s), and will be replaced "
diff --git a/src/gui/EditWidgetProperties.cpp b/src/gui/EditWidgetProperties.cpp
index 83be745af..dbaaf4148 100644
--- a/src/gui/EditWidgetProperties.cpp
+++ b/src/gui/EditWidgetProperties.cpp
@@ -18,9 +18,9 @@
#include "EditWidgetProperties.h"
#include "ui_EditWidgetProperties.h"
+#include "MessageBox.h"
#include "core/CustomData.h"
#include "core/TimeInfo.h"
-#include "MessageBox.h"
#include <QUuid>
@@ -105,8 +105,8 @@ void EditWidgetProperties::update()
m_ui->removeCustomDataButton->setEnabled(false);
} else {
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(!m_customData->isEmpty());
}
diff --git a/src/gui/EntryPreviewWidget.cpp b/src/gui/EntryPreviewWidget.cpp
index 06280a2a5..0fd8826c8 100644
--- a/src/gui/EntryPreviewWidget.cpp
+++ b/src/gui/EntryPreviewWidget.cpp
@@ -30,8 +30,9 @@
#include "keeshare/KeeShare.h"
#endif
-namespace {
-constexpr int GeneralTabIndex = 0;
+namespace
+{
+ constexpr int GeneralTabIndex = 0;
}
EntryPreviewWidget::EntryPreviewWidget(QWidget* parent)
@@ -208,7 +209,7 @@ void EntryPreviewWidget::updateEntryGeneralTab()
const TimeInfo entryTime = m_currentEntry->timeInfo();
const QString expires =
- entryTime.expires() ? entryTime.expiryTime().toLocalTime().toString(Qt::DefaultLocaleShortDate) : tr("Never");
+ entryTime.expires() ? entryTime.expiryTime().toLocalTime().toString(Qt::DefaultLocaleShortDate) : tr("Never");
m_ui->entryExpirationLabel->setText(expires);
}
@@ -258,7 +259,7 @@ void EntryPreviewWidget::updateEntryAutotypeTab()
const auto associations = autotypeAssociations->getAll();
for (const auto& assoc : associations) {
const QString sequence =
- assoc.sequence.isEmpty() ? m_currentEntry->effectiveAutoTypeSequence() : assoc.sequence;
+ assoc.sequence.isEmpty() ? m_currentEntry->effectiveAutoTypeSequence() : assoc.sequence;
items.append(new QTreeWidgetItem(m_ui->entryAutotypeTree, {assoc.window, sequence}));
}
@@ -284,7 +285,7 @@ void EntryPreviewWidget::updateGroupGeneralTab()
const TimeInfo groupTime = m_currentGroup->timeInfo();
const QString expiresText =
- groupTime.expires() ? groupTime.expiryTime().toString(Qt::DefaultLocaleShortDate) : tr("Never");
+ groupTime.expires() ? groupTime.expiryTime().toString(Qt::DefaultLocaleShortDate) : tr("Never");
m_ui->groupExpirationLabel->setText(expiresText);
}
diff --git a/src/gui/FileDialog.cpp b/src/gui/FileDialog.cpp
index a39ee9e6b..a003bd5b7 100644
--- a/src/gui/FileDialog.cpp
+++ b/src/gui/FileDialog.cpp
@@ -193,7 +193,8 @@ QString FileDialog::getSaveFileName(QWidget* parent,
}
}
-QString FileDialog::getExistingDirectory(QWidget* parent, const QString& caption, QString dir, QFileDialog::Options options)
+QString
+FileDialog::getExistingDirectory(QWidget* parent, const QString& caption, QString dir, QFileDialog::Options options)
{
if (!m_nextDirName.isEmpty()) {
QString result = m_nextDirName;
diff --git a/src/gui/FileDialog.h b/src/gui/FileDialog.h
index 540dcb00e..eedb691da 100644
--- a/src/gui/FileDialog.h
+++ b/src/gui/FileDialog.h
@@ -29,12 +29,14 @@ public:
const QString& filter = QString(),
QString* selectedFilter = nullptr,
QFileDialog::Options options = 0);
+
QStringList getOpenFileNames(QWidget* parent = nullptr,
const QString& caption = QString(),
QString dir = QString(),
const QString& filter = QString(),
QString* selectedFilter = nullptr,
QFileDialog::Options options = 0);
+
QString getFileName(QWidget* parent = nullptr,
const QString& caption = QString(),
QString dir = QString(),
@@ -43,6 +45,7 @@ public:
QFileDialog::Options options = 0,
const QString& defaultExtension = QString(),
const QString& defaultName = QString());
+
QString getSaveFileName(QWidget* parent = nullptr,
const QString& caption = QString(),
QString dir = QString(),
@@ -51,6 +54,7 @@ public:
QFileDialog::Options options = 0,
const QString& defaultExtension = QString(),
const QString& defaultName = QString());
+
QString getExistingDirectory(QWidget* parent = nullptr,
const QString& caption = QString(),
QString dir = QString(),
diff --git a/src/gui/MainWindowAdaptor.cpp b/src/gui/MainWindowAdaptor.cpp
index 8b229ce34..95edfdd9e 100644
--- a/src/gui/MainWindowAdaptor.cpp
+++ b/src/gui/MainWindowAdaptor.cpp
@@ -1,6 +1,7 @@
/*
* This file was generated by qdbusxml2cpp version 0.8
- * Command line was: qdbusxml2cpp -c MainWindowAdaptor -a MainWindowAdaptor.h:MainWindowAdaptor.cpp org.keepassxc.MainWindow.xml
+ * Command line was: qdbusxml2cpp -c MainWindowAdaptor -a MainWindowAdaptor.h:MainWindowAdaptor.cpp
+ * org.keepassxc.MainWindow.xml
*
* qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd.
*
@@ -9,10 +10,10 @@
*/
#include "MainWindowAdaptor.h"
-#include <QtCore/QMetaObject>
#include <QtCore/QByteArray>
#include <QtCore/QList>
#include <QtCore/QMap>
+#include <QtCore/QMetaObject>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QVariant>
@@ -21,7 +22,7 @@
* Implementation of adaptor class MainWindowAdaptor
*/
-MainWindowAdaptor::MainWindowAdaptor(QObject *parent)
+MainWindowAdaptor::MainWindowAdaptor(QObject* parent)
: QDBusAbstractAdaptor(parent)
{
setAutoRelaySignals(true);
@@ -46,18 +47,18 @@ void MainWindowAdaptor::lockAllDatabases()
QMetaObject::invokeMethod(parent(), "lockAllDatabases");
}
-void MainWindowAdaptor::openDatabase(const QString &fileName)
+void MainWindowAdaptor::openDatabase(const QString& fileName)
{
QMetaObject::invokeMethod(parent(), "openDatabase", Q_ARG(QString, fileName));
}
-void MainWindowAdaptor::openDatabase(const QString &fileName, const QString &pw)
+void MainWindowAdaptor::openDatabase(const QString& fileName, const QString& pw)
{
QMetaObject::invokeMethod(parent(), "openDatabase", Q_ARG(QString, fileName), Q_ARG(QString, pw));
}
-void MainWindowAdaptor::openDatabase(const QString &fileName, const QString &pw, const QString &keyFile)
+void MainWindowAdaptor::openDatabase(const QString& fileName, const QString& pw, const QString& keyFile)
{
- QMetaObject::invokeMethod(parent(), "openDatabase", Q_ARG(QString, fileName), Q_ARG(QString, pw), Q_ARG(QString, keyFile));
+ QMetaObject::invokeMethod(
+ parent(), "openDatabase", Q_ARG(QString, fileName), Q_ARG(QString, pw), Q_ARG(QString, keyFile));
}
-
diff --git a/src/gui/MainWindowAdaptor.h b/src/gui/MainWindowAdaptor.h
index 06e0ce87e..a564f3745 100644
--- a/src/gui/MainWindowAdaptor.h
+++ b/src/gui/MainWindowAdaptor.h
@@ -1,6 +1,7 @@
/*
* This file was generated by qdbusxml2cpp version 0.8
- * Command line was: qdbusxml2cpp -c MainWindowAdaptor -a MainWindowAdaptor.h:MainWindowAdaptor.cpp org.keepassxc.MainWindow.xml
+ * Command line was: qdbusxml2cpp -c MainWindowAdaptor -a MainWindowAdaptor.h:MainWindowAdaptor.cpp
+ * org.keepassxc.MainWindow.xml
*
* qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd.
*
@@ -16,8 +17,8 @@
#include <QtDBus/QtDBus>
QT_BEGIN_NAMESPACE
class QByteArray;
-template<class T> class QList;
-template<class Key, class Value> class QMap;
+template <class T> class QList;
+template <class Key, class Value> class QMap;
class QString;
class QStringList;
class QVariant;
@@ -26,31 +27,32 @@ QT_END_NAMESPACE
/*
* Adaptor class for interface org.keepassxc.MainWindow
*/
-class MainWindowAdaptor: public QDBusAbstractAdaptor
+class MainWindowAdaptor : public QDBusAbstractAdaptor
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.keepassxc.MainWindow")
- Q_CLASSINFO("D-Bus Introspection", ""
-" <interface name=\"org.keepassxc.MainWindow\">\n"
-" <method name=\"openDatabase\">\n"
-" <arg direction=\"in\" type=\"s\" name=\"fileName\"/>\n"
-" <arg direction=\"in\" type=\"s\" name=\"pw\"/>\n"
-" <arg direction=\"in\" type=\"s\" name=\"keyFile\"/>\n"
-" </method>\n"
-" <method name=\"openDatabase\">\n"
-" <arg direction=\"in\" type=\"s\" name=\"fileName\"/>\n"
-" <arg direction=\"in\" type=\"s\" name=\"pw\"/>\n"
-" </method>\n"
-" <method name=\"openDatabase\">\n"
-" <arg direction=\"in\" type=\"s\" name=\"fileName\"/>\n"
-" </method>\n"
-" <method name=\"appExit\"/>\n"
-" <method name=\"lockAllDatabases\"/>\n"
-" <method name=\"closeAllDatabases\"/>\n"
-" </interface>\n"
- "")
+ Q_CLASSINFO("D-Bus Introspection",
+ ""
+ " <interface name=\"org.keepassxc.MainWindow\">\n"
+ " <method name=\"openDatabase\">\n"
+ " <arg direction=\"in\" type=\"s\" name=\"fileName\"/>\n"
+ " <arg direction=\"in\" type=\"s\" name=\"pw\"/>\n"
+ " <arg direction=\"in\" type=\"s\" name=\"keyFile\"/>\n"
+ " </method>\n"
+ " <method name=\"openDatabase\">\n"
+ " <arg direction=\"in\" type=\"s\" name=\"fileName\"/>\n"
+ " <arg direction=\"in\" type=\"s\" name=\"pw\"/>\n"
+ " </method>\n"
+ " <method name=\"openDatabase\">\n"
+ " <arg direction=\"in\" type=\"s\" name=\"fileName\"/>\n"
+ " </method>\n"
+ " <method name=\"appExit\"/>\n"
+ " <method name=\"lockAllDatabases\"/>\n"
+ " <method name=\"closeAllDatabases\"/>\n"
+ " </interface>\n"
+ "")
public:
- MainWindowAdaptor(QObject *parent);
+ MainWindowAdaptor(QObject* parent);
virtual ~MainWindowAdaptor();
public:
@@ -58,9 +60,9 @@ public slots:
void appExit();
void closeAllDatabases();
void lockAllDatabases();
- void openDatabase(const QString &fileName);
- void openDatabase(const QString &fileName, const QString &pw);
- void openDatabase(const QString &fileName, const QString &pw, const QString &keyFile);
+ void openDatabase(const QString& fileName);
+ void openDatabase(const QString& fileName, const QString& pw);
+ void openDatabase(const QString& fileName, const QString& pw, const QString& keyFile);
signals:
};
diff --git a/src/gui/MessageBox.cpp b/src/gui/MessageBox.cpp
index e3edd2dbf..5878aff69 100644
--- a/src/gui/MessageBox.cpp
+++ b/src/gui/MessageBox.cpp
@@ -20,49 +20,45 @@
MessageBox::Button MessageBox::m_nextAnswer(MessageBox::NoButton);
-QMap<QAbstractButton*, MessageBox::Button>
-MessageBox::m_addedButtonLookup =
+QMap<QAbstractButton*, MessageBox::Button> MessageBox::m_addedButtonLookup =
QMap<QAbstractButton*, MessageBox::Button>();
-QMap<MessageBox::Button, std::pair<QString, QMessageBox::ButtonRole>>
-MessageBox::m_buttonDefs =
+QMap<MessageBox::Button, std::pair<QString, QMessageBox::ButtonRole>> MessageBox::m_buttonDefs =
QMap<MessageBox::Button, std::pair<QString, QMessageBox::ButtonRole>>();
void MessageBox::initializeButtonDefs()
{
- m_buttonDefs =
- QMap<Button, std::pair<QString, QMessageBox::ButtonRole>>
- {
- // Reimplementation of Qt StandardButtons
- {Ok, {stdButtonText(QMessageBox::Ok), QMessageBox::ButtonRole::AcceptRole}},
- {Open, {stdButtonText(QMessageBox::Open), QMessageBox::ButtonRole::AcceptRole}},
- {Save, {stdButtonText(QMessageBox::Save), QMessageBox::ButtonRole::AcceptRole}},
- {Cancel, {stdButtonText(QMessageBox::Cancel), QMessageBox::ButtonRole::RejectRole}},
- {Close, {stdButtonText(QMessageBox::Close), QMessageBox::ButtonRole::RejectRole}},
- {Discard, {stdButtonText(QMessageBox::Discard), QMessageBox::ButtonRole::DestructiveRole}},
- {Apply, {stdButtonText(QMessageBox::Apply), QMessageBox::ButtonRole::ApplyRole}},
- {Reset, {stdButtonText(QMessageBox::Reset), QMessageBox::ButtonRole::ResetRole}},
- {RestoreDefaults, {stdButtonText(QMessageBox::RestoreDefaults), QMessageBox::ButtonRole::ResetRole}},
- {Help, {stdButtonText(QMessageBox::Help), QMessageBox::ButtonRole::HelpRole}},
- {SaveAll, {stdButtonText(QMessageBox::SaveAll), QMessageBox::ButtonRole::AcceptRole}},
- {Yes, {stdButtonText(QMessageBox::Yes), QMessageBox::ButtonRole::YesRole}},
- {YesToAll, {stdButtonText(QMessageBox::YesToAll), QMessageBox::ButtonRole::YesRole}},
- {No, {stdButtonText(QMessageBox::No), QMessageBox::ButtonRole::NoRole}},
- {NoToAll, {stdButtonText(QMessageBox::NoToAll), QMessageBox::ButtonRole::NoRole}},
- {Abort, {stdButtonText(QMessageBox::Abort), QMessageBox::ButtonRole::RejectRole}},
- {Retry, {stdButtonText(QMessageBox::Retry), QMessageBox::ButtonRole::AcceptRole}},
- {Ignore, {stdButtonText(QMessageBox::Ignore), QMessageBox::ButtonRole::AcceptRole}},
-
- // KeePassXC Buttons
- {Overwrite, {QMessageBox::tr("Overwrite"), QMessageBox::ButtonRole::AcceptRole}},
- {Delete, {QMessageBox::tr("Delete"), QMessageBox::ButtonRole::AcceptRole}},
- {Move, {QMessageBox::tr("Move"), QMessageBox::ButtonRole::AcceptRole}},
- {Empty, {QMessageBox::tr("Empty"), QMessageBox::ButtonRole::AcceptRole}},
- {Remove, {QMessageBox::tr("Remove"), QMessageBox::ButtonRole::AcceptRole}},
- {Skip, {QMessageBox::tr("Skip"), QMessageBox::ButtonRole::AcceptRole}},
- {Disable, {QMessageBox::tr("Disable"), QMessageBox::ButtonRole::AcceptRole}},
- {Merge, {QMessageBox::tr("Merge"), QMessageBox::ButtonRole::AcceptRole}},
- };
+ m_buttonDefs = QMap<Button, std::pair<QString, QMessageBox::ButtonRole>>{
+ // Reimplementation of Qt StandardButtons
+ {Ok, {stdButtonText(QMessageBox::Ok), QMessageBox::ButtonRole::AcceptRole}},
+ {Open, {stdButtonText(QMessageBox::Open), QMessageBox::ButtonRole::AcceptRole}},
+ {Save, {stdButtonText(QMessageBox::Save), QMessageBox::ButtonRole::AcceptRole}},
+ {Cancel, {stdButtonText(QMessageBox::Cancel), QMessageBox::ButtonRole::RejectRole}},
+ {Close, {stdButtonText(QMessageBox::Close), QMessageBox::ButtonRole::RejectRole}},
+ {Discard, {stdButtonText(QMessageBox::Discard), QMessageBox::ButtonRole::DestructiveRole}},
+ {Apply, {stdButtonText(QMessageBox::Apply), QMessageBox::ButtonRole::ApplyRole}},
+ {Reset, {stdButtonText(QMessageBox::Reset), QMessageBox::ButtonRole::ResetRole}},
+ {RestoreDefaults, {stdButtonText(QMessageBox::RestoreDefaults), QMessageBox::ButtonRole::ResetRole}},
+ {Help, {stdButtonText(QMessageBox::Help), QMessageBox::ButtonRole::HelpRole}},
+ {SaveAll, {stdButtonText(QMessageBox::SaveAll), QMessageBox::ButtonRole::AcceptRole}},
+ {Yes, {stdButtonText(QMessageBox::Yes), QMessageBox::ButtonRole::YesRole}},
+ {YesToAll, {stdButtonText(QMessageBox::YesToAll), QMessageBox::ButtonRole::YesRole}},
+ {No, {stdButtonText(QMessageBox::No), QMessageBox::ButtonRole::NoRole}},
+ {NoToAll, {stdButtonText(QMessageBox::NoToAll), QMessageBox::ButtonRole::NoRole}},
+ {Abort, {stdButtonText(QMessageBox::Abort), QMessageBox::ButtonRole::RejectRole}},
+ {Retry, {stdButtonText(QMessageBox::Retry), QMessageBox::ButtonRole::AcceptRole}},
+ {Ignore, {stdButtonText(QMessageBox::Ignore), QMessageBox::ButtonRole::AcceptRole}},
+
+ // KeePassXC Buttons
+ {Overwrite, {QMessageBox::tr("Overwrite"), QMessageBox::ButtonRole::AcceptRole}},
+ {Delete, {QMessageBox::tr("Delete"), QMessageBox::ButtonRole::AcceptRole}},
+ {Move, {QMessageBox::tr("Move"), QMessageBox::ButtonRole::AcceptRole}},
+ {Empty, {QMessageBox::tr("Empty"), QMessageBox::ButtonRole::AcceptRole}},
+ {Remove, {QMessageBox::tr("Remove"), QMessageBox::ButtonRole::AcceptRole}},
+ {Skip, {QMessageBox::tr("Skip"), QMessageBox::ButtonRole::AcceptRole}},
+ {Disable, {QMessageBox::tr("Disable"), QMessageBox::ButtonRole::AcceptRole}},
+ {Merge, {QMessageBox::tr("Merge"), QMessageBox::ButtonRole::AcceptRole}},
+ };
}
QString MessageBox::stdButtonText(QMessageBox::StandardButton button)
diff --git a/src/gui/MessageBox.h b/src/gui/MessageBox.h
index 816d5c865..ded415f6a 100644
--- a/src/gui/MessageBox.h
+++ b/src/gui/MessageBox.h
@@ -19,52 +19,54 @@
#ifndef KEEPASSX_MESSAGEBOX_H
#define KEEPASSX_MESSAGEBOX_H
+#include <QMap>
#include <QMessageBox>
#include <QPushButton>
-#include <QMap>
class MessageBox
{
public:
- enum Button : uint64_t {
+ enum Button : uint64_t
+ {
// Reimplementation of Qt StandardButtons
- NoButton = 0,
- Ok = 1 << 1,
- Open = 1 << 2,
- Save = 1 << 3,
- Cancel = 1 << 4,
- Close = 1 << 5,
- Discard = 1 << 6,
- Apply = 1 << 7,
- Reset = 1 << 8,
+ NoButton = 0,
+ Ok = 1 << 1,
+ Open = 1 << 2,
+ Save = 1 << 3,
+ Cancel = 1 << 4,
+ Close = 1 << 5,
+ Discard = 1 << 6,
+ Apply = 1 << 7,
+ Reset = 1 << 8,
RestoreDefaults = 1 << 9,
- Help = 1 << 10,
- SaveAll = 1 << 11,
- Yes = 1 << 12,
- YesToAll = 1 << 13,
- No = 1 << 14,
- NoToAll = 1 << 15,
- Abort = 1 << 16,
- Retry = 1 << 17,
- Ignore = 1 << 18,
+ Help = 1 << 10,
+ SaveAll = 1 << 11,
+ Yes = 1 << 12,
+ YesToAll = 1 << 13,
+ No = 1 << 14,
+ NoToAll = 1 << 15,
+ Abort = 1 << 16,
+ Retry = 1 << 17,
+ Ignore = 1 << 18,
// KeePassXC Buttons
- Overwrite = 1 << 19,
- Delete = 1 << 20,
- Move = 1 << 21,
- Empty = 1 << 22,
- Remove = 1 << 23,
- Skip = 1 << 24,
- Disable = 1 << 25,
- Merge = 1 << 26,
+ Overwrite = 1 << 19,
+ Delete = 1 << 20,
+ Move = 1 << 21,
+ Empty = 1 << 22,
+ Remove = 1 << 23,
+ Skip = 1 << 24,
+ Disable = 1 << 25,
+ Merge = 1 << 26,
// Internal loop markers. Update Last when new KeePassXC button is added
First = Ok,
Last = Merge,
};
- enum Action {
- None = 0,
+ enum Action
+ {
+ None = 0,
Raise = 1,
};
@@ -102,7 +104,7 @@ private:
static Button m_nextAnswer;
static QMap<QAbstractButton*, Button> m_addedButtonLookup;
static QMap<Button, std::pair<QString, QMessageBox::ButtonRole>> m_buttonDefs;
-
+
static Button messageBox(QWidget* parent,
QMessageBox::Icon icon,
const QString& title,
@@ -112,9 +114,6 @@ private:
Action action = MessageBox::None);
static QString stdButtonText(QMessageBox::StandardButton button);
-
-
-
};
#endif // KEEPASSX_MESSAGEBOX_H
diff --git a/src/gui/SearchWidget.cpp b/src/gui/SearchWidget.cpp
index 86e18dca3..c657dc1bd 100644
--- a/src/gui/SearchWidget.cpp
+++ b/src/gui/SearchWidget.cpp
@@ -17,8 +17,8 @@
*/
#include "SearchWidget.h"
-#include "ui_SearchWidget.h"
#include "ui_SearchHelpWidget.h"
+#include "ui_SearchWidget.h"
#include <QKeyEvent>
#include <QMenu>
@@ -38,7 +38,7 @@ SearchWidget::SearchWidget(QWidget* parent)
m_ui->setupUi(this);
m_helpWidget = new PopupHelpWidget(m_ui->searchEdit);
- m_helpWidget->setOffset(QPoint(0,1));
+ m_helpWidget->setOffset(QPoint(0, 1));
Ui::SearchHelpWidget helpUi;
helpUi.setupUi(m_helpWidget);
@@ -56,7 +56,7 @@ SearchWidget::SearchWidget(QWidget* parent)
new QShortcut(Qt::Key_Escape, m_ui->searchEdit, SLOT(clear()), nullptr, Qt::ApplicationShortcut);
m_ui->searchEdit->setPlaceholderText(tr("Search (%1)...", "Search placeholder text, %1 is the keyboard shortcut")
- .arg(QKeySequence(QKeySequence::Find).toString(QKeySequence::NativeText)));
+ .arg(QKeySequence(QKeySequence::Find).toString(QKeySequence::NativeText)));
m_ui->searchEdit->installEventFilter(this);
QMenu* searchMenu = new QMenu();
diff --git a/src/gui/WelcomeWidget.cpp b/src/gui/WelcomeWidget.cpp
index 9acb0a575..e5e603672 100644
--- a/src/gui/WelcomeWidget.cpp
+++ b/src/gui/WelcomeWidget.cpp
@@ -16,9 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <QKeyEvent>
#include "WelcomeWidget.h"
#include "ui_WelcomeWidget.h"
+#include <QKeyEvent>
#include "config-keepassx.h"
#include "core/Config.h"
@@ -78,7 +78,8 @@ void WelcomeWidget::refreshLastDatabases()
}
}
-void WelcomeWidget::keyPressEvent(QKeyEvent *event) {
+void WelcomeWidget::keyPressEvent(QKeyEvent* event)
+{
if (m_ui->recentListWidget->hasFocus() && (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter)) {
openDatabaseFromFile(m_ui->recentListWidget->currentItem());
}
diff --git a/src/gui/WelcomeWidget.h b/src/gui/WelcomeWidget.h
index 53565902f..54827e026 100644
--- a/src/gui/WelcomeWidget.h
+++ b/src/gui/WelcomeWidget.h
@@ -44,7 +44,7 @@ signals:
void importCsv();
protected:
- void keyPressEvent(QKeyEvent *event) override;
+ void keyPressEvent(QKeyEvent* event) override;
private slots:
void openDatabaseFromFile(QListWidgetItem* item);
diff --git a/src/gui/dbsettings/DatabaseSettingsDialog.cpp b/src/gui/dbsettings/DatabaseSettingsDialog.cpp
index 5a75127c2..550319777 100644
--- a/src/gui/dbsettings/DatabaseSettingsDialog.cpp
+++ b/src/gui/dbsettings/DatabaseSettingsDialog.cpp
@@ -29,18 +29,18 @@
#include "keeshare/DatabaseSettingsPageKeeShare.h"
#endif
-#include "core/Global.h"
#include "core/Config.h"
#include "core/Database.h"
#include "core/FilePath.h"
+#include "core/Global.h"
#include "touchid/TouchID.h"
class DatabaseSettingsDialog::ExtraPage
{
public:
ExtraPage(IDatabaseSettingsPage* page, QWidget* widget)
- : settingsPage(page)
- , widget(widget)
+ : settingsPage(page)
+ , widget(widget)
{
}
void loadSettings(QSharedPointer<Database> db) const
@@ -51,6 +51,7 @@ public:
{
settingsPage->saveSettings(widget);
}
+
private:
QSharedPointer<IDatabaseSettingsPage> settingsPage;
QWidget* widget;
diff --git a/src/gui/dbsettings/DatabaseSettingsWidgetBrowser.cpp b/src/gui/dbsettings/DatabaseSettingsWidgetBrowser.cpp
index fc86ca5a7..fac85c21e 100644
--- a/src/gui/dbsettings/DatabaseSettingsWidgetBrowser.cpp
+++ b/src/gui/dbsettings/DatabaseSettingsWidgetBrowser.cpp
@@ -175,9 +175,9 @@ void DatabaseSettingsWidgetBrowser::removeSharedEncryptionKeys()
if (keysToRemove.isEmpty()) {
MessageBox::information(this,
- tr("KeePassXC: No keys found"),
- tr("No shared encryption keys found in KeePassXC settings."),
- MessageBox::Ok);
+ tr("KeePassXC: No keys found"),
+ tr("No shared encryption keys found in KeePassXC settings."),
+ MessageBox::Ok);
return;
}
@@ -187,9 +187,9 @@ void DatabaseSettingsWidgetBrowser::removeSharedEncryptionKeys()
const int count = keysToRemove.count();
MessageBox::information(this,
- tr("KeePassXC: Removed keys from database"),
- tr("Successfully removed %n encryption key(s) from KeePassXC settings.", "", count),
- MessageBox::Ok);
+ tr("KeePassXC: Removed keys from database"),
+ tr("Successfully removed %n encryption key(s) from KeePassXC settings.", "", count),
+ MessageBox::Ok);
}
void DatabaseSettingsWidgetBrowser::removeStoredPermissions()
@@ -227,14 +227,14 @@ void DatabaseSettingsWidgetBrowser::removeStoredPermissions()
if (counter > 0) {
MessageBox::information(this,
- tr("KeePassXC: Removed permissions"),
- tr("Successfully removed permissions from %n entry(s).", "", counter),
- MessageBox::Ok);
+ tr("KeePassXC: Removed permissions"),
+ tr("Successfully removed permissions from %n entry(s).", "", counter),
+ MessageBox::Ok);
} else {
MessageBox::information(this,
- tr("KeePassXC: No entry with permissions found!"),
- tr("The active database does not contain an entry with permissions."),
- MessageBox::Ok);
+ tr("KeePassXC: No entry with permissions found!"),
+ tr("The active database does not contain an entry with permissions."),
+ MessageBox::Ok);
}
}
diff --git a/src/gui/entry/EditEntryWidget.cpp b/src/gui/entry/EditEntryWidget.cpp
index 828784675..c85dbdfa0 100644
--- a/src/gui/entry/EditEntryWidget.cpp
+++ b/src/gui/entry/EditEntryWidget.cpp
@@ -138,7 +138,6 @@ void EditEntryWidget::setupMain()
m_mainUi->fetchFaviconButton->setVisible(false);
#endif
-
connect(m_mainUi->togglePasswordButton, SIGNAL(toggled(bool)), m_mainUi->passwordEdit, SLOT(setShowPassword(bool)));
connect(m_mainUi->togglePasswordGeneratorButton, SIGNAL(toggled(bool)), SLOT(togglePasswordGeneratorButton(bool)));
#ifdef WITH_XC_NETWORKING
@@ -309,8 +308,8 @@ void EditEntryWidget::setupEntryUpdate()
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()));
}
@@ -370,7 +369,9 @@ void EditEntryWidget::setupSSHAgent()
connect(m_sshAgentUi->decryptButton, SIGNAL(clicked()), SLOT(decryptPrivateKey()));
connect(m_sshAgentUi->copyToClipboardButton, SIGNAL(clicked()), SLOT(copyPublicKey()));
- connect(m_advancedUi->attachmentsWidget->entryAttachments(), SIGNAL(entryAttachmentsModified()), SLOT(updateSSHAgentAttachments()));
+ connect(m_advancedUi->attachmentsWidget->entryAttachments(),
+ SIGNAL(entryAttachmentsModified()),
+ SLOT(updateSSHAgentAttachments()));
addPage(tr("SSH Agent"), FilePath::instance()->icon("apps", "utilities-terminal"), m_sshAgentWidget);
}
@@ -591,8 +592,8 @@ void EditEntryWidget::addKeyToAgent()
lifetime = m_sshAgentUi->lifetimeSpinBox->value();
}
- if (!SSHAgent::instance()->addIdentity(key, m_sshAgentUi->removeKeyFromAgentCheckBox->isChecked(),
- static_cast<quint32>(lifetime), confirm)) {
+ if (!SSHAgent::instance()->addIdentity(
+ key, m_sshAgentUi->removeKeyFromAgentCheckBox->isChecked(), static_cast<quint32>(lifetime), confirm)) {
showMessage(SSHAgent::instance()->errorString(), MessageWidget::Error);
return;
}
@@ -662,7 +663,11 @@ QString EditEntryWidget::entryTitle() const
}
}
-void EditEntryWidget::loadEntry(Entry* entry, bool create, bool history, const QString& parentName, QSharedPointer<Database> database)
+void EditEntryWidget::loadEntry(Entry* entry,
+ bool create,
+ bool history,
+ const QString& parentName,
+ QSharedPointer<Database> database)
{
m_entry = entry;
m_db = std::move(database);
diff --git a/src/gui/entry/EditEntryWidget.h b/src/gui/entry/EditEntryWidget.h
index e2b678a9e..07a4b7895 100644
--- a/src/gui/entry/EditEntryWidget.h
+++ b/src/gui/entry/EditEntryWidget.h
@@ -21,9 +21,8 @@
#include <QButtonGroup>
#include <QModelIndex>
-#include <QScopedPointer>
-#include <QButtonGroup>
#include <QPointer>
+#include <QScopedPointer>
#include "config-keepassx.h"
#include "gui/EditWidget.h"
@@ -64,8 +63,8 @@ public:
explicit EditEntryWidget(QWidget* parent = nullptr);
~EditEntryWidget() override;
- void loadEntry(Entry* entry, bool create, bool history, const QString& parentName,
- QSharedPointer<Database> database);
+ void
+ loadEntry(Entry* entry, bool create, bool history, const QString& parentName, QSharedPointer<Database> database);
QString entryTitle() const;
void clear();
diff --git a/src/gui/entry/EntryAttachmentsWidget.cpp b/src/gui/entry/EntryAttachmentsWidget.cpp
index a3eb38a43..e34139cc5 100644
--- a/src/gui/entry/EntryAttachmentsWidget.cpp
+++ b/src/gui/entry/EntryAttachmentsWidget.cpp
@@ -223,11 +223,8 @@ void EntryAttachmentsWidget::saveSelectedAttachments()
const QString questionText(
tr("Are you sure you want to overwrite the existing file \"%1\" with the attachment?"));
- auto result = MessageBox::question(this,
- tr("Confirm overwrite"),
- questionText.arg(filename),
- buttons,
- MessageBox::Cancel);
+ auto result = MessageBox::question(
+ this, tr("Confirm overwrite"), questionText.arg(filename), buttons, MessageBox::Cancel);
if (result == MessageBox::Skip) {
continue;
diff --git a/src/gui/entry/EntryModel.cpp b/src/gui/entry/EntryModel.cpp
index 194c4b571..04b6abc17 100644
--- a/src/gui/entry/EntryModel.cpp
+++ b/src/gui/entry/EntryModel.cpp
@@ -469,7 +469,7 @@ bool EntryModel::isUsernamesHidden() const
void EntryModel::setUsernamesHidden(bool hide)
{
m_hideUsernames = hide;
- emit dataChanged(index(0, 0), index(rowCount()-1, columnCount() - 1));
+ emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
emit usernamesHiddenChanged();
}
@@ -487,7 +487,7 @@ bool EntryModel::isPasswordsHidden() const
void EntryModel::setPasswordsHidden(bool hide)
{
m_hidePasswords = hide;
- emit dataChanged(index(0, 0), index(rowCount()-1, columnCount() - 1));
+ emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
emit passwordsHiddenChanged();
}
diff --git a/src/gui/group/EditGroupWidget.cpp b/src/gui/group/EditGroupWidget.cpp
index abfc26412..4acad5339 100644
--- a/src/gui/group/EditGroupWidget.cpp
+++ b/src/gui/group/EditGroupWidget.cpp
@@ -31,8 +31,8 @@ class EditGroupWidget::ExtraPage
{
public:
ExtraPage(IEditGroupPage* page, QWidget* widget)
- : editPage(page)
- , widget(widget)
+ : editPage(page)
+ , widget(widget)
{
}
@@ -52,12 +52,12 @@ private:
};
EditGroupWidget::EditGroupWidget(QWidget* parent)
- : EditWidget(parent)
- , m_mainUi(new Ui::EditGroupWidgetMain())
- , m_editGroupWidgetMain(new QWidget())
- , m_editGroupWidgetIcons(new EditWidgetIcons())
- , m_editWidgetProperties(new EditWidgetProperties())
- , m_group(nullptr)
+ : EditWidget(parent)
+ , m_mainUi(new Ui::EditGroupWidgetMain())
+ , m_editGroupWidgetMain(new QWidget())
+ , m_editGroupWidgetIcons(new EditWidgetIcons())
+ , m_editWidgetProperties(new EditWidgetProperties())
+ , m_group(nullptr)
{
m_mainUi->setupUi(m_editGroupWidgetMain);
diff --git a/src/gui/widgets/PopupHelpWidget.h b/src/gui/widgets/PopupHelpWidget.h
index 66dac2b30..3c02ccc1a 100644
--- a/src/gui/widgets/PopupHelpWidget.h
+++ b/src/gui/widgets/PopupHelpWidget.h
@@ -18,8 +18,8 @@
#ifndef KEEPASSXC_POPUPHELPWIDGET_H
#define KEEPASSXC_POPUPHELPWIDGET_H
-#include <QPointer>
#include <QFrame>
+#include <QPointer>
class PopupHelpWidget : public QFrame
{
@@ -44,5 +44,4 @@ private:
Qt::Corner m_corner;
};
-
-#endif //KEEPASSXC_POPUPHELPWIDGET_H
+#endif // KEEPASSXC_POPUPHELPWIDGET_H
diff --git a/src/gui/wizard/NewDatabaseWizard.cpp b/src/gui/wizard/NewDatabaseWizard.cpp
index 5174fcacc..eaadc53ff 100644
--- a/src/gui/wizard/NewDatabaseWizard.cpp
+++ b/src/gui/wizard/NewDatabaseWizard.cpp
@@ -34,7 +34,7 @@ NewDatabaseWizard::NewDatabaseWizard(QWidget* parent)
{
setWizardStyle(QWizard::MacStyle);
setOption(QWizard::WizardOption::HaveHelpButton, false);
- setOption(QWizard::WizardOption::NoDefaultButton, false); // Needed for macOS
+ setOption(QWizard::WizardOption::NoDefaultButton, false); // Needed for macOS
// clang-format off
m_pages << new NewDatabaseWizardPageMetaData()
diff --git a/src/keeshare/ShareObserver.cpp b/src/keeshare/ShareObserver.cpp
index 8f2e2c3ab..1660a0990 100644
--- a/src/keeshare/ShareObserver.cpp
+++ b/src/keeshare/ShareObserver.cpp
@@ -367,8 +367,8 @@ ShareObserver::Result ShareObserver::importSingedContainerInto(const KeeShareSet
case UntrustedForever:
case TrustedForever: {
bool found = false;
- const auto trusted = trust.first == TrustedForever ? KeeShareSettings::Trust::Trusted
- : KeeShareSettings::Trust::Untrusted;
+ const auto trusted =
+ trust.first == TrustedForever ? KeeShareSettings::Trust::Trusted : KeeShareSettings::Trust::Untrusted;
for (KeeShareSettings::ScopedCertificate& scopedCertificate : foreign.certificates) {
if (scopedCertificate.certificate.key == trust.second.key && scopedCertificate.path == reference.path) {
scopedCertificate.certificate.signer = trust.second.signer;
@@ -454,8 +454,8 @@ ShareObserver::Result ShareObserver::importUnsignedContainerInto(const KeeShareS
case UntrustedForever:
case TrustedForever: {
bool found = false;
- const auto trusted = trust.first == TrustedForever ? KeeShareSettings::Trust::Trusted
- : KeeShareSettings::Trust::Untrusted;
+ const auto trusted =
+ trust.first == TrustedForever ? KeeShareSettings::Trust::Trusted : KeeShareSettings::Trust::Untrusted;
for (KeeShareSettings::ScopedCertificate& scopedCertificate : foreign.certificates) {
if (scopedCertificate.certificate.key == trust.second.key && scopedCertificate.path == reference.path) {
scopedCertificate.certificate.signer = trust.second.signer;
diff --git a/src/keys/YkChallengeResponseKey.cpp b/src/keys/YkChallengeResponseKey.cpp
index ee413aeac..f9cbe3174 100644
--- a/src/keys/YkChallengeResponseKey.cpp
+++ b/src/keys/YkChallengeResponseKey.cpp
@@ -67,9 +67,8 @@ bool YkChallengeResponseKey::challenge(const QByteArray& challenge, unsigned int
emit userInteractionRequired();
}
- auto result = AsyncTask::runAndWaitForFuture([this, challenge]() {
- return YubiKey::instance()->challenge(m_slot, true, challenge, m_key);
- });
+ auto result = AsyncTask::runAndWaitForFuture(
+ [this, challenge]() { return YubiKey::instance()->challenge(m_slot, true, challenge, m_key); });
if (m_blocking) {
emit userConfirmed();
diff --git a/src/keys/drivers/YubiKey.cpp b/src/keys/drivers/YubiKey.cpp
index 6a9843b44..884be354b 100644
--- a/src/keys/drivers/YubiKey.cpp
+++ b/src/keys/drivers/YubiKey.cpp
@@ -211,7 +211,7 @@ YubiKey::ChallengeResult YubiKey::challenge(int slot, bool mayBlock, const QByte
*/
if (yk_errno == YK_EUSBERR) {
- qWarning("USB error: %s", yk_usb_strerror());
+ qWarning("USB error: %s", yk_usb_strerror());
} else {
qWarning("YubiKey core error: %s", yk_strerror(yk_errno));
}
diff --git a/src/sshagent/SSHAgent.cpp b/src/sshagent/SSHAgent.cpp
index c173d84a9..c2ef7084a 100644
--- a/src/sshagent/SSHAgent.cpp
+++ b/src/sshagent/SSHAgent.cpp
@@ -18,10 +18,10 @@
#include "SSHAgent.h"
-#include "crypto/ssh/OpenSSHKey.h"
+#include "core/Config.h"
#include "crypto/ssh/BinaryStream.h"
+#include "crypto/ssh/OpenSSHKey.h"
#include "sshagent/KeeAgentSettings.h"
-#include "core/Config.h"
#include <QtNetwork>
@@ -371,8 +371,8 @@ void SSHAgent::databaseModeChanged()
lifetime = static_cast<quint32>(settings.lifetimeConstraintDuration());
}
- if (!addIdentity(key, settings.removeAtDatabaseClose(),
- lifetime, settings.useConfirmConstraintWhenAdding())) {
+ if (!addIdentity(
+ key, settings.removeAtDatabaseClose(), lifetime, settings.useConfirmConstraintWhenAdding())) {
emit error(m_error);
}
}
diff --git a/src/sshagent/SSHAgent.h b/src/sshagent/SSHAgent.h
index 426c00a65..90adfa82f 100644
--- a/src/sshagent/SSHAgent.h
+++ b/src/sshagent/SSHAgent.h
@@ -19,12 +19,12 @@
#ifndef KEEPASSXC_SSHAGENT_H
#define KEEPASSXC_SSHAGENT_H
-#include <QList>
#include <QHash>
+#include <QList>
#include <QtCore>
-#include "gui/DatabaseWidget.h"
#include "crypto/ssh/OpenSSHKey.h"
+#include "gui/DatabaseWidget.h"
class SSHAgent : public QObject
{