mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Coding style improvements.
This commit is contained in:
parent
924130e0fe
commit
a407e0082b
@ -17,8 +17,8 @@
|
||||
|
||||
#include "EntryAttributes.h"
|
||||
|
||||
const QStringList EntryAttributes::DEFAULT_ATTRIBUTES(QStringList() << "Title" << "URL"
|
||||
<< "UserName" << "Password" << "Notes");
|
||||
const QStringList EntryAttributes::DefaultAttributes(QStringList() << "Title" << "URL"
|
||||
<< "UserName" << "Password" << "Notes");
|
||||
|
||||
EntryAttributes::EntryAttributes(QObject* parent)
|
||||
: QObject(parent)
|
||||
@ -215,7 +215,7 @@ void EntryAttributes::clear()
|
||||
m_attributes.clear();
|
||||
m_protectedAttributes.clear();
|
||||
|
||||
Q_FOREACH (const QString& key, DEFAULT_ATTRIBUTES) {
|
||||
Q_FOREACH (const QString& key, DefaultAttributes) {
|
||||
m_attributes.insert(key, "");
|
||||
}
|
||||
|
||||
@ -236,5 +236,5 @@ int EntryAttributes::attributesSize() {
|
||||
|
||||
bool EntryAttributes::isDefaultAttribute(const QString& key)
|
||||
{
|
||||
return DEFAULT_ATTRIBUTES.contains(key);
|
||||
return DefaultAttributes.contains(key);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
bool operator==(const EntryAttributes& other) const;
|
||||
bool operator!=(const EntryAttributes& other) const;
|
||||
|
||||
static const QStringList DEFAULT_ATTRIBUTES;
|
||||
static const QStringList DefaultAttributes;
|
||||
static bool isDefaultAttribute(const QString& key);
|
||||
|
||||
Q_SIGNALS:
|
||||
|
@ -114,6 +114,7 @@ private:
|
||||
void cleanupParent();
|
||||
void recCreateDelObjects();
|
||||
void updateTimeinfo();
|
||||
bool includeInSearch(bool resolveInherit);
|
||||
|
||||
QPointer<Database> m_db;
|
||||
Uuid m_uuid;
|
||||
@ -138,8 +139,6 @@ private:
|
||||
friend void Database::setRootGroup(Group* group);
|
||||
friend Entry::~Entry();
|
||||
friend void Entry::setGroup(Group* group);
|
||||
|
||||
bool includeInSearch(bool resolveInherit);
|
||||
};
|
||||
|
||||
#endif // KEEPASSX_GROUP_H
|
||||
|
@ -29,8 +29,8 @@ Metadata::Metadata(QObject* parent)
|
||||
m_recycleBinEnabled = true;
|
||||
m_masterKeyChangeRec = -1;
|
||||
m_masterKeyChangeForce = -1;
|
||||
m_historyMaxItems = defaultHistoryMaxItems;
|
||||
m_historyMaxSize = defaultHistoryMaxSize;
|
||||
m_historyMaxItems = DefaultHistoryMaxItems;
|
||||
m_historyMaxSize = DefaultHistoryMaxSize;
|
||||
|
||||
QDateTime now = Tools::currentDateTimeUtc();
|
||||
m_nameChanged = now;
|
||||
@ -50,8 +50,8 @@ Metadata::Metadata(QObject* parent)
|
||||
m_updateDatetime = true;
|
||||
}
|
||||
|
||||
const int Metadata::defaultHistoryMaxItems = 10;
|
||||
const int Metadata::defaultHistoryMaxSize = 6291456;
|
||||
const int Metadata::DefaultHistoryMaxItems = 10;
|
||||
const int Metadata::DefaultHistoryMaxSize = 6291456;
|
||||
|
||||
template <class P, class V> bool Metadata::set(P& property, const V& value)
|
||||
{
|
||||
|
@ -70,8 +70,8 @@ public:
|
||||
int historyMaxSize() const;
|
||||
QHash<QString, QString> customFields() const;
|
||||
|
||||
static const int defaultHistoryMaxItems;
|
||||
static const int defaultHistoryMaxSize;
|
||||
static const int DefaultHistoryMaxItems;
|
||||
static const int DefaultHistoryMaxSize;
|
||||
|
||||
void setGenerator(const QString& value);
|
||||
void setName(const QString& value);
|
||||
|
@ -21,22 +21,22 @@
|
||||
|
||||
#include "crypto/Random.h"
|
||||
|
||||
const int Uuid::LENGTH = 16;
|
||||
const int Uuid::Length = 16;
|
||||
|
||||
Uuid::Uuid()
|
||||
: m_data(LENGTH, 0)
|
||||
: m_data(Length, 0)
|
||||
{
|
||||
}
|
||||
|
||||
Uuid::Uuid(const QByteArray& data)
|
||||
{
|
||||
Q_ASSERT(data.size() == LENGTH);
|
||||
Q_ASSERT(data.size() == Length);
|
||||
|
||||
m_data = data;
|
||||
}
|
||||
|
||||
Uuid Uuid::random() {
|
||||
return Uuid(Random::randomArray(LENGTH));
|
||||
return Uuid(Random::randomArray(Length));
|
||||
}
|
||||
|
||||
QString Uuid::toBase64() const
|
||||
@ -97,7 +97,7 @@ QDataStream& operator>>(QDataStream& stream, Uuid& uuid)
|
||||
{
|
||||
QByteArray data;
|
||||
stream >> data;
|
||||
if (data.size() == Uuid::LENGTH) {
|
||||
if (data.size() == Uuid::Length) {
|
||||
uuid = Uuid(data);
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
Uuid& operator=(const Uuid& other);
|
||||
bool operator==(const Uuid& other) const;
|
||||
bool operator!=(const Uuid& other) const;
|
||||
static const int LENGTH;
|
||||
static const int Length;
|
||||
static Uuid fromBase64(const QString& str);
|
||||
|
||||
private:
|
||||
|
@ -247,7 +247,7 @@ bool KeePass2Reader::readHeaderField()
|
||||
|
||||
void KeePass2Reader::setCipher(const QByteArray& data)
|
||||
{
|
||||
if (data.size() != Uuid::LENGTH) {
|
||||
if (data.size() != Uuid::Length) {
|
||||
raiseError("");
|
||||
}
|
||||
else {
|
||||
|
@ -848,7 +848,7 @@ int KeePass2XmlReader::readNumber()
|
||||
Uuid KeePass2XmlReader::readUuid()
|
||||
{
|
||||
QByteArray uuidBin = readBinary();
|
||||
if (uuidBin.length() != Uuid::LENGTH) {
|
||||
if (uuidBin.length() != Uuid::Length) {
|
||||
raiseError(15);
|
||||
return Uuid();
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ void DatabaseSettingsWidget::setForms(const QString& dbName, const QString& dbDe
|
||||
m_ui->historyMaxItemsCheckBox->setChecked(true);
|
||||
}
|
||||
else {
|
||||
m_ui->historyMaxItemsSpinBox->setValue(Metadata::defaultHistoryMaxItems);
|
||||
m_ui->historyMaxItemsSpinBox->setValue(Metadata::DefaultHistoryMaxItems);
|
||||
m_ui->historyMaxItemsCheckBox->setChecked(false);
|
||||
}
|
||||
if (historyMaxSize > -1) {
|
||||
@ -68,7 +68,7 @@ void DatabaseSettingsWidget::setForms(const QString& dbName, const QString& dbDe
|
||||
m_ui->historyMaxSizeCheckBox->setChecked(true);
|
||||
}
|
||||
else {
|
||||
m_ui->historyMaxSizeSpinBox->setValue(Metadata::defaultHistoryMaxSize);
|
||||
m_ui->historyMaxSizeSpinBox->setValue(Metadata::DefaultHistoryMaxSize);
|
||||
m_ui->historyMaxSizeCheckBox->setChecked(false);
|
||||
}
|
||||
|
||||
|
@ -125,9 +125,9 @@ EditEntryWidget::~EditEntryWidget()
|
||||
{
|
||||
}
|
||||
|
||||
const QColor EditEntryWidget::normalColor = Qt::white;
|
||||
const QColor EditEntryWidget::correctSoFarColor = QColor(255, 205, 15);
|
||||
const QColor EditEntryWidget::errorColor = QColor(255, 125, 125);
|
||||
const QColor EditEntryWidget::NormalColor = Qt::white;
|
||||
const QColor EditEntryWidget::CorrectSoFarColor = QColor(255, 205, 15);
|
||||
const QColor EditEntryWidget::ErrorColor = QColor(255, 125, 125);
|
||||
|
||||
void EditEntryWidget::loadEntry(Entry* entry, bool create, const QString& groupName,
|
||||
Database* database)
|
||||
@ -284,14 +284,14 @@ void EditEntryWidget::setPasswordCheckColors()
|
||||
{
|
||||
QPalette pal;
|
||||
if (passwordsEqual()) {
|
||||
pal.setColor(QPalette::Base, normalColor);
|
||||
pal.setColor(QPalette::Base, NormalColor);
|
||||
}
|
||||
else {
|
||||
if (m_mainUi->passwordEdit->text().startsWith(m_mainUi->passwordRepeatEdit->text())) {
|
||||
pal.setColor(QPalette::Base, correctSoFarColor);
|
||||
pal.setColor(QPalette::Base, CorrectSoFarColor);
|
||||
}
|
||||
else {
|
||||
pal.setColor(QPalette::Base, errorColor);
|
||||
pal.setColor(QPalette::Base, ErrorColor);
|
||||
}
|
||||
}
|
||||
m_mainUi->passwordRepeatEdit->setPalette(pal);
|
||||
|
@ -52,9 +52,9 @@ public:
|
||||
|
||||
void loadEntry(Entry* entry, bool create, const QString& groupName, Database* database);
|
||||
|
||||
static const QColor normalColor;
|
||||
static const QColor correctSoFarColor;
|
||||
static const QColor errorColor;
|
||||
static const QColor NormalColor;
|
||||
static const QColor CorrectSoFarColor;
|
||||
static const QColor ErrorColor;
|
||||
|
||||
Q_SIGNALS:
|
||||
void editFinished(bool accepted);
|
||||
|
@ -87,7 +87,7 @@ void MainWindow::openDatabase(const QString& fileName, const QString& pw, const
|
||||
m_ui->tabWidget->openDatabase(fileName, pw, keyFile);
|
||||
}
|
||||
|
||||
const QString MainWindow::m_baseWindowTitle = "KeePassX";
|
||||
const QString MainWindow::BaseWindowTitle = "KeePassX";
|
||||
|
||||
void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
|
||||
{
|
||||
@ -175,10 +175,10 @@ void MainWindow::updateWindowTitle()
|
||||
{
|
||||
int index = m_ui->tabWidget->currentIndex();
|
||||
if (index == -1) {
|
||||
setWindowTitle(m_baseWindowTitle);
|
||||
setWindowTitle(BaseWindowTitle);
|
||||
}
|
||||
else {
|
||||
setWindowTitle(m_ui->tabWidget->tabText(index).append(" - ").append(m_baseWindowTitle));
|
||||
setWindowTitle(m_ui->tabWidget->tabText(index).append(" - ").append(BaseWindowTitle));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,8 +44,9 @@ private Q_SLOTS:
|
||||
void showAboutDialog();
|
||||
|
||||
private:
|
||||
static const QString BaseWindowTitle;
|
||||
|
||||
const QScopedPointer<Ui::MainWindow> m_ui;
|
||||
static const QString m_baseWindowTitle;
|
||||
|
||||
Q_DISABLE_COPY(MainWindow)
|
||||
};
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "core/Endian.h"
|
||||
#include "crypto/CryptoHash.h"
|
||||
|
||||
const QSysInfo::Endian HashedBlockStream::BYTEORDER = QSysInfo::LittleEndian;
|
||||
const QSysInfo::Endian HashedBlockStream::ByteOrder = QSysInfo::LittleEndian;
|
||||
|
||||
HashedBlockStream::HashedBlockStream(QIODevice* baseDevice)
|
||||
: LayeredStream(baseDevice)
|
||||
@ -126,7 +126,7 @@ bool HashedBlockStream::readHashedBlock()
|
||||
{
|
||||
bool ok;
|
||||
|
||||
quint32 index = Endian::readUInt32(m_baseDevice, BYTEORDER, &ok);
|
||||
quint32 index = Endian::readUInt32(m_baseDevice, ByteOrder, &ok);
|
||||
if (!ok || index != m_blockIndex) {
|
||||
m_error = true;
|
||||
return false;
|
||||
@ -138,7 +138,7 @@ bool HashedBlockStream::readHashedBlock()
|
||||
return false;
|
||||
}
|
||||
|
||||
m_blockSize = Endian::readInt32(m_baseDevice, BYTEORDER, &ok);
|
||||
m_blockSize = Endian::readInt32(m_baseDevice, ByteOrder, &ok);
|
||||
if (!ok || m_blockSize < 0) {
|
||||
m_error = true;
|
||||
return false;
|
||||
@ -207,7 +207,7 @@ qint64 HashedBlockStream::writeData(const char* data, qint64 maxSize)
|
||||
|
||||
bool HashedBlockStream::writeHashedBlock()
|
||||
{
|
||||
if (!Endian::writeInt32(m_blockIndex, m_baseDevice, BYTEORDER)) {
|
||||
if (!Endian::writeInt32(m_blockIndex, m_baseDevice, ByteOrder)) {
|
||||
m_error = true;
|
||||
return false;
|
||||
}
|
||||
@ -226,7 +226,7 @@ bool HashedBlockStream::writeHashedBlock()
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Endian::writeInt32(m_buffer.size(), m_baseDevice, BYTEORDER)) {
|
||||
if (!Endian::writeInt32(m_buffer.size(), m_baseDevice, ByteOrder)) {
|
||||
m_error = true;
|
||||
return false;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ private:
|
||||
bool readHashedBlock();
|
||||
bool writeHashedBlock();
|
||||
|
||||
static const QSysInfo::Endian BYTEORDER;
|
||||
static const QSysInfo::Endian ByteOrder;
|
||||
qint32 m_blockSize;
|
||||
QByteArray m_buffer;
|
||||
int m_bufferPos;
|
||||
|
Loading…
Reference in New Issue
Block a user