Skip to content

Commit

Permalink
Code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
droidmonkey committed May 12, 2019
1 parent b738e07 commit 31b54ca
Show file tree
Hide file tree
Showing 27 changed files with 63 additions and 60 deletions.
4 changes: 2 additions & 2 deletions src/autotype/AutoTypeFilterLineEdit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "AutoTypeFilterLineEdit.h"
#include <QKeyEvent>

void AutoTypeFilterLineEdit::keyPressEvent(QKeyEvent *event)
void AutoTypeFilterLineEdit::keyPressEvent(QKeyEvent* event)
{
if (event->key() == Qt::Key_Up) {
emit keyUpPressed();
Expand All @@ -29,7 +29,7 @@ void AutoTypeFilterLineEdit::keyPressEvent(QKeyEvent *event)
}
}

void AutoTypeFilterLineEdit::keyReleaseEvent(QKeyEvent *event)
void AutoTypeFilterLineEdit::keyReleaseEvent(QKeyEvent* event)
{
if (event->key() == Qt::Key_Escape) {
emit escapeReleased();
Expand Down
10 changes: 7 additions & 3 deletions src/autotype/AutoTypeFilterLineEdit.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@ class AutoTypeFilterLineEdit : public QLineEdit
Q_OBJECT

public:
AutoTypeFilterLineEdit(QWidget* widget) : QLineEdit(widget) {}
AutoTypeFilterLineEdit(QWidget* widget)
: QLineEdit(widget)
{
}

protected:
virtual void keyPressEvent(QKeyEvent *event);
virtual void keyReleaseEvent(QKeyEvent *event);
virtual void keyPressEvent(QKeyEvent* event);
virtual void keyReleaseEvent(QKeyEvent* event);
signals:
void keyUpPressed();
void keyDownPressed();
Expand Down
7 changes: 3 additions & 4 deletions src/autotype/AutoTypeSelectDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
#include <QDialogButtonBox>
#include <QHeaderView>
#include <QLabel>
#include <QVBoxLayout>
#include <QLineEdit>
#include <QSortFilterProxyModel>
#include <QVBoxLayout>

#include "autotype/AutoTypeSelectView.h"
#include "core/AutoTypeMatch.h"
Expand Down Expand Up @@ -77,7 +77,7 @@ AutoTypeSelectDialog::AutoTypeSelectDialog(QWidget* parent)
connect(m_view, SIGNAL(rejected()), SLOT(reject()));
// clang-format on

QSortFilterProxyModel *proxy = qobject_cast<QSortFilterProxyModel*>(m_view->model());
QSortFilterProxyModel* proxy = qobject_cast<QSortFilterProxyModel*>(m_view->model());
if (proxy) {
proxy->setFilterKeyColumn(-1);
proxy->setFilterCaseSensitivity(Qt::CaseInsensitive);
Expand Down Expand Up @@ -146,10 +146,9 @@ void AutoTypeSelectDialog::matchRemoved()
}
}


void AutoTypeSelectDialog::filterList(QString filterString)
{
QSortFilterProxyModel *proxy = qobject_cast<QSortFilterProxyModel*>(m_view->model());
QSortFilterProxyModel* proxy = qobject_cast<QSortFilterProxyModel*>(m_view->model());
if (proxy) {
proxy->setFilterWildcard(filterString);
if (!m_view->currentIndex().isValid()) {
Expand Down
2 changes: 1 addition & 1 deletion src/browser/BrowserService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ QList<Entry*> BrowserService::sortEntries(QList<Entry*>& pwEntries, const QStrin
|| ((QString::localeAwareCompare(left->attributes()->value(field),
right->attributes()->value(field))
== 0)
&& (QString::localeAwareCompare(left->attributes()->value("UserName"),
&& (QString::localeAwareCompare(left->attributes()->value("UserName"),
right->attributes()->value("UserName"))
< 0));
});
Expand Down
6 changes: 3 additions & 3 deletions src/browser/BrowserSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,13 @@ void BrowserSettings::setVivaldiSupport(bool enabled)

bool BrowserSettings::braveSupport()
{
return m_hostInstaller.checkIfInstalled(HostInstaller::SupportedBrowsers::BRAVE);
return m_hostInstaller.checkIfInstalled(HostInstaller::SupportedBrowsers::BRAVE);
}

void BrowserSettings::setBraveSupport(bool enabled)
{
m_hostInstaller.installBrowser(
HostInstaller::SupportedBrowsers::BRAVE, enabled, supportBrowserProxy(), customProxyLocation());
m_hostInstaller.installBrowser(
HostInstaller::SupportedBrowsers::BRAVE, enabled, supportBrowserProxy(), customProxyLocation());
}

bool BrowserSettings::torBrowserSupport()
Expand Down
6 changes: 3 additions & 3 deletions src/browser/HostInstaller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ QString HostInstaller::getTargetPath(SupportedBrowsers browser) const
case SupportedBrowsers::TOR_BROWSER:
return TARGET_DIR_TOR_BROWSER;
case SupportedBrowsers::BRAVE:
return TARGET_DIR_BRAVE;
return TARGET_DIR_BRAVE;
default:
return QString();
}
Expand All @@ -194,11 +194,11 @@ QString HostInstaller::getBrowserName(SupportedBrowsers browser) const
case SupportedBrowsers::FIREFOX:
return "firefox";
case SupportedBrowsers::VIVALDI:
return "vivaldi";
return "vivaldi";
case SupportedBrowsers::TOR_BROWSER:
return "tor-browser";
case SupportedBrowsers::BRAVE:
return "brave";
return "brave";
default:
return QString();
}
Expand Down
3 changes: 1 addition & 2 deletions src/cli/Command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ const QCommandLineOption Command::KeyFileOption = QCommandLineOption(QStringList
QObject::tr("path"));

const QCommandLineOption Command::NoPasswordOption =
QCommandLineOption(QStringList() << "no-password",
QObject::tr("Deactivate password key for the database."));
QCommandLineOption(QStringList() << "no-password", QObject::tr("Deactivate password key for the database."));

QMap<QString, Command*> commands;

Expand Down
2 changes: 1 addition & 1 deletion src/cli/Extract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int Extract::execute(const QStringList& arguments)
errorTextStream << parser.helpText().replace("[options]", "extract [options]");
return EXIT_FAILURE;
}

auto compositeKey = QSharedPointer<CompositeKey>::create();

auto db = Utils::unlockDatabase(args.at(0),
Expand Down
3 changes: 1 addition & 2 deletions src/cli/keepassxc-cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ int main(int argc, char** argv)

parser.addPositionalArgument("command", QObject::tr("Name of the command to execute."));

QCommandLineOption debugInfoOption(QStringList() << "debug-info",
QObject::tr("Displays debugging information."));
QCommandLineOption debugInfoOption(QStringList() << "debug-info", QObject::tr("Displays debugging information."));
parser.addOption(debugInfoOption);
parser.addHelpOption();
parser.addVersionOption();
Expand Down
2 changes: 1 addition & 1 deletion src/core/Alloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void operator delete[](void* ptr) noexcept
* Custom insecure delete operator that does not zero out memory before
* freeing a buffer. Can be used for better performance.
*/
void operator delete(void* ptr, bool) noexcept
void operator delete(void* ptr, bool)noexcept
{
std::free(ptr);
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/Bootstrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ namespace Bootstrap
nullptr, // do not change owner or group
pACL, // DACL specified
nullptr // do not change SACL
);
);

Cleanup:

Expand Down
6 changes: 3 additions & 3 deletions src/core/Merger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -625,9 +625,9 @@ Merger::ChangeList Merger::mergeMetadata(const MergeContext& context)
// Merge Custom Data if source is newer
const auto targetCustomDataModificationTime = sourceMetadata->customData()->getLastModified();
const auto sourceCustomDataModificationTime = targetMetadata->customData()->getLastModified();
if (!targetMetadata->customData()->contains(CustomData::LastModified) ||
(targetCustomDataModificationTime.isValid() && sourceCustomDataModificationTime.isValid() &&
targetCustomDataModificationTime > sourceCustomDataModificationTime)) {
if (!targetMetadata->customData()->contains(CustomData::LastModified)
|| (targetCustomDataModificationTime.isValid() && sourceCustomDataModificationTime.isValid()
&& targetCustomDataModificationTime > sourceCustomDataModificationTime)) {
const auto sourceCustomDataKeys = sourceMetadata->customData()->keys();
const auto targetCustomDataKeys = targetMetadata->customData()->keys();

Expand Down
3 changes: 1 addition & 2 deletions src/core/Tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "core/Config.h"
#include "core/Translator.h"

#include "git-info.h"
#include <QCoreApplication>
#include <QElapsedTimer>
#include <QIODevice>
Expand All @@ -33,7 +34,6 @@
#include <QSysInfo>
#include <QUuid>
#include <cctype>
#include "git-info.h"

#ifdef Q_OS_WIN
#include <windows.h> // for Sleep()
Expand Down Expand Up @@ -75,7 +75,6 @@ namespace Tools
#endif
debugInfo.append("\n");


#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
debugInfo.append(QObject::tr("Operating system: %1\nCPU architecture: %2\nKernel: %3 %4")
.arg(QSysInfo::prettyProductName(),
Expand Down
2 changes: 1 addition & 1 deletion src/core/Translator.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
#ifndef KEEPASSX_TRANSLATOR_H
#define KEEPASSX_TRANSLATOR_H

#include <QLocale>
#include <QPair>
#include <QString>
#include <QLocale>

class Translator
{
Expand Down
4 changes: 2 additions & 2 deletions src/fdosecrets/objects/Collection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ namespace FdoSecrets
if (ret.isError()) {
return ret;
}
return static_cast<qulonglong>(
m_backend->database()->rootGroup()->timeInfo().creationTime().toMSecsSinceEpoch() / 1000);
return static_cast<qulonglong>(m_backend->database()->rootGroup()->timeInfo().creationTime().toMSecsSinceEpoch()
/ 1000);
}

DBusReturn<qulonglong> Collection::modified() const
Expand Down
4 changes: 2 additions & 2 deletions src/fdosecrets/objects/Item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,12 +354,12 @@ namespace FdoSecrets
return pathComponents.join('/');
}

QString Item::encodeAttributeKey(const QString &key)
QString Item::encodeAttributeKey(const QString& key)
{
return QUrl::toPercentEncoding(key, "", "_:").replace('%', '_');
}

QString Item::decodeAttributeKey(const QString &key)
QString Item::decodeAttributeKey(const QString& key)
{
return QString::fromUtf8(QByteArray::fromPercentEncoding(key.toLatin1(), '_'));
}
Expand Down
6 changes: 4 additions & 2 deletions src/fdosecrets/objects/Service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ namespace FdoSecrets

// Connect to service unregistered signal
m_serviceWatcher.reset(new QDBusServiceWatcher());
connect(
m_serviceWatcher.data(), &QDBusServiceWatcher::serviceUnregistered, this, &Service::dbusServiceUnregistered);
connect(m_serviceWatcher.data(),
&QDBusServiceWatcher::serviceUnregistered,
this,
&Service::dbusServiceUnregistered);

m_serviceWatcher->setConnection(QDBusConnection::sessionBus());

Expand Down
1 change: 0 additions & 1 deletion src/gui/AboutDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

#include <QClipboard>


static const QString aboutMaintainers = R"(
<p><ul>
<li>Jonathan White (<a href="https://github.com/droidmonkey">droidmonkey</a>)</li>
Expand Down
2 changes: 1 addition & 1 deletion src/gui/ApplicationSettingsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ ApplicationSettingsWidget::ApplicationSettingsWidget(QWidget* parent)
#else
m_generalUi->checkForUpdatesOnStartupCheckBox->setVisible(false);
m_generalUi->checkForUpdatesIncludeBetasCheckBox->setVisible(false);
m_generalUi->checkUpdatesSpacer->changeSize(0,0, QSizePolicy::Fixed, QSizePolicy::Fixed);
m_generalUi->checkUpdatesSpacer->changeSize(0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
#endif

#ifndef WITH_XC_NETWORKING
Expand Down
12 changes: 6 additions & 6 deletions src/gui/dbsettings/DatabaseSettingsWidgetBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,12 @@ void DatabaseSettingsWidgetBrowser::convertAttributesToCustomData()
{
if (MessageBox::Yes
!= MessageBox::question(
this,
tr("Move KeePassHTTP attributes to custom data"),
tr("Do you really want to move all legacy browser integration data to the latest standard?\n"
"This is necessary to maintain compatibility with the browser plugin."),
MessageBox::Yes | MessageBox::Cancel,
MessageBox::Cancel)) {
this,
tr("Move KeePassHTTP attributes to custom data"),
tr("Do you really want to move all legacy browser integration data to the latest standard?\n"
"This is necessary to maintain compatibility with the browser plugin."),
MessageBox::Yes | MessageBox::Cancel,
MessageBox::Cancel)) {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions src/gui/masterkey/KeyComponentWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
#ifndef KEEPASSXC_KEYCOMPONENTWIDGET_H
#define KEEPASSXC_KEYCOMPONENTWIDGET_H

#include <QPointer>
#include <QScopedPointer>
#include <QWidget>
#include <QPointer>

namespace Ui
{
Expand Down Expand Up @@ -111,7 +111,7 @@ class KeyComponentWidget : public QWidget
void componentRemovalRequested();

protected:
void showEvent(QShowEvent* event) override ;
void showEvent(QShowEvent* event) override;

private slots:
void updateComponentName(const QString& name);
Expand Down
4 changes: 2 additions & 2 deletions src/keys/FileKey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@

#include <QFile>

#include <sodium.h>
#include <gcrypt.h>
#include <algorithm>
#include <cstring>
#include <gcrypt.h>
#include <sodium.h>

QUuid FileKey::UUID("a584cbc4-c9b4-437e-81bb-362ca9709273");

Expand Down
2 changes: 1 addition & 1 deletion src/keys/PasswordKey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
#include "core/Tools.h"

#include "crypto/CryptoHash.h"
#include <gcrypt.h>
#include <algorithm>
#include <cstring>
#include <gcrypt.h>

QUuid PasswordKey::UUID("77e90411-303a-43f2-b773-853b05635ead");

Expand Down
2 changes: 1 addition & 1 deletion src/keys/YkChallengeResponseKey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
#include <QXmlStreamReader>
#include <QtConcurrent>

#include <cstring>
#include <gcrypt.h>
#include <sodium.h>
#include <cstring>

QUuid YkChallengeResponseKey::UUID("e092495c-e77d-498b-84a1-05ae0d955508");

Expand Down
3 changes: 1 addition & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ int main(int argc, char** argv)

QCommandLineOption helpOption = parser.addHelpOption();
QCommandLineOption versionOption = parser.addVersionOption();
QCommandLineOption debugInfoOption(QStringList() << "debug-info",
QObject::tr("Displays debugging information."));
QCommandLineOption debugInfoOption(QStringList() << "debug-info", QObject::tr("Displays debugging information."));
parser.addOption(configOption);
parser.addOption(keyfileOption);
parser.addOption(pwstdinOption);
Expand Down
13 changes: 7 additions & 6 deletions tests/TestCli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,8 +690,9 @@ void TestCli::testKeyFileOption()
listCmd.execute({"ls", "-k", keyFilePath, m_keyFileProtectedDbFile->fileName()});
m_stdoutFile->reset();
m_stdoutFile->readLine(); // skip password prompt
QCOMPARE(m_stdoutFile->readAll(), QByteArray("entry1\n"
"entry2\n"));
QCOMPARE(m_stdoutFile->readAll(),
QByteArray("entry1\n"
"entry2\n"));

// Should raise an error with no key file.
qint64 pos = m_stdoutFile->pos();
Expand All @@ -713,8 +714,7 @@ void TestCli::testKeyFileOption()
m_stdoutFile->readLine(); // skip password prompt
m_stderrFile->seek(posErr);
QCOMPARE(m_stdoutFile->readAll(), QByteArray(""));
QCOMPARE(m_stderrFile->readAll().split(':').at(0),
QByteArray("Failed to load key file invalidpath"));
QCOMPARE(m_stderrFile->readAll().split(':').at(0), QByteArray("Failed to load key file invalidpath"));
}

void TestCli::testNoPasswordOption()
Expand All @@ -724,8 +724,9 @@ void TestCli::testNoPasswordOption()
QString keyFilePath(QString(KEEPASSX_TEST_DATA_DIR).append("/KeyFileProtectedNoPassword.key"));
listCmd.execute({"ls", "-k", keyFilePath, "--no-password", m_keyFileProtectedNoPasswordDbFile->fileName()});
m_stdoutFile->reset();
QCOMPARE(m_stdoutFile->readAll(), QByteArray("entry1\n"
"entry2\n"));
QCOMPARE(m_stdoutFile->readAll(),
QByteArray("entry1\n"
"entry2\n"));

// Should raise an error with no key file.
qint64 pos = m_stdoutFile->pos();
Expand Down
Loading

0 comments on commit 31b54ca

Please sign in to comment.