Ran make format

This commit is contained in:
Jonathan White 2019-03-19 14:48:33 -04:00
parent 306bf0f292
commit fb5faf0ff5
No known key found for this signature in database
GPG Key ID: 440FC65F2E0C6E01
19 changed files with 79 additions and 83 deletions

View File

@ -21,11 +21,11 @@
#include "NativeMessagingBase.h"
#include "config-keepassx.h"
#include <QJsonDocument>
#include <QJsonParseError>
#include <sodium.h>
#include <sodium/crypto_box.h>
#include <sodium/randombytes.h>
#include <QJsonDocument>
#include <QJsonParseError>
BrowserAction::BrowserAction(BrowserService& browserService)
: m_mutex(QMutex::Recursive)

View File

@ -140,9 +140,8 @@ void BrowserOptionDialog::loadSettings()
m_ui->updateBinaryPath->setChecked(false);
m_ui->updateBinaryPath->setEnabled(false);
// Show notice to user
m_ui->browserGlobalWarningWidget->showMessage(
tr("Please see special instructions for browser extension use below"),
MessageWidget::Warning);
m_ui->browserGlobalWarningWidget->showMessage(tr("Please see special instructions for browser extension use below"),
MessageWidget::Warning);
m_ui->browserGlobalWarningWidget->setCloseButtonVisible(false);
m_ui->browserGlobalWarningWidget->setAutoHideTimeout(-1);
#endif

View File

@ -202,8 +202,11 @@ QJsonObject BrowserService::createNewGroup(const QString& groupName)
{
QJsonObject result;
if (thread() != QThread::currentThread()) {
QMetaObject::invokeMethod(this, "createNewGroup", Qt::BlockingQueuedConnection,
Q_RETURN_ARG(QJsonObject, result), Q_ARG(QString, groupName));
QMetaObject::invokeMethod(this,
"createNewGroup",
Qt::BlockingQueuedConnection,
Q_RETURN_ARG(QJsonObject, result),
Q_ARG(QString, groupName));
return result;
}
@ -229,7 +232,8 @@ QJsonObject BrowserService::createNewGroup(const QString& groupName)
auto dialogResult = MessageBox::warning(nullptr,
tr("KeePassXC: Create a new group"),
tr("A request for creating a new group \"%1\" has been received.\n"
"Do you want to create this group?\n").arg(groupName),
"Do you want to create this group?\n")
.arg(groupName),
MessageBox::Yes | MessageBox::No);
if (dialogResult != MessageBox::Yes) {
@ -243,18 +247,18 @@ QJsonObject BrowserService::createNewGroup(const QString& groupName)
// Returns the group name based on depth
auto getGroupName = [&](int depth) {
QString gName;
for (int i = 0; i < depth+1; ++i) {
for (int i = 0; i < depth + 1; ++i) {
gName.append((i == 0 ? "" : "/") + groups[i]);
}
return gName;
};
// Create new group(s) always when the path is not found
for (int i = 0; i < groups.length(); ++i) {
QString gName = getGroupName(i);
auto tempGroup = rootGroup->findGroupByPath(gName);
if (!tempGroup) {
Group* newGroup = new Group();
Group* newGroup = new Group();
newGroup->setName(groups[i]);
newGroup->setUuid(QUuid::createUuid());
newGroup->setParent(previousGroup);
@ -266,7 +270,7 @@ QJsonObject BrowserService::createNewGroup(const QString& groupName)
previousGroup = tempGroup;
}
result["name"] = name;
result["uuid"] = uuid;
return result;
@ -1070,12 +1074,13 @@ bool BrowserService::checkLegacySettings()
return false;
}
auto dialogResult = MessageBox::warning(nullptr,
tr("KeePassXC: Legacy browser integration settings detected"),
tr("Your KeePassXC-Browser settings need to be moved into the database settings.\n"
"This is necessary to maintain your current browser connections.\n"
"Would you like to migrate your existing settings now?"),
MessageBox::Yes | MessageBox::No);
auto dialogResult =
MessageBox::warning(nullptr,
tr("KeePassXC: Legacy browser integration settings detected"),
tr("Your KeePassXC-Browser settings need to be moved into the database settings.\n"
"This is necessary to maintain your current browser connections.\n"
"Would you like to migrate your existing settings now?"),
MessageBox::Yes | MessageBox::No);
return dialogResult == MessageBox::Yes;
}

View File

@ -514,8 +514,10 @@ void Database::setCompressionAlgorithm(Database::CompressionAlgorithm algo)
* @param transformKey trigger the KDF after setting the key
* @return true on success
*/
bool Database::setKey(const QSharedPointer<const CompositeKey>& key, bool updateChangedTime,
bool updateTransformSalt, bool transformKey)
bool Database::setKey(const QSharedPointer<const CompositeKey>& key,
bool updateChangedTime,
bool updateTransformSalt,
bool transformKey)
{
Q_ASSERT(!m_data.isReadOnly);

View File

@ -103,7 +103,7 @@ QList<Entry*> EntrySearcher::repeatEntries(const QList<Entry*>& entries)
/**
* Set the next search to be case sensitive or not
*
* @param state
* @param state
*/
void EntrySearcher::setCaseSensitive(bool state)
{

View File

@ -20,8 +20,8 @@
#include <QByteArray>
#include "gui/MainWindow.h"
#include "autotype/AutoType.h"
#include "gui/MainWindow.h"
#ifdef Q_OS_WIN
#include <windows.h>
#endif

View File

@ -125,9 +125,8 @@ Application::Application(int& argc, char** argv)
break;
}
default:
qWarning() << QObject::tr("The lock file could not be created. Single-instance mode disabled.")
.toUtf8()
.constData();
qWarning()
<< QObject::tr("The lock file could not be created. Single-instance mode disabled.").toUtf8().constData();
}
}

View File

@ -176,7 +176,8 @@ void ApplicationSettingsWidget::loadSettings()
m_generalUi->minimizeOnCloseCheckBox->setChecked(config()->get("GUI/MinimizeOnClose").toBool());
m_generalUi->systrayMinimizeOnStartup->setChecked(config()->get("GUI/MinimizeOnStartup").toBool());
m_generalUi->checkForUpdatesOnStartupCheckBox->setChecked(config()->get("GUI/CheckForUpdates").toBool());
m_generalUi->checkForUpdatesIncludeBetasCheckBox->setChecked(config()->get("GUI/CheckForUpdatesIncludeBetas").toBool());
m_generalUi->checkForUpdatesIncludeBetasCheckBox->setChecked(
config()->get("GUI/CheckForUpdatesIncludeBetas").toBool());
m_generalUi->autoTypeAskCheckBox->setChecked(config()->get("security/autotypeask").toBool());
if (autoType()->isAvailable()) {

View File

@ -42,9 +42,9 @@
#include "keys/PasswordKey.h"
#ifdef WITH_XC_NETWORKING
#include "updatecheck/UpdateChecker.h"
#include "gui/MessageBox.h"
#include "gui/UpdateCheckDialog.h"
#include "updatecheck/UpdateChecker.h"
#endif
#ifdef WITH_XC_SSHAGENT
@ -374,7 +374,9 @@ MainWindow::MainWindow()
#ifdef WITH_XC_NETWORKING
connect(m_ui->actionCheckForUpdates, SIGNAL(triggered()), SLOT(showUpdateCheckDialog()));
connect(UpdateChecker::instance(), SIGNAL(updateCheckFinished(bool, QString, bool)), SLOT(hasUpdateAvailable(bool, QString, bool)));
connect(UpdateChecker::instance(),
SIGNAL(updateCheckFinished(bool, QString, bool)),
SLOT(hasUpdateAvailable(bool, QString, bool)));
QTimer::singleShot(3000, this, SLOT(showUpdateCheckStartup()));
#else
m_ui->actionCheckForUpdates->setVisible(false);
@ -687,12 +689,13 @@ void MainWindow::showUpdateCheckStartup()
{
#ifdef WITH_XC_NETWORKING
if (!config()->get("UpdateCheckMessageShown", false).toBool()) {
auto result = MessageBox::question(this,
tr("Check for updates on startup?"),
tr("Would you like KeePassXC to check for updates on startup?") + "\n\n" +
tr("You can always check for updates manually from the application menu."),
MessageBox::Yes | MessageBox::No,
MessageBox::Yes);
auto result =
MessageBox::question(this,
tr("Check for updates on startup?"),
tr("Would you like KeePassXC to check for updates on startup?") + "\n\n"
+ tr("You can always check for updates manually from the application menu."),
MessageBox::Yes | MessageBox::No,
MessageBox::Yes);
config()->set("GUI/CheckForUpdates", (result == MessageBox::Yes));
config()->set("UpdateCheckMessageShown", true);

View File

@ -16,9 +16,9 @@
*/
#include "UpdateCheckDialog.h"
#include "core/FilePath.h"
#include "ui_UpdateCheckDialog.h"
#include "updatecheck/UpdateChecker.h"
#include "core/FilePath.h"
UpdateCheckDialog::UpdateCheckDialog(QWidget* parent)
: QDialog(parent)
@ -31,35 +31,34 @@ UpdateCheckDialog::UpdateCheckDialog(QWidget* parent)
m_ui->iconLabel->setPixmap(filePath()->applicationIcon().pixmap(48));
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(close()));
connect(UpdateChecker::instance(), SIGNAL(updateCheckFinished(bool, QString, bool)), SLOT(showUpdateCheckResponse(bool, QString)));
connect(UpdateChecker::instance(),
SIGNAL(updateCheckFinished(bool, QString, bool)),
SLOT(showUpdateCheckResponse(bool, QString)));
}
void UpdateCheckDialog::showUpdateCheckResponse(bool status, const QString& version) {
void UpdateCheckDialog::showUpdateCheckResponse(bool status, const QString& version)
{
m_ui->progressBar->setVisible(false);
m_ui->buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Close"));
if (version == QString("error")) {
setWindowTitle(tr("Update Error!"));
m_ui->statusLabel->setText(
"<strong>" + tr("Update Error!") + "</strong><br><br>" +
tr("An error occurred in retrieving update information.") + "<br>" +
tr("Please try again later."));
m_ui->statusLabel->setText("<strong>" + tr("Update Error!") + "</strong><br><br>"
+ tr("An error occurred in retrieving update information.") + "<br>"
+ tr("Please try again later."));
return;
}
if (status) {
setWindowTitle(tr("Software Update"));
m_ui->statusLabel->setText(
"<strong>" + tr("A new version of KeePassXC is available!") + "</strong><br><br>" +
tr("KeePassXC %1 is now available — you have %2.").arg(version, KEEPASSXC_VERSION) + "<br><br>" +
"<a href='https://keepassxc.org/download/'>" +
tr("Download it at keepassxc.org") +
"</a>");
m_ui->statusLabel->setText("<strong>" + tr("A new version of KeePassXC is available!") + "</strong><br><br>"
+ tr("KeePassXC %1 is now available — you have %2.").arg(version, KEEPASSXC_VERSION)
+ "<br><br>" + "<a href='https://keepassxc.org/download/'>"
+ tr("Download it at keepassxc.org") + "</a>");
} else {
setWindowTitle(tr("You're up-to-date!"));
m_ui->statusLabel->setText(tr(
"KeePassXC %1 is currently the newest version available").arg(KEEPASSXC_VERSION));
m_ui->statusLabel->setText(tr("KeePassXC %1 is currently the newest version available").arg(KEEPASSXC_VERSION));
}
}

View File

@ -18,13 +18,13 @@
#ifndef KEEPASSXC_UPDATECHECKDIALOG_H
#define KEEPASSXC_UPDATECHECKDIALOG_H
#include <QUrl>
#include <QDialog>
#include <QScopedPointer>
#include "gui/MessageBox.h"
#include "config-keepassx.h"
#include "core/Global.h"
#include "gui/MessageBox.h"
#include "updatecheck/UpdateChecker.h"
#include <QDialog>
#include <QScopedPointer>
#include <QUrl>
namespace Ui
{
@ -33,7 +33,7 @@ namespace Ui
class UpdateCheckDialog : public QDialog
{
Q_OBJECT
Q_OBJECT
public:
explicit UpdateCheckDialog(QWidget* parent = nullptr);
@ -46,5 +46,4 @@ private:
QScopedPointer<Ui::UpdateCheckDialog> m_ui;
};
#endif //KEEPASSXC_UPDATECHECKDIALOG_H
#endif // KEEPASSXC_UPDATECHECKDIALOG_H

View File

@ -127,8 +127,7 @@ void DatabaseSettingsWidgetEncryption::setupAlgorithmComboBox()
{
m_ui->algorithmComboBox->clear();
for (auto& cipher : asConst(KeePass2::CIPHERS)) {
m_ui->algorithmComboBox->addItem(cipher.second.toUtf8(),
cipher.first.toByteArray());
m_ui->algorithmComboBox->addItem(cipher.second.toUtf8(), cipher.first.toByteArray());
}
int cipherIndex = m_ui->algorithmComboBox->findData(m_db->cipher().toByteArray());
if (cipherIndex > -1) {
@ -142,8 +141,7 @@ void DatabaseSettingsWidgetEncryption::setupKdfComboBox()
bool block = m_ui->kdfComboBox->blockSignals(true);
m_ui->kdfComboBox->clear();
for (auto& kdf : asConst(KeePass2::KDFS)) {
m_ui->kdfComboBox->addItem(kdf.second.toUtf8(),
kdf.first.toByteArray());
m_ui->kdfComboBox->addItem(kdf.second.toUtf8(), kdf.first.toByteArray());
}
m_ui->kdfComboBox->blockSignals(block);
}

View File

@ -67,19 +67,13 @@ int main(int argc, char** argv)
Bootstrap::bootstrapApplication();
QCommandLineParser parser;
parser.setApplicationDescription(
QObject::tr("KeePassXC - cross-platform password manager"));
parser.setApplicationDescription(QObject::tr("KeePassXC - cross-platform password manager"));
parser.addPositionalArgument(
"filename",
QObject::tr("filenames of the password databases to open (*.kdbx)"),
"[filename(s)]");
"filename", QObject::tr("filenames of the password databases to open (*.kdbx)"), "[filename(s)]");
QCommandLineOption configOption(
"config", QObject::tr("path to a custom config file"), "config");
QCommandLineOption keyfileOption(
"keyfile", QObject::tr("key file of the database"), "keyfile");
QCommandLineOption pwstdinOption("pw-stdin",
QObject::tr("read password of the database from stdin"));
QCommandLineOption configOption("config", QObject::tr("path to a custom config file"), "config");
QCommandLineOption keyfileOption("keyfile", QObject::tr("key file of the database"), "keyfile");
QCommandLineOption pwstdinOption("pw-stdin", QObject::tr("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",
@ -106,9 +100,7 @@ int main(int argc, char** argv)
if (!fileNames.isEmpty()) {
app.sendFileNamesToRunningInstance(fileNames);
}
qWarning() << QObject::tr("Another instance of KeePassXC is already running.")
.toUtf8()
.constData();
qWarning() << QObject::tr("Another instance of KeePassXC is already running.").toUtf8().constData();
return 0;
}

View File

@ -77,7 +77,7 @@ int main(int argc, char* argv[])
#ifndef Q_OS_WIN
catchUnixSignals({SIGQUIT, SIGINT, SIGTERM, SIGHUP});
#else
SetConsoleCtrlHandler(static_cast<PHANDLER_ROUTINE>(ConsoleHandler),TRUE);
SetConsoleCtrlHandler(static_cast<PHANDLER_ROUTINE>(ConsoleHandler), TRUE);
#endif
NativeMessagingHost host;
return a.exec();

View File

@ -16,11 +16,11 @@
*/
#include "UpdateChecker.h"
#include "core/Config.h"
#include "config-keepassx.h"
#include "core/Config.h"
#include <QJsonObject>
#include <QtNetwork>
#include <QNetworkAccessManager>
#include <QtNetwork>
UpdateChecker* UpdateChecker::m_instance(nullptr);

View File

@ -17,8 +17,8 @@
#ifndef KEEPASSXC_UPDATECHECK_H
#define KEEPASSXC_UPDATECHECK_H
#include <QString>
#include <QObject>
#include <QString>
class QNetworkAccessManager;
class QNetworkReply;
@ -57,4 +57,4 @@ inline UpdateChecker* updateCheck()
return UpdateChecker::instance();
}
#endif //KEEPASSXC_UPDATECHECK_H
#endif // KEEPASSXC_UPDATECHECK_H

View File

@ -811,7 +811,6 @@ void TestGroup::testCopyDataFrom()
group3->setName("TestGroup3");
group3->customData()->set("testKey", "value");
QSignalSpy spyGroupModified(group.data(), SIGNAL(groupModified()));
QSignalSpy spyGroupDataChanged(group.data(), SIGNAL(groupDataChanged(Group*)));

View File

@ -17,8 +17,8 @@
#include "TestUpdateCheck.h"
#include "TestGlobal.h"
#include "updatecheck/UpdateChecker.h"
#include "crypto/Crypto.h"
#include "updatecheck/UpdateChecker.h"
QTEST_GUILESS_MAIN(TestUpdateCheck)
@ -29,7 +29,7 @@ void TestUpdateCheck::initTestCase()
void TestUpdateCheck::testCompareVersion()
{
// Remote Version , Installed Version
// Remote Version , Installed Version
QCOMPARE(UpdateChecker::compareVersions(QString("2.4.0"), QString("2.3.4")), true);
QCOMPARE(UpdateChecker::compareVersions(QString("2.3.0"), QString("2.4.0")), false);
QCOMPARE(UpdateChecker::compareVersions(QString("2.3.0"), QString("2.3.0")), false);

View File

@ -22,7 +22,7 @@
class TestUpdateCheck : public QObject
{
Q_OBJECT
Q_OBJECT
private slots:
void initTestCase();