Merge pull request #2433 from brainplot/code-cleanup

* Remove redundant headers from the build system
* Pin AutoTypeAction's vtable to a translation unit
* Remove redundant check for the version flag
* Improve performance of a few for-loops
* Replace old for-loops with range-based for-loops
* Remove redundant null-checks for pointer deletion 
* Reduce QString::arg function call overhead
* Reduce number of unneeded copies when calling functions
* Enhance readability when accessing static members 
* Convert to nullptrs where necessary
* Reduce unnecessary copies using std::move
* Normalize signature of SIGNAL() and SLOT()
* Add missing `override` keyword for some member functions which override functions of their base class
This commit is contained in:
Jonathan White 2018-10-31 13:32:21 -04:00 committed by GitHub
commit 82bf00de73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
110 changed files with 325 additions and 355 deletions

View File

@ -38,7 +38,6 @@ configure_file(version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/version.h @ONLY)
set(keepassx_SOURCES
core/AutoTypeAssociations.cpp
core/AsyncTask.h
core/AutoTypeMatch.cpp
core/Compare.cpp
core/Config.cpp
@ -52,18 +51,14 @@ set(keepassx_SOURCES
core/EntrySearcher.cpp
core/FilePath.cpp
core/Bootstrap.cpp
core/Global.h
core/Group.cpp
core/InactivityTimer.cpp
core/ListDeleter.h
core/Merger.cpp
core/Metadata.cpp
core/PasswordGenerator.cpp
core/PassphraseGenerator.cpp
core/SignalMultiplexer.cpp
core/ScreenLockListener.cpp
core/ScreenLockListener.h
core/ScreenLockListenerPrivate.h
core/ScreenLockListenerPrivate.cpp
core/TimeDelta.cpp
core/TimeInfo.cpp
@ -77,14 +72,11 @@ set(keepassx_SOURCES
crypto/CryptoHash.cpp
crypto/Random.cpp
crypto/SymmetricCipher.cpp
crypto/SymmetricCipherBackend.h
crypto/SymmetricCipherGcrypt.cpp
crypto/kdf/Kdf.cpp
crypto/kdf/Kdf_p.h
crypto/kdf/AesKdf.cpp
crypto/kdf/Argon2Kdf.cpp
format/CsvExporter.cpp
format/KeePass1.h
format/KeePass1Reader.cpp
format/KeePass2.cpp
format/KeePass2RandomStream.cpp
@ -142,7 +134,6 @@ set(keepassx_SOURCES
gui/entry/AutoTypeMatchModel.cpp
gui/entry/AutoTypeMatchView.cpp
gui/entry/EditEntryWidget.cpp
gui/entry/EditEntryWidget_p.h
gui/entry/EntryAttachmentsModel.cpp
gui/entry/EntryAttachmentsWidget.cpp
gui/entry/EntryAttributesModel.cpp
@ -168,11 +159,8 @@ set(keepassx_SOURCES
gui/wizard/NewDatabaseWizardPageMetaData.cpp
gui/wizard/NewDatabaseWizardPageEncryption.cpp
gui/wizard/NewDatabaseWizardPageMasterKey.cpp
keys/ChallengeResponseKey.h
keys/CompositeKey.cpp
keys/drivers/YubiKey.h
keys/FileKey.cpp
keys/Key.h
keys/PasswordKey.cpp
keys/YkChallengeResponseKey.cpp
streams/HashedBlockStream.cpp
@ -181,27 +169,22 @@ set(keepassx_SOURCES
streams/qtiocompressor.cpp
streams/StoreDataStream.cpp
streams/SymmetricCipherStream.cpp
totp/totp.h
totp/totp.cpp)
if(APPLE)
set(keepassx_SOURCES
${keepassx_SOURCES}
core/ScreenLockListenerMac.h
core/ScreenLockListenerMac.cpp
core/MacPasteboard.h
core/MacPasteboard.cpp)
endif()
if(UNIX AND NOT APPLE)
set(keepassx_SOURCES
${keepassx_SOURCES}
core/ScreenLockListenerDBus.h
core/ScreenLockListenerDBus.cpp
gui/MainWindowAdaptor.cpp)
endif()
if(MINGW)
set(keepassx_SOURCES
${keepassx_SOURCES}
core/ScreenLockListenerWin.h
core/ScreenLockListenerWin.cpp)
endif()
if(MINGW OR (UNIX AND NOT APPLE))
@ -243,13 +226,11 @@ set(autotype_SOURCES
core/Tools.cpp
autotype/AutoType.cpp
autotype/AutoTypeAction.cpp
autotype/AutoTypePlatformPlugin.h
autotype/AutoTypeSelectDialog.cpp
autotype/AutoTypeSelectView.cpp
autotype/ShortcutWidget.cpp
autotype/WildcardMatcher.cpp
autotype/WindowSelectComboBox.cpp
autotype/test/AutoTypeTestInterface.h)
autotype/WindowSelectComboBox.cpp)
if(MINGW)
set(keepassx_SOURCES_MAINEXE ${keepassx_SOURCES_MAINEXE} ${CMAKE_SOURCE_DIR}/share/windows/icon.rc)

View File

@ -43,7 +43,7 @@ AutoType::AutoType(QObject* parent, bool test)
: QObject(parent)
, m_autoTypeDelay(0)
, m_currentGlobalKey(static_cast<Qt::Key>(0))
, m_currentGlobalModifiers(0)
, m_currentGlobalModifiers(nullptr)
, m_pluginLoader(new QPluginLoader(this))
, m_plugin(nullptr)
, m_executor(nullptr)
@ -731,8 +731,7 @@ bool AutoType::checkHighRepetition(const QString& string)
bool AutoType::verifyAutoTypeSyntax(const QString& sequence)
{
if (!AutoType::checkSyntax(sequence)) {
QMessageBox messageBox;
messageBox.critical(nullptr, tr("Auto-Type"), tr("The Syntax of your Auto-Type statement is incorrect!"));
QMessageBox::critical(nullptr, tr("Auto-Type"), tr("The Syntax of your Auto-Type statement is incorrect!"));
return false;
} else if (AutoType::checkHighDelay(sequence)) {
QMessageBox::StandardButton reply;

View File

@ -87,3 +87,9 @@ void AutoTypeExecutor::execClearField(AutoTypeClearField* action)
{
Q_UNUSED(action);
}
AutoTypeAction::~AutoTypeAction()
{
// This makes sure that AutoTypeAction's vtable is placed
// in this translation unit.
}

View File

@ -29,19 +29,17 @@ class AutoTypeExecutor;
class KEEPASSX_EXPORT AutoTypeAction
{
public:
virtual ~AutoTypeAction()
{
}
virtual AutoTypeAction* clone() = 0;
virtual void accept(AutoTypeExecutor* executor) = 0;
virtual ~AutoTypeAction();
};
class KEEPASSX_EXPORT AutoTypeChar : public AutoTypeAction
{
public:
explicit AutoTypeChar(const QChar& character);
AutoTypeAction* clone();
void accept(AutoTypeExecutor* executor);
AutoTypeAction* clone() override;
void accept(AutoTypeExecutor* executor) override;
const QChar character;
};
@ -50,8 +48,8 @@ class KEEPASSX_EXPORT AutoTypeKey : public AutoTypeAction
{
public:
explicit AutoTypeKey(Qt::Key key);
AutoTypeAction* clone();
void accept(AutoTypeExecutor* executor);
AutoTypeAction* clone() override;
void accept(AutoTypeExecutor* executor) override;
const Qt::Key key;
};
@ -60,8 +58,8 @@ class KEEPASSX_EXPORT AutoTypeDelay : public AutoTypeAction
{
public:
explicit AutoTypeDelay(int delayMs);
AutoTypeAction* clone();
void accept(AutoTypeExecutor* executor);
AutoTypeAction* clone() override;
void accept(AutoTypeExecutor* executor) override;
const int delayMs;
};
@ -70,8 +68,8 @@ class KEEPASSX_EXPORT AutoTypeClearField : public AutoTypeAction
{
public:
AutoTypeClearField();
AutoTypeAction* clone();
void accept(AutoTypeExecutor* executor);
AutoTypeAction* clone() override;
void accept(AutoTypeExecutor* executor) override;
};
class KEEPASSX_EXPORT AutoTypeExecutor

View File

@ -69,7 +69,7 @@ AutoTypeSelectDialog::AutoTypeSelectDialog(QWidget* parent)
connect(m_view, SIGNAL(activated(QModelIndex)), SLOT(emitMatchActivated(QModelIndex)));
connect(m_view, SIGNAL(clicked(QModelIndex)), SLOT(emitMatchActivated(QModelIndex)));
connect(m_view->model(), SIGNAL(rowsRemoved(QModelIndex, int, int)), SLOT(matchRemoved()));
connect(m_view->model(), SIGNAL(rowsRemoved(QModelIndex,int,int)), SLOT(matchRemoved()));
connect(m_view, SIGNAL(rejected()), SLOT(reject()));
layout->addWidget(m_view);

View File

@ -24,7 +24,7 @@
ShortcutWidget::ShortcutWidget(QWidget* parent)
: QLineEdit(parent)
, m_key(static_cast<Qt::Key>(0))
, m_modifiers(0)
, m_modifiers(nullptr)
, m_locked(false)
{
setReadOnly(true);
@ -58,7 +58,7 @@ void ShortcutWidget::setShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers)
void ShortcutWidget::resetShortcut()
{
m_key = static_cast<Qt::Key>(0);
m_modifiers = 0;
m_modifiers = nullptr;
m_locked = false;
autoType()->unregisterGlobalShortcut();
}

View File

@ -18,12 +18,13 @@
#include "WildcardMatcher.h"
#include <QStringList>
#include <utility>
const QChar WildcardMatcher::Wildcard = '*';
const Qt::CaseSensitivity WildcardMatcher::Sensitivity = Qt::CaseInsensitive;
WildcardMatcher::WildcardMatcher(const QString& text)
: m_text(text)
WildcardMatcher::WildcardMatcher(QString text)
: m_text(std::move(text))
{
}

View File

@ -23,7 +23,7 @@
class WildcardMatcher
{
public:
explicit WildcardMatcher(const QString& text);
explicit WildcardMatcher(QString text);
bool match(const QString& pattern);
static const QChar Wildcard;

View File

@ -50,7 +50,7 @@ AutoTypePlatformX11::AutoTypePlatformX11()
<< "xfce4-panel"; // Xfce 4
m_currentGlobalKey = static_cast<Qt::Key>(0);
m_currentGlobalModifiers = 0;
m_currentGlobalModifiers = nullptr;
m_keysymTable = nullptr;
m_xkb = nullptr;
@ -197,7 +197,7 @@ void AutoTypePlatformX11::unregisterGlobalShortcut(Qt::Key key, Qt::KeyboardModi
XUngrabKey(m_dpy, keycode, nativeModifiers | Mod2Mask | LockMask, m_rootWindow);
m_currentGlobalKey = static_cast<Qt::Key>(0);
m_currentGlobalModifiers = 0;
m_currentGlobalModifiers = nullptr;
m_currentGlobalKeycode = 0;
m_currentGlobalNativeModifiers = 0;
}
@ -496,7 +496,7 @@ void AutoTypePlatformX11::updateKeymap()
m_xkb = getKeyboard();
XDisplayKeycodes(m_dpy, &m_minKeycode, &m_maxKeycode);
if (m_keysymTable != NULL)
if (m_keysymTable != nullptr)
XFree(m_keysymTable);
m_keysymTable = XGetKeyboardMapping(m_dpy, m_minKeycode, m_maxKeycode - m_minKeycode + 1, &m_keysymPerKeycode);

View File

@ -468,7 +468,7 @@ QJsonObject BrowserAction::decryptMessage(const QString& message, const QString&
return getErrorReply(action, ERROR_KEEPASS_CANNOT_DECRYPT_MESSAGE);
}
QString BrowserAction::encrypt(const QString plaintext, const QString nonce)
QString BrowserAction::encrypt(const QString& plaintext, const QString& nonce)
{
QMutexLocker locker(&m_mutex);
const QByteArray ma = plaintext.toUtf8();
@ -496,7 +496,7 @@ QString BrowserAction::encrypt(const QString plaintext, const QString nonce)
return QString();
}
QByteArray BrowserAction::decrypt(const QString encrypted, const QString nonce)
QByteArray BrowserAction::decrypt(const QString& encrypted, const QString& nonce)
{
QMutexLocker locker(&m_mutex);
const QByteArray ma = base64Decode(encrypted);
@ -546,14 +546,14 @@ QJsonObject BrowserAction::getJsonObject(const uchar* pArray, const uint len) co
return doc.object();
}
QJsonObject BrowserAction::getJsonObject(const QByteArray ba) const
QJsonObject BrowserAction::getJsonObject(const QByteArray& ba) const
{
QJsonParseError err;
QJsonDocument doc(QJsonDocument::fromJson(ba, &err));
return doc.object();
}
QByteArray BrowserAction::base64Decode(const QString str)
QByteArray BrowserAction::base64Decode(const QString& str)
{
return QByteArray::fromBase64(str.toUtf8());
}

View File

@ -73,14 +73,14 @@ private:
QString encryptMessage(const QJsonObject& message, const QString& nonce);
QJsonObject decryptMessage(const QString& message, const QString& nonce, const QString& action = QString());
QString encrypt(const QString plaintext, const QString nonce);
QByteArray decrypt(const QString encrypted, const QString nonce);
QString encrypt(const QString& plaintext, const QString& nonce);
QByteArray decrypt(const QString& encrypted, const QString& nonce);
QString getBase64FromKey(const uchar* array, const uint len);
QByteArray getQByteArray(const uchar* array, const uint len) const;
QJsonObject getJsonObject(const uchar* pArray, const uint len) const;
QJsonObject getJsonObject(const QByteArray ba) const;
QByteArray base64Decode(const QString str);
QJsonObject getJsonObject(const QByteArray& ba) const;
QByteArray base64Decode(const QString& str);
QString incrementNonce(const QString& nonce);
private:

View File

@ -35,7 +35,7 @@ class BrowserEntryConfig : public QObject
Q_PROPERTY(QString Realm READ realm WRITE setRealm)
public:
BrowserEntryConfig(QObject* object = 0);
BrowserEntryConfig(QObject* object = nullptr);
bool load(const Entry* entry);
void save(Entry* entry);

View File

@ -145,7 +145,7 @@ QString BrowserService::storeKey(const QString& key)
if (thread() != QThread::currentThread()) {
QMetaObject::invokeMethod(
this, "storeKey", Qt::BlockingQueuedConnection, Q_RETURN_ARG(QString, id), Q_ARG(const QString&, key));
this, "storeKey", Qt::BlockingQueuedConnection, Q_RETURN_ARG(QString, id), Q_ARG(QString, key));
return id;
}
@ -213,11 +213,11 @@ QJsonArray BrowserService::findMatchingEntries(const QString& id,
"findMatchingEntries",
Qt::BlockingQueuedConnection,
Q_RETURN_ARG(QJsonArray, result),
Q_ARG(const QString&, id),
Q_ARG(const QString&, url),
Q_ARG(const QString&, submitUrl),
Q_ARG(const QString&, realm),
Q_ARG(const StringPairList&, keyList));
Q_ARG(QString, id),
Q_ARG(QString, url),
Q_ARG(QString, submitUrl),
Q_ARG(QString, realm),
Q_ARG(StringPairList, keyList));
return result;
}
@ -279,12 +279,12 @@ void BrowserService::addEntry(const QString& id,
QMetaObject::invokeMethod(this,
"addEntry",
Qt::BlockingQueuedConnection,
Q_ARG(const QString&, id),
Q_ARG(const QString&, login),
Q_ARG(const QString&, password),
Q_ARG(const QString&, url),
Q_ARG(const QString&, submitUrl),
Q_ARG(const QString&, realm),
Q_ARG(QString, id),
Q_ARG(QString, login),
Q_ARG(QString, password),
Q_ARG(QString, url),
Q_ARG(QString, submitUrl),
Q_ARG(QString, realm),
Q_ARG(Database*, selectedDb));
}
@ -332,12 +332,12 @@ void BrowserService::updateEntry(const QString& id,
QMetaObject::invokeMethod(this,
"updateEntry",
Qt::BlockingQueuedConnection,
Q_ARG(const QString&, id),
Q_ARG(const QString&, uuid),
Q_ARG(const QString&, login),
Q_ARG(const QString&, password),
Q_ARG(const QString&, url),
Q_ARG(const QString&, submitUrl));
Q_ARG(QString, id),
Q_ARG(QString, uuid),
Q_ARG(QString, login),
Q_ARG(QString, password),
Q_ARG(QString, url),
Q_ARG(QString, submitUrl));
}
Database* db = selectedDatabase();
@ -362,7 +362,7 @@ void BrowserService::updateEntry(const QString& id,
if (!browserSettings()->alwaysAllowUpdate()) {
QMessageBox msgBox;
msgBox.setWindowTitle(tr("KeePassXC: Update Entry"));
msgBox.setText(tr("Do you want to update the information in %1 - %2?").arg(QUrl(url).host()).arg(username));
msgBox.setText(tr("Do you want to update the information in %1 - %2?").arg(QUrl(url).host(), username));
msgBox.setStandardButtons(QMessageBox::Yes);
msgBox.addButton(QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::No);
@ -421,7 +421,7 @@ QList<Entry*> BrowserService::searchEntries(const QString& url, const StringPair
if (DatabaseWidget* dbWidget = qobject_cast<DatabaseWidget*>(m_dbTabWidget->widget(i))) {
if (Database* db = dbWidget->database()) {
// Check if database is connected with KeePassXC-Browser
for (const StringPair keyPair : keyList) {
for (const StringPair& keyPair : keyList) {
QString key = db->metadata()->customData()->value(QLatin1String(ASSOCIATE_KEY_PREFIX) + keyPair.first);
if (!key.isEmpty() && keyPair.second == key) {
databases << db;
@ -481,16 +481,16 @@ void BrowserService::convertAttributesToCustomData(Database *currentDb)
progress.reset();
if (counter > 0) {
QMessageBox::information(0, tr("KeePassXC: Converted KeePassHTTP attributes"),
QMessageBox::information(nullptr, tr("KeePassXC: Converted KeePassHTTP attributes"),
tr("Successfully converted attributes from %1 entry(s).\n"
"Moved %2 keys to custom data.", "").arg(counter).arg(keyCounter),
QMessageBox::Ok);
} else if (counter == 0 && keyCounter > 0) {
QMessageBox::information(0, tr("KeePassXC: Converted KeePassHTTP attributes"),
QMessageBox::information(nullptr, tr("KeePassXC: Converted KeePassHTTP attributes"),
tr("Successfully moved %n keys to custom data.", "", keyCounter),
QMessageBox::Ok);
} else {
QMessageBox::information(0, tr("KeePassXC: No entry with KeePassHTTP attributes found!"),
QMessageBox::information(nullptr, tr("KeePassXC: No entry with KeePassHTTP attributes found!"),
tr("The active database does not contain an entry with KeePassHTTP attributes."),
QMessageBox::Ok);
}

View File

@ -169,7 +169,7 @@ QString BrowserSettings::customProxyLocation()
return config()->get("Browser/CustomProxyLocation", "").toString();
}
void BrowserSettings::setCustomProxyLocation(QString location)
void BrowserSettings::setCustomProxyLocation(const QString& location)
{
config()->set("Browser/CustomProxyLocation", location);
}
@ -364,7 +364,7 @@ QString BrowserSettings::passwordExcludedChars()
return config()->get("generator/ExcludedChars", PasswordGenerator::DefaultExcludedChars).toString();
}
void BrowserSettings::setPasswordExcludedChars(QString chars)
void BrowserSettings::setPasswordExcludedChars(const QString& chars)
{
config()->set("generator/ExcludedChars", chars);
}
@ -384,7 +384,7 @@ QString BrowserSettings::passPhraseWordSeparator()
return config()->get("generator/WordSeparator", PassphraseGenerator::DefaultSeparator).toString();
}
void BrowserSettings::setPassPhraseWordSeparator(QString separator)
void BrowserSettings::setPassPhraseWordSeparator(const QString& separator)
{
config()->set("generator/WordSeparator", separator);
}
@ -496,7 +496,7 @@ QString BrowserSettings::generatePassword()
}
}
void BrowserSettings::updateBinaryPaths(QString customProxyLocation)
void BrowserSettings::updateBinaryPaths(const QString& customProxyLocation)
{
bool isProxy = supportBrowserProxy();
m_hostInstaller.updateBinaryPaths(isProxy, customProxyLocation);

View File

@ -59,7 +59,7 @@ public:
bool useCustomProxy();
void setUseCustomProxy(bool enabled);
QString customProxyLocation();
void setCustomProxyLocation(QString location);
void setCustomProxyLocation(const QString& location);
bool updateBinaryPath();
void setUpdateBinaryPath(bool enabled);
bool chromeSupport();
@ -98,11 +98,11 @@ public:
bool advancedMode();
void setAdvancedMode(bool advancedMode);
QString passwordExcludedChars();
void setPasswordExcludedChars(QString chars);
void setPasswordExcludedChars(const QString& chars);
int passPhraseWordCount();
void setPassPhraseWordCount(int wordCount);
QString passPhraseWordSeparator();
void setPassPhraseWordSeparator(QString separator);
void setPassPhraseWordSeparator(const QString& separator);
int generatorType();
void setGeneratorType(int type);
bool passwordEveryGroup();
@ -114,7 +114,7 @@ public:
PasswordGenerator::CharClasses passwordCharClasses();
PasswordGenerator::GeneratorFlags passwordGeneratorFlags();
QString generatePassword();
void updateBinaryPaths(QString customProxyLocation = QString());
void updateBinaryPaths(const QString& customProxyLocation = QString());
bool checkIfProxyExists(QString& path);
private:

View File

@ -111,7 +111,7 @@ void HostInstaller::installBrowser(SupportedBrowsers browser,
// Always create the script file
QJsonObject script = constructFile(browser, proxy, location);
if (!saveFile(browser, script)) {
QMessageBox::critical(0,
QMessageBox::critical(nullptr,
tr("KeePassXC: Cannot save file!"),
tr("Cannot save the native messaging script file."),
QMessageBox::Ok);

View File

@ -31,7 +31,7 @@ class NativeMessagingHost : public NativeMessagingBase
typedef QList<QLocalSocket*> SocketList;
public:
explicit NativeMessagingHost(DatabaseTabWidget* parent = 0, const bool enabled = false);
explicit NativeMessagingHost(DatabaseTabWidget* parent = nullptr, const bool enabled = false);
~NativeMessagingHost();
int init();
void run();
@ -41,8 +41,8 @@ signals:
void quit();
private:
void readLength();
bool readStdIn(const quint32 length);
void readLength() override;
bool readStdIn(const quint32 length) override;
void sendReplyToAllClients(const QJsonObject& json);
private slots:

View File

@ -25,7 +25,7 @@ class Add : public Command
public:
Add();
~Add();
int execute(const QStringList& arguments);
int execute(const QStringList& arguments) override;
};
#endif // KEEPASSXC_ADD_H

View File

@ -15,31 +15,18 @@
set(cli_SOURCES
Add.cpp
Add.h
Clip.cpp
Clip.h
Command.cpp
Command.h
Diceware.cpp
Diceware.h
Edit.cpp
Edit.h
Estimate.cpp
Estimate.h
Extract.cpp
Extract.h
Generate.cpp
Generate.h
List.cpp
List.h
Locate.cpp
Locate.h
Merge.cpp
Merge.h
Remove.cpp
Remove.h
Show.cpp
Show.h)
Show.cpp)
add_library(cli STATIC ${cli_SOURCES})
target_link_libraries(cli Qt5::Core Qt5::Widgets)

View File

@ -71,7 +71,7 @@ int Clip::execute(const QStringList& arguments)
return clipEntry(db, args.at(1), args.value(2));
}
int Clip::clipEntry(Database* database, QString entryPath, QString timeout)
int Clip::clipEntry(Database* database, const QString& entryPath, const QString& timeout)
{
TextStream err(Utils::STDERR);

View File

@ -25,8 +25,8 @@ class Clip : public Command
public:
Clip();
~Clip();
int execute(const QStringList& arguments);
int clipEntry(Database* database, QString entryPath, QString timeout);
int execute(const QStringList& arguments) override;
int clipEntry(Database* database, const QString& entryPath, const QString& timeout);
};
#endif // KEEPASSXC_CLIP_H

View File

@ -71,7 +71,7 @@ void populateCommands()
}
}
Command* Command::getCommand(QString commandName)
Command* Command::getCommand(const QString& commandName)
{
populateCommands();
if (commands.contains(commandName)) {

View File

@ -35,7 +35,7 @@ public:
QString getDescriptionLine();
static QList<Command*> getCommands();
static Command* getCommand(QString commandName);
static Command* getCommand(const QString& commandName);
};
#endif // KEEPASSXC_COMMAND_H

View File

@ -25,7 +25,7 @@ class Diceware : public Command
public:
Diceware();
~Diceware();
int execute(const QStringList& arguments);
int execute(const QStringList& arguments) override;
};
#endif // KEEPASSXC_DICEWARE_H

View File

@ -25,7 +25,7 @@ class Edit : public Command
public:
Edit();
~Edit();
int execute(const QStringList& arguments);
int execute(const QStringList& arguments) override;
};
#endif // KEEPASSXC_EDIT_H

View File

@ -25,7 +25,7 @@ class Estimate : public Command
public:
Estimate();
~Estimate();
int execute(const QStringList& arguments);
int execute(const QStringList& arguments) override;
};
#endif // KEEPASSXC_ESTIMATE_H

View File

@ -77,7 +77,7 @@ int Extract::execute(const QStringList& arguments)
auto fileKey = QSharedPointer<FileKey>::create();
QString errorMsg;
if (!fileKey->load(keyFilePath, &errorMsg)) {
err << QObject::tr("Failed to load key file %1: %2").arg(keyFilePath).arg(errorMsg) << endl;
err << QObject::tr("Failed to load key file %1: %2").arg(keyFilePath, errorMsg) << endl;
return EXIT_FAILURE;
}

View File

@ -25,7 +25,7 @@ class Extract : public Command
public:
Extract();
~Extract();
int execute(const QStringList& arguments);
int execute(const QStringList& arguments) override;
};
#endif // KEEPASSXC_EXTRACT_H

View File

@ -25,7 +25,7 @@ class Generate : public Command
public:
Generate();
~Generate();
int execute(const QStringList& arguments);
int execute(const QStringList& arguments) override;
};
#endif // KEEPASSXC_GENERATE_H

View File

@ -25,7 +25,7 @@ class List : public Command
public:
List();
~List();
int execute(const QStringList& arguments);
int execute(const QStringList& arguments) override;
int listGroup(Database* database, bool recursive, const QString& groupPath = {});
};

View File

@ -25,7 +25,7 @@ class Locate : public Command
public:
Locate();
~Locate();
int execute(const QStringList& arguments);
int execute(const QStringList& arguments) override;
int locateEntry(Database* database, const QString& searchTerm);
};

View File

@ -25,7 +25,7 @@ class Merge : public Command
public:
Merge();
~Merge();
int execute(const QStringList& arguments);
int execute(const QStringList& arguments) override;
};
#endif // KEEPASSXC_MERGE_H

View File

@ -27,7 +27,7 @@ class Remove : public Command
public:
Remove();
~Remove();
int execute(const QStringList& arguments);
int execute(const QStringList& arguments) override;
int removeEntry(Database* database, const QString& databasePath, const QString& entryPath);
};

View File

@ -25,7 +25,7 @@ class Show : public Command
public:
Show();
~Show();
int execute(const QStringList& arguments);
int execute(const QStringList& arguments) override;
int showEntry(Database* database, QStringList attributes, const QString& entryPath);
};

View File

@ -18,6 +18,8 @@
#include "AutoTypeMatch.h"
#include <utility>
AutoTypeMatch::AutoTypeMatch()
: entry(nullptr)
, sequence()
@ -26,7 +28,7 @@ AutoTypeMatch::AutoTypeMatch()
AutoTypeMatch::AutoTypeMatch(Entry* entry, QString sequence)
: entry(entry)
, sequence(sequence)
, sequence(std::move(sequence))
{
}

View File

@ -1,4 +1,4 @@
/*
/*
* Copyright (C) 2016 Enrico Mariotti <enricomariotti@yahoo.it>
* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
*
@ -327,7 +327,7 @@ bool CsvParser::isText(QChar c) const
return !((isCRLF(c)) || (isSeparator(c)));
}
bool CsvParser::isEmptyRow(CsvRow row) const
bool CsvParser::isEmptyRow(const CsvRow& row) const
{
CsvRow::const_iterator it = row.constBegin();
for (; it != row.constEnd(); ++it)
@ -414,7 +414,7 @@ int CsvParser::getCsvRows() const
return m_table.size();
}
void CsvParser::appendStatusMsg(QString s, bool isCritical)
void CsvParser::appendStatusMsg(const QString& s, bool isCritical)
{
m_statusMsg += QObject::tr("%1: (row, col) %2,%3").arg(s, m_currRow, m_currCol).append("\n");
m_isGood = !isCritical;

View File

@ -83,7 +83,7 @@ private:
bool isCRLF(const QChar& c) const;
bool isSpace(const QChar& c) const;
bool isTab(const QChar& c) const;
bool isEmptyRow(CsvRow row) const;
bool isEmptyRow(const CsvRow& row) const;
bool parseFile();
void parseRecord();
void parseField(CsvRow& row);
@ -96,7 +96,7 @@ private:
void clear();
bool skipEndline();
void skipLine();
void appendStatusMsg(QString s, bool isCritical = false);
void appendStatusMsg(const QString& s, bool isCritical = false);
};
#endif // CSVPARSER_H

View File

@ -25,6 +25,7 @@
#include <QTextStream>
#include <QTimer>
#include <QXmlStreamReader>
#include <utility>
#include "cli/Utils.h"
#include "core/Clock.h"
@ -315,7 +316,7 @@ void Database::setCompressionAlgo(Database::CompressionAlgorithm algo)
* @param updateTransformSalt true to update the transform salt
* @return true on success
*/
bool Database::setKey(QSharedPointer<const CompositeKey> key, bool updateChangedTime, bool updateTransformSalt)
bool Database::setKey(const QSharedPointer<const CompositeKey>& key, bool updateChangedTime, bool updateTransformSalt)
{
if (!key) {
m_data.key.reset();
@ -354,7 +355,7 @@ bool Database::hasKey() const
return m_data.hasKey;
}
bool Database::verifyKey(QSharedPointer<CompositeKey> key) const
bool Database::verifyKey(const QSharedPointer<CompositeKey>& key) const
{
Q_ASSERT(hasKey());
@ -492,7 +493,7 @@ Database* Database::openDatabaseFile(const QString& fileName, QSharedPointer<con
}
KeePass2Reader reader;
Database* db = reader.readDatabase(&dbFile, key);
Database* db = reader.readDatabase(&dbFile, std::move(key));
if (reader.hasError()) {
qCritical("Error while parsing the database: %s", qPrintable(reader.errorString()));
return nullptr;
@ -501,7 +502,7 @@ Database* Database::openDatabaseFile(const QString& fileName, QSharedPointer<con
return db;
}
Database* Database::unlockFromStdin(QString databaseFilename, QString keyFilename, FILE* outputDescriptor, FILE* errorDescriptor)
Database* Database::unlockFromStdin(const QString& databaseFilename, const QString& keyFilename, FILE* outputDescriptor, FILE* errorDescriptor)
{
auto compositeKey = QSharedPointer<CompositeKey>::create();
QTextStream out(outputDescriptor);
@ -553,7 +554,7 @@ Database* Database::unlockFromStdin(QString databaseFilename, QString keyFilenam
* @param backup Backup the existing database file, if exists
* @return error string, if any
*/
QString Database::saveToFile(QString filePath, bool atomic, bool backup)
QString Database::saveToFile(const QString& filePath, bool atomic, bool backup)
{
QString error;
if (atomic) {
@ -633,7 +634,7 @@ QString Database::writeDatabase(QIODevice* device)
* @param filePath Path to the file to backup
* @return
*/
bool Database::backupDatabase(QString filePath)
bool Database::backupDatabase(const QString& filePath)
{
QString backupFilePath = filePath;
auto re = QRegularExpression("\\.kdbx$|(?<!\\.kdbx)$", QRegularExpression::CaseInsensitiveOption);
@ -652,7 +653,7 @@ void Database::setKdf(QSharedPointer<Kdf> kdf)
m_data.kdf = std::move(kdf);
}
bool Database::changeKdf(QSharedPointer<Kdf> kdf)
bool Database::changeKdf(const QSharedPointer<Kdf>& kdf)
{
kdf->randomizeSeed();
QByteArray transformedMasterKey;

View File

@ -110,9 +110,9 @@ public:
void setCipher(const QUuid& cipher);
void setCompressionAlgo(Database::CompressionAlgorithm algo);
void setKdf(QSharedPointer<Kdf> kdf);
bool setKey(QSharedPointer<const CompositeKey> key, bool updateChangedTime = true, bool updateTransformSalt = false);
bool setKey(const QSharedPointer<const CompositeKey>& key, bool updateChangedTime = true, bool updateTransformSalt = false);
bool hasKey() const;
bool verifyKey(QSharedPointer<CompositeKey> key) const;
bool verifyKey(const QSharedPointer<CompositeKey>& key) const;
QVariantMap& publicCustomData();
const QVariantMap& publicCustomData() const;
void setPublicCustomData(const QVariantMap& customData);
@ -121,17 +121,17 @@ public:
void emptyRecycleBin();
void setEmitModified(bool value);
void markAsModified();
QString saveToFile(QString filePath, bool atomic = true, bool backup = false);
QString saveToFile(const QString& filePath, bool atomic = true, bool backup = false);
/**
* Returns a unique id that is only valid as long as the Database exists.
*/
const QUuid& uuid();
bool changeKdf(QSharedPointer<Kdf> kdf);
bool changeKdf(const QSharedPointer<Kdf>& kdf);
static Database* databaseByUuid(const QUuid& uuid);
static Database* openDatabaseFile(const QString& fileName, QSharedPointer<const CompositeKey> key);
static Database* unlockFromStdin(QString databaseFilename, QString keyFilename = {},
static Database* unlockFromStdin(const QString& databaseFilename, const QString& keyFilename = {},
FILE* outputDescriptor = stdout, FILE* errorDescriptor = stderr);
signals:
@ -156,7 +156,7 @@ private:
void createRecycleBin();
QString writeDatabase(QIODevice* device);
bool backupDatabase(QString filePath);
bool backupDatabase(const QString& filePath);
Metadata* const m_metadata;
Group* m_rootGroup;

View File

@ -29,6 +29,7 @@
#include <QDebug>
#include <QDir>
#include <QRegularExpression>
#include <utility>
const int Entry::DefaultIconNumber = 0;
const int Entry::ResolveMaximumDepth = 10;
@ -367,7 +368,7 @@ QString Entry::totp() const
void Entry::setTotp(QSharedPointer<Totp::Settings> settings)
{
beginUpdate();
m_data.totpSettings = settings;
m_data.totpSettings = std::move(settings);
auto text = Totp::writeSettings(m_data.totpSettings, title(), username());
if (m_attributes->hasKey(Totp::ATTRIBUTE_OTP)) {

View File

@ -34,12 +34,12 @@ EntrySearcher::searchEntries(const QString& searchTerm, const Group* group, Qt::
{
QList<Entry*> searchResult;
const QList<Entry*> entryList = group->entries();
const QList<Entry*>& entryList = group->entries();
for (Entry* entry : entryList) {
searchResult.append(matchEntry(searchTerm, entry, caseSensitivity));
}
const QList<Group*> children = group->children();
const QList<Group*>& children = group->children();
for (Group* childGroup : children) {
if (childGroup->searchingEnabled() != Group::Disable) {
if (matchGroup(searchTerm, childGroup, caseSensitivity)) {

View File

@ -563,7 +563,7 @@ Entry* Group::findEntryByUuid(const QUuid& uuid) const
return nullptr;
}
Entry* Group::findEntryByPath(QString entryPath)
Entry* Group::findEntryByPath(const QString& entryPath)
{
if (entryPath.isEmpty()) {
return nullptr;
@ -578,7 +578,7 @@ Entry* Group::findEntryByPath(QString entryPath)
return findEntryByPathRecursive(normalizedEntryPath, "/");
}
Entry* Group::findEntryByPathRecursive(QString entryPath, QString basePath)
Entry* Group::findEntryByPathRecursive(const QString& entryPath, const QString& basePath)
{
// Return the first entry that matches the full path OR if there is no leading
// slash, return the first entry title that matches
@ -599,7 +599,7 @@ Entry* Group::findEntryByPathRecursive(QString entryPath, QString basePath)
return nullptr;
}
Group* Group::findGroupByPath(QString groupPath)
Group* Group::findGroupByPath(const QString& groupPath)
{
// normalize the groupPath by adding missing front and rear slashes. once.
QString normalizedGroupPath;
@ -614,7 +614,7 @@ Group* Group::findGroupByPath(QString groupPath)
return findGroupByPathRecursive(normalizedGroupPath, "/");
}
Group* Group::findGroupByPathRecursive(QString groupPath, QString basePath)
Group* Group::findGroupByPathRecursive(const QString& groupPath, const QString& basePath)
{
// paths must be normalized
Q_ASSERT(groupPath.startsWith("/") && groupPath.endsWith("/"));
@ -811,7 +811,7 @@ void Group::removeEntry(Entry* entry)
{
Q_ASSERT_X(m_entries.contains(entry),
Q_FUNC_INFO,
QString("Group %1 does not contain %2").arg(this->name()).arg(entry->title()).toLatin1());
QString("Group %1 does not contain %2").arg(this->name(), entry->title()).toLatin1());
emit entryAboutToRemove(entry);
@ -850,9 +850,9 @@ void Group::recSetDatabase(Database* db)
connect(this, SIGNAL(dataChanged(Group*)), db, SIGNAL(groupDataChanged(Group*)));
connect(this, SIGNAL(aboutToRemove(Group*)), db, SIGNAL(groupAboutToRemove(Group*)));
connect(this, SIGNAL(removed()), db, SIGNAL(groupRemoved()));
connect(this, SIGNAL(aboutToAdd(Group*, int)), db, SIGNAL(groupAboutToAdd(Group*, int)));
connect(this, SIGNAL(aboutToAdd(Group*,int)), db, SIGNAL(groupAboutToAdd(Group*,int)));
connect(this, SIGNAL(added()), db, SIGNAL(groupAdded()));
connect(this, SIGNAL(aboutToMove(Group*, Group*, int)), db, SIGNAL(groupAboutToMove(Group*, Group*, int)));
connect(this, SIGNAL(aboutToMove(Group*,Group*,int)), db, SIGNAL(groupAboutToMove(Group*,Group*,int)));
connect(this, SIGNAL(moved()), db, SIGNAL(groupMoved()));
connect(this, SIGNAL(modified()), db, SIGNAL(modifiedImmediate()));
}
@ -926,7 +926,7 @@ bool Group::resolveAutoTypeEnabled() const
}
}
QStringList Group::locate(QString locateTerm, QString currentPath)
QStringList Group::locate(const QString& locateTerm, const QString& currentPath) const
{
// TODO: Replace with EntrySearcher
QStringList response;
@ -934,15 +934,15 @@ QStringList Group::locate(QString locateTerm, QString currentPath)
return response;
}
for (Entry* entry : asConst(m_entries)) {
for (const Entry* entry : asConst(m_entries)) {
QString entryPath = currentPath + entry->title();
if (entryPath.toLower().contains(locateTerm.toLower())) {
response << entryPath;
}
}
for (Group* group : asConst(m_children)) {
for (QString path : group->locate(locateTerm, currentPath + group->name() + QString("/"))) {
for (const Group* group : asConst(m_children)) {
for (const QString& path : group->locate(locateTerm, currentPath + group->name() + QString("/"))) {
response << path;
}
}
@ -950,7 +950,7 @@ QStringList Group::locate(QString locateTerm, QString currentPath)
return response;
}
Entry* Group::addEntryWithPath(QString entryPath)
Entry* Group::addEntryWithPath(const QString& entryPath)
{
if (entryPath.isEmpty() || findEntryByPath(entryPath)) {
return nullptr;

View File

@ -115,11 +115,11 @@ public:
Group* findChildByName(const QString& name);
Entry* findEntryByUuid(const QUuid& uuid) const;
Entry* findEntryByPath(QString entryPath);
Entry* findEntryByPath(const QString& entryPath);
Group* findGroupByUuid(const QUuid& uuid);
Group* findGroupByPath(QString groupPath);
QStringList locate(QString locateTerm, QString currentPath = {"/"});
Entry* addEntryWithPath(QString entryPath);
Group* findGroupByPath(const QString& groupPath);
QStringList locate(const QString& locateTerm, const QString& currentPath = {"/"}) const;
Entry* addEntryWithPath(const QString& entryPath);
void setUuid(const QUuid& uuid);
void setName(const QString& name);
void setNotes(const QString& notes);
@ -190,8 +190,8 @@ private:
void cleanupParent();
void recCreateDelObjects();
Entry* findEntryByPathRecursive(QString entryPath, QString basePath);
Group* findGroupByPathRecursive(QString groupPath, QString basePath);
Entry* findEntryByPathRecursive(const QString& entryPath, const QString& basePath);
Group* findGroupByPathRecursive(const QString& groupPath, const QString& basePath);
QPointer<Database> m_db;
QUuid m_uuid;

View File

@ -95,7 +95,7 @@ Merger::ChangeList Merger::mergeGroup(const MergeContext& context)
// Entry is already present in the database. Update it.
const bool locationChanged = targetEntry->timeInfo().locationChanged() < sourceEntry->timeInfo().locationChanged();
if (locationChanged && targetEntry->group() != context.m_targetGroup) {
changes << tr("Relocating %1 [%2]").arg(sourceEntry->title()).arg(sourceEntry->uuidToHex());
changes << tr("Relocating %1 [%2]").arg(sourceEntry->title(), sourceEntry->uuidToHex());
moveEntry(targetEntry, context.m_targetGroup);
}
changes << resolveEntryConflict(context, sourceEntry, targetEntry);
@ -107,7 +107,7 @@ Merger::ChangeList Merger::mergeGroup(const MergeContext& context)
for (Group* sourceChildGroup : sourceChildGroups) {
Group* targetChildGroup = context.m_targetRootGroup->findGroupByUuid(sourceChildGroup->uuid());
if (!targetChildGroup) {
changes << tr("Creating missing %1 [%2]").arg(sourceChildGroup->name()).arg(sourceChildGroup->uuidToHex());
changes << tr("Creating missing %1 [%2]").arg(sourceChildGroup->name(), sourceChildGroup->uuidToHex());
targetChildGroup = sourceChildGroup->clone(Entry::CloneNoFlags, Group::CloneNoFlags);
moveGroup(targetChildGroup, context.m_targetGroup);
TimeInfo timeinfo = targetChildGroup->timeInfo();
@ -117,7 +117,7 @@ Merger::ChangeList Merger::mergeGroup(const MergeContext& context)
bool locationChanged =
targetChildGroup->timeInfo().locationChanged() < sourceChildGroup->timeInfo().locationChanged();
if (locationChanged && targetChildGroup->parent() != context.m_targetGroup) {
changes << tr("Relocating %1 [%2]").arg(sourceChildGroup->name()).arg(sourceChildGroup->uuidToHex());
changes << tr("Relocating %1 [%2]").arg(sourceChildGroup->name(), sourceChildGroup->uuidToHex());
moveGroup(targetChildGroup, context.m_targetGroup);
TimeInfo timeinfo = targetChildGroup->timeInfo();
timeinfo.setLocationChanged(sourceChildGroup->timeInfo().locationChanged());
@ -146,7 +146,7 @@ Merger::ChangeList Merger::resolveGroupConflict(const MergeContext& context, con
// only if the other group is newer, update the existing one.
if (timeExisting < timeOther) {
changes << tr("Overwriting %1 [%2]").arg(sourceChildGroup->name()).arg(sourceChildGroup->uuidToHex());
changes << tr("Overwriting %1 [%2]").arg(sourceChildGroup->name(), sourceChildGroup->uuidToHex());
targetChildGroup->setName(sourceChildGroup->name());
targetChildGroup->setNotes(sourceChildGroup->notes());
if (sourceChildGroup->iconNumber() == 0) {
@ -270,16 +270,12 @@ Merger::ChangeList Merger::resolveEntryConflict_Duplicate(const MergeContext& co
Entry* clonedEntry = sourceEntry->clone(Entry::CloneNewUuid | Entry::CloneIncludeHistory);
moveEntry(clonedEntry, context.m_targetGroup);
markOlderEntry(targetEntry);
changes << tr("Adding backup for older target %1 [%2]")
.arg(targetEntry->title())
.arg(targetEntry->uuidToHex());
changes << tr("Adding backup for older target %1 [%2]").arg(targetEntry->title(), targetEntry->uuidToHex());
} else if (comparison > 0) {
Entry* clonedEntry = sourceEntry->clone(Entry::CloneNewUuid | Entry::CloneIncludeHistory);
moveEntry(clonedEntry, context.m_targetGroup);
markOlderEntry(clonedEntry);
changes << tr("Adding backup for older source %1 [%2]")
.arg(sourceEntry->title())
.arg(sourceEntry->uuidToHex());
changes << tr("Adding backup for older source %1 [%2]").arg(sourceEntry->title(), sourceEntry->uuidToHex());
}
return changes;
}
@ -297,8 +293,7 @@ Merger::ChangeList Merger::resolveEntryConflict_KeepLocal(const MergeContext& co
// this type of merge changes the database timestamp since reapplying the
// old entry is an active change of the database!
changes << tr("Reapplying older target entry on top of newer source %1 [%2]")
.arg(targetEntry->title())
.arg(targetEntry->uuidToHex());
.arg(targetEntry->title(), targetEntry->uuidToHex());
Entry* agedTargetEntry = targetEntry->clone(Entry::CloneNoFlags);
targetEntry->addHistoryItem(agedTargetEntry);
}
@ -318,8 +313,7 @@ Merger::ChangeList Merger::resolveEntryConflict_KeepRemote(const MergeContext& c
// this type of merge changes the database timestamp since reapplying the
// old entry is an active change of the database!
changes << tr("Reapplying older source entry on top of newer target %1 [%2]")
.arg(targetEntry->title())
.arg(targetEntry->uuidToHex());
.arg(targetEntry->title(), targetEntry->uuidToHex());
targetEntry->beginUpdate();
targetEntry->copyDataFrom(sourceEntry);
targetEntry->endUpdate();
@ -342,9 +336,7 @@ Merger::ChangeList Merger::resolveEntryConflict_MergeHistories(const MergeContex
qPrintable(targetEntry->title()),
qPrintable(sourceEntry->title()),
qPrintable(currentGroup->name()));
changes << tr("Synchronizing from newer source %1 [%2]")
.arg(targetEntry->title())
.arg(targetEntry->uuidToHex());
changes << tr("Synchronizing from newer source %1 [%2]").arg(targetEntry->title(), targetEntry->uuidToHex());
moveEntry(clonedEntry, currentGroup);
mergeHistory(targetEntry, clonedEntry, mergeMethod);
eraseEntry(targetEntry);
@ -355,9 +347,7 @@ Merger::ChangeList Merger::resolveEntryConflict_MergeHistories(const MergeContex
qPrintable(targetEntry->group()->name()));
const bool changed = mergeHistory(sourceEntry, targetEntry, mergeMethod);
if (changed) {
changes << tr("Synchronizing from older source %1 [%2]")
.arg(targetEntry->title())
.arg(targetEntry->uuidToHex());
changes << tr("Synchronizing from older source %1 [%2]").arg(targetEntry->title(), targetEntry->uuidToHex());
}
}
return changes;
@ -550,9 +540,9 @@ Merger::ChangeList Merger::mergeDeletions(const MergeContext& context)
}
deletions << object;
if (entry->group()) {
changes << tr("Deleting child %1 [%2]").arg(entry->title()).arg(entry->uuidToHex());
changes << tr("Deleting child %1 [%2]").arg(entry->title(), entry->uuidToHex());
} else {
changes << tr("Deleting orphan %1 [%2]").arg(entry->title()).arg(entry->uuidToHex());
changes << tr("Deleting orphan %1 [%2]").arg(entry->title(), entry->uuidToHex());
}
// Entry is inserted into deletedObjects after deletions are processed
eraseEntry(entry);
@ -576,9 +566,9 @@ Merger::ChangeList Merger::mergeDeletions(const MergeContext& context)
}
deletions << object;
if (group->parentGroup()) {
changes << tr("Deleting child %1 [%2]").arg(group->name()).arg(group->uuidToHex());
changes << tr("Deleting child %1 [%2]").arg(group->name(), group->uuidToHex());
} else {
changes << tr("Deleting orphan %1 [%2]").arg(group->name()).arg(group->uuidToHex());
changes << tr("Deleting orphan %1 [%2]").arg(group->name(), group->uuidToHex());
}
eraseGroup(group);
}

View File

@ -25,15 +25,15 @@ const char* PasswordGenerator::DefaultExcludedChars = "";
PasswordGenerator::PasswordGenerator()
: m_length(0)
, m_classes(0)
, m_flags(0)
, m_classes(nullptr)
, m_flags(nullptr)
, m_excluded(PasswordGenerator::DefaultExcludedChars)
{
}
double PasswordGenerator::calculateEntropy(QString password)
double PasswordGenerator::calculateEntropy(const QString& password)
{
return ZxcvbnMatch(password.toLatin1(), 0, 0);
return ZxcvbnMatch(password.toLatin1(), nullptr, nullptr);
}
void PasswordGenerator::setLength(int length)

View File

@ -57,7 +57,7 @@ public:
public:
PasswordGenerator();
double calculateEntropy(QString password);
double calculateEntropy(const QString& password);
void setLength(int length);
void setCharClasses(const CharClasses& classes);
void setFlags(const GeneratorFlags& flags);

View File

@ -24,10 +24,10 @@ class ScreenLockListenerPrivate : public QObject
{
Q_OBJECT
public:
static ScreenLockListenerPrivate* instance(QWidget* parent = 0);
static ScreenLockListenerPrivate* instance(QWidget* parent = nullptr);
protected:
ScreenLockListenerPrivate(QWidget* parent = 0);
ScreenLockListenerPrivate(QWidget* parent = nullptr);
signals:
void screenLocked();

View File

@ -27,7 +27,7 @@ class ScreenLockListenerWin : public ScreenLockListenerPrivate, public QAbstract
{
Q_OBJECT
public:
explicit ScreenLockListenerWin(QWidget* parent = 0);
explicit ScreenLockListenerWin(QWidget* parent = nullptr);
~ScreenLockListenerWin();
virtual bool nativeEventFilter(const QByteArray& eventType, void* message, long*) override;

View File

@ -121,8 +121,8 @@ QString imageReaderFilter()
QStringList formatsStringList;
for (const QByteArray& format : formats) {
for (int i = 0; i < format.size(); i++) {
if (!QChar(format.at(i)).isLetterOrNumber()) {
for (char codePoint : format) {
if (!QChar(codePoint).isLetterOrNumber()) {
continue;
}
}

View File

@ -336,4 +336,4 @@ bool Crypto::testChaCha20()
}
return true;
}
}

View File

@ -64,7 +64,7 @@ bool CsvExporter::writeGroup(QIODevice* device, const Group* group, QString grou
}
groupPath.append(group->name());
const QList<Entry*> entryList = group->entries();
const QList<Entry*>& entryList = group->entries();
for (const Entry* entry : entryList) {
QString line;
@ -83,7 +83,7 @@ bool CsvExporter::writeGroup(QIODevice* device, const Group* group, QString grou
}
}
const QList<Group*> children = group->children();
const QList<Group*>& children = group->children();
for (const Group* child : children) {
if (!writeGroup(device, child, groupPath)) {
return false;

View File

@ -28,6 +28,7 @@
#include <QBuffer>
#include <QFile>
#include <utility>
#define UUID_LENGTH 16
@ -43,9 +44,9 @@ KdbxXmlReader::KdbxXmlReader(quint32 version)
* @param version KDBX version
* @param binaryPool binary pool
*/
KdbxXmlReader::KdbxXmlReader(quint32 version, const QHash<QString, QByteArray>& binaryPool)
KdbxXmlReader::KdbxXmlReader(quint32 version, QHash<QString, QByteArray> binaryPool)
: m_kdbxVersion(version)
, m_binaryPool(binaryPool)
, m_binaryPool(std::move(binaryPool))
{
}

View File

@ -42,7 +42,7 @@ class KdbxXmlReader
public:
explicit KdbxXmlReader(quint32 version);
explicit KdbxXmlReader(quint32 version, const QHash<QString, QByteArray>& binaryPool);
explicit KdbxXmlReader(quint32 version, QHash<QString, QByteArray> binaryPool);
virtual ~KdbxXmlReader() = default;
virtual Database* readDatabase(const QString& filename);

View File

@ -37,7 +37,7 @@
class KeePass1Key : public CompositeKey
{
public:
virtual QByteArray rawKey() const;
QByteArray rawKey() const override;
virtual void clear();
void setPassword(const QByteArray& password);
void setKeyfileData(const QByteArray& keyfileData);

View File

@ -59,7 +59,7 @@ const QList<QPair<QUuid, QString>> KeePass2::KDFS{
qMakePair(KeePass2::KDF_AES_KDBX3, QObject::tr("AES-KDF (KDBX 3.1)"))
};
QByteArray KeePass2::hmacKey(QByteArray masterSeed, QByteArray transformedMasterKey)
QByteArray KeePass2::hmacKey(const QByteArray& masterSeed, const QByteArray& transformedMasterKey)
{
CryptoHash hmacKeyHash(CryptoHash::Sha512);
hmacKeyHash.addData(masterSeed);
@ -98,7 +98,7 @@ QSharedPointer<Kdf> KeePass2::kdfFromParameters(const QVariantMap& p)
return kdf;
}
QVariantMap KeePass2::kdfToParameters(QSharedPointer<Kdf> kdf)
QVariantMap KeePass2::kdfToParameters(const QSharedPointer<Kdf>& kdf)
{
return kdf->writeParameters();
}

View File

@ -126,9 +126,9 @@ extern const QList<QPair<QUuid, QString>> KDFS;
ByteArray = 0x42
};
QByteArray hmacKey(QByteArray masterSeed, QByteArray transformedMasterKey);
QByteArray hmacKey(const QByteArray& masterSeed, const QByteArray& transformedMasterKey);
QSharedPointer<Kdf> kdfFromParameters(const QVariantMap& p);
QVariantMap kdfToParameters(QSharedPointer<Kdf> kdf);
QVariantMap kdfToParameters(const QSharedPointer<Kdf>& kdf);
QSharedPointer<Kdf> uuidToKdf(const QUuid& uuid);
ProtectedStreamAlgo idToProtectedStreamAlgo(quint32 id);

View File

@ -21,6 +21,7 @@
#include "format/KeePass1.h"
#include <QFile>
#include <utility>
/**
* Read database from file and detect correct file format.
@ -37,7 +38,7 @@ Database* KeePass2Reader::readDatabase(const QString& filename, QSharedPointer<c
return nullptr;
}
QScopedPointer<Database> db(readDatabase(&file, key));
QScopedPointer<Database> db(readDatabase(&file, std::move(key)));
if (file.error() != QFile::NoError) {
raiseError(file.errorString());

View File

@ -65,9 +65,9 @@ AboutDialog::AboutDialog(QWidget* parent)
#endif
debugInfo.append("\n").append(QString("%1\n- Qt %2\n- %3\n\n")
.arg(tr("Libraries:"))
.arg(QString::fromLocal8Bit(qVersion()))
.arg(Crypto::backendVersion()));
.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")

View File

@ -146,8 +146,8 @@ void ApplicationSettingsWidget::loadSettings()
m_generalUi->languageComboBox->clear();
QList<QPair<QString, QString>> languages = Translator::availableLanguages();
for (int i = 0; i < languages.size(); i++) {
m_generalUi->languageComboBox->addItem(languages[i].second, languages[i].first);
for (const auto& language : languages) {
m_generalUi->languageComboBox->addItem(language.second, language.first);
}
int defaultIndex = m_generalUi->languageComboBox->findData(config()->get("GUI/Language"));
if (defaultIndex > 0) {

View File

@ -39,7 +39,7 @@ CategoryListWidget::CategoryListWidget(QWidget* parent)
connect(m_ui->scrollDown, SIGNAL(clicked()), SLOT(scrollCategoriesDown()));
connect(m_ui->categoryList->verticalScrollBar(), SIGNAL(valueChanged(int)), SLOT(updateCategoryScrollButtons()));
connect(
m_ui->categoryList->verticalScrollBar(), SIGNAL(rangeChanged(int, int)), SLOT(updateCategoryScrollButtons()));
m_ui->categoryList->verticalScrollBar(), SIGNAL(rangeChanged(int,int)), SLOT(updateCategoryScrollButtons()));
}
CategoryListWidget::~CategoryListWidget()

View File

@ -35,7 +35,7 @@ class CategoryListWidget : public QWidget
Q_OBJECT
public:
CategoryListWidget(QWidget* parent = 0);
CategoryListWidget(QWidget* parent = nullptr);
~CategoryListWidget();
int currentCategory();
@ -90,4 +90,4 @@ private:
Q_DISABLE_COPY(CategoryListWidgetDelegate)
};
#endif
#endif

View File

@ -106,7 +106,7 @@ void DatabaseOpenWidget::showEvent(QShowEvent* event)
// showEvent() may be called twice, so make sure we are only polling once
if (!m_yubiKeyBeingPolled) {
connect(
YubiKey::instance(), SIGNAL(detected(int, bool)), SLOT(yubikeyDetected(int, bool)), Qt::QueuedConnection);
YubiKey::instance(), SIGNAL(detected(int,bool)), SLOT(yubikeyDetected(int,bool)), Qt::QueuedConnection);
connect(YubiKey::instance(), SIGNAL(detectComplete()), SLOT(yubikeyDetectComplete()), Qt::QueuedConnection);
connect(YubiKey::instance(), SIGNAL(notFound()), SLOT(noYubikeyFound()), Qt::QueuedConnection);
@ -122,7 +122,7 @@ void DatabaseOpenWidget::hideEvent(QHideEvent* event)
#ifdef WITH_XC_YUBIKEY
// Don't listen to any Yubikey events if we are hidden
disconnect(YubiKey::instance(), 0, this, 0);
disconnect(YubiKey::instance(), nullptr, this, nullptr);
m_yubiKeyBeingPolled = false;
#endif
}
@ -143,7 +143,7 @@ void DatabaseOpenWidget::load(const QString& filename)
QHash<QString, QVariant> useTouchID = config()->get("UseTouchID").toHash();
m_ui->checkTouchID->setChecked(useTouchID.value(m_filename, false).toBool());
m_ui->editPassword->setFocus();
}
@ -195,9 +195,9 @@ void DatabaseOpenWidget::openDatabase()
MessageWidget::Error);
return;
}
if (m_db) {
delete m_db;
}
delete m_db;
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
m_db = reader.readDatabase(&file, masterKey);
QApplication::restoreOverrideCursor();
@ -254,7 +254,7 @@ QSharedPointer<CompositeKey> DatabaseOpenWidget::databaseKey()
// check if the user cancelled the operation
if (passwordKey.isNull())
return QSharedPointer<CompositeKey>();
masterKey->addKey(PasswordKey::fromRawKey(*passwordKey));
}
}

View File

@ -419,7 +419,7 @@ bool DatabaseTabWidget::saveDatabaseAs(Database* db)
oldFilePath,
tr("KeePass 2 Database").append(" (*.kdbx)"),
nullptr,
0,
nullptr,
"kdbx");
if (!newFilePath.isEmpty()) {
// Ensure we don't recurse back into this function
@ -488,7 +488,7 @@ void DatabaseTabWidget::exportToCsv()
}
QString fileName = fileDialog()->getSaveFileName(
this, tr("Export database to CSV file"), QString(), tr("CSV file").append(" (*.csv)"), nullptr, 0, "csv");
this, tr("Export database to CSV file"), QString(), tr("CSV file").append(" (*.csv)"), nullptr, nullptr, "csv");
if (fileName.isEmpty()) {
return;
}
@ -693,7 +693,7 @@ void DatabaseTabWidget::insertDatabase(Database* db, const DatabaseManagerStruct
setCurrentIndex(index);
connectDatabase(db);
connect(dbStruct.dbWidget, SIGNAL(closeRequest()), SLOT(closeDatabaseFromSender()));
connect(dbStruct.dbWidget, SIGNAL(databaseChanged(Database*, bool)), SLOT(changeDatabase(Database*, bool)));
connect(dbStruct.dbWidget, SIGNAL(databaseChanged(Database*,bool)), SLOT(changeDatabase(Database*,bool)));
connect(dbStruct.dbWidget, SIGNAL(unlockedDatabase()), SLOT(updateTabNameFromDbWidgetSender()));
connect(dbStruct.dbWidget, SIGNAL(unlockedDatabase()), SLOT(emitDatabaseUnlockedFromDbWidgetSender()));
}

View File

@ -175,14 +175,14 @@ DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent)
addWidget(m_keepass1OpenWidget);
addWidget(m_unlockDatabaseWidget);
connect(m_mainSplitter, SIGNAL(splitterMoved(int, int)), SIGNAL(mainSplitterSizesChanged()));
connect(m_previewSplitter, SIGNAL(splitterMoved(int, int)), SIGNAL(previewSplitterSizesChanged()));
connect(m_mainSplitter, SIGNAL(splitterMoved(int,int)), SIGNAL(mainSplitterSizesChanged()));
connect(m_previewSplitter, SIGNAL(splitterMoved(int,int)), SIGNAL(previewSplitterSizesChanged()));
connect(m_entryView, SIGNAL(viewStateChanged()), SIGNAL(entryViewStateChanged()));
connect(m_groupView, SIGNAL(groupChanged(Group*)), this, SLOT(onGroupChanged(Group*)));
connect(m_groupView, SIGNAL(groupChanged(Group*)), SIGNAL(groupChanged()));
connect(m_entryView,
SIGNAL(entryActivated(Entry*, EntryModel::ModelColumn)),
SLOT(entryActivationSignalReceived(Entry*, EntryModel::ModelColumn)));
SIGNAL(entryActivated(Entry*,EntryModel::ModelColumn)),
SLOT(entryActivationSignalReceived(Entry*,EntryModel::ModelColumn)));
connect(m_entryView, SIGNAL(entrySelectionChanged()), SIGNAL(entrySelectionChanged()));
connect(m_editEntryWidget, SIGNAL(editFinished(bool)), SLOT(switchToView(bool)));
connect(m_editEntryWidget, SIGNAL(historyEntryActivated(Entry*)), SLOT(switchToHistoryView(Entry*)));

View File

@ -71,8 +71,7 @@ bool DialogyWidget::clickButton(QDialogButtonBox::StandardButton standardButton)
}
QList<QDialogButtonBox*> buttonBoxes = findChildren<QDialogButtonBox*>();
for (int i = 0; i < buttonBoxes.size(); ++i) {
QDialogButtonBox* buttonBox = buttonBoxes.at(i);
for (auto buttonBox : buttonBoxes) {
pb = buttonBox->button(standardButton);
if (pb && pb->isVisible() && pb->isEnabled()) {
pb->click();

View File

@ -84,11 +84,11 @@ EditWidgetIcons::EditWidgetIcons(QWidget* parent)
connect(m_ui->defaultIconsRadio, SIGNAL(toggled(bool)), this, SIGNAL(widgetUpdated()));
connect(m_ui->defaultIconsRadio, SIGNAL(toggled(bool)), this, SIGNAL(widgetUpdated()));
connect(m_ui->defaultIconsView->selectionModel(),
SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this,
SIGNAL(widgetUpdated()));
connect(m_ui->customIconsView->selectionModel(),
SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this,
SIGNAL(widgetUpdated()));
@ -176,7 +176,7 @@ namespace {
// Try to get the 2nd level domain of the host part of a QUrl. For example,
// "foo.bar.example.com" would become "example.com", and "foo.bar.example.co.uk"
// would become "example.co.uk".
QString getSecondLevelDomain(QUrl url)
QString getSecondLevelDomain(const QUrl& url)
{
QString fqdn = url.host();
fqdn.truncate(fqdn.length() - url.topLevelDomain().length());
@ -185,7 +185,7 @@ namespace {
return newdom;
}
QUrl convertVariantToUrl(QVariant var)
QUrl convertVariantToUrl(const QVariant& var)
{
QUrl url;
if (var.canConvert<QUrl>())

View File

@ -33,7 +33,7 @@ EditWidgetProperties::EditWidgetProperties(QWidget* parent)
m_ui->customDataTable->setModel(m_customDataModel);
connect(m_ui->customDataTable->selectionModel(),
SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
SLOT(toggleRemoveButton(QItemSelection)));
connect(m_ui->removeCustomDataButton, SIGNAL(clicked()), SLOT(removeSelectedPluginData()));
}

View File

@ -178,7 +178,7 @@ FileDialog::FileDialog()
{
}
void FileDialog::saveLastDir(QString dir)
void FileDialog::saveLastDir(const QString& dir)
{
if (!dir.isEmpty() && !m_forgetLastDir) {
config()->set("LastDir", QFileInfo(dir).absolutePath());

View File

@ -65,7 +65,7 @@ private:
QString m_nextDirName;
bool m_forgetLastDir = false;
void saveLastDir(QString);
void saveLastDir(const QString&);
static FileDialog* m_instance;

View File

@ -309,10 +309,10 @@ void KMessageWidget::setMessageType(KMessageWidget::MessageType type)
"}"
".QLabel { color: %6; }"
))
.arg(bg0.name())
.arg(bg1.name())
.arg(bg2.name())
.arg(border.name())
.arg(bg0.name(),
bg1.name(),
bg2.name(),
border.name())
// DefaultFrameWidth returns the size of the external margin + border width. We know our border is 1px,
// so we subtract this from the frame normal QStyle FrameWidth to get our margin
.arg(style()->pixelMetric(QStyle::PM_DefaultFrameWidth, nullptr, this) - 1)
@ -411,7 +411,7 @@ void KMessageWidget::removeAction(QAction *action)
void KMessageWidget::animatedShow()
{
if (!style()->styleHint(QStyle::SH_Widget_Animate, 0, this)) {
if (!style()->styleHint(QStyle::SH_Widget_Animate, nullptr, this)) {
show();
emit showAnimationFinished();
return;
@ -436,7 +436,7 @@ void KMessageWidget::animatedShow()
void KMessageWidget::animatedHide()
{
if (!style()->styleHint(QStyle::SH_Widget_Animate, 0, this)) {
if (!style()->styleHint(QStyle::SH_Widget_Animate, nullptr, this)) {
hide();
emit hideAnimationFinished();
return;

View File

@ -53,9 +53,9 @@ void KeePass1OpenWidget::openDatabase()
MessageWidget::Error);
return;
}
if (m_db) {
delete m_db;
}
delete m_db;
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
m_db = reader.readDatabase(&file, password, keyFileName);
QApplication::restoreOverrideCursor();

View File

@ -319,14 +319,14 @@ MainWindow::MainWindow()
#endif
connect(m_ui->tabWidget,
SIGNAL(messageGlobal(QString, MessageWidget::MessageType)),
SIGNAL(messageGlobal(QString,MessageWidget::MessageType)),
this,
SLOT(displayGlobalMessage(QString, MessageWidget::MessageType)));
SLOT(displayGlobalMessage(QString,MessageWidget::MessageType)));
connect(m_ui->tabWidget, SIGNAL(messageDismissGlobal()), this, SLOT(hideGlobalMessage()));
connect(m_ui->tabWidget,
SIGNAL(messageTab(QString, MessageWidget::MessageType)),
SIGNAL(messageTab(QString,MessageWidget::MessageType)),
this,
SLOT(displayTabMessage(QString, MessageWidget::MessageType)));
SLOT(displayTabMessage(QString,MessageWidget::MessageType)));
connect(m_ui->tabWidget, SIGNAL(messageDismissTab()), this, SLOT(hideTabMessage()));
m_screenLockListener = new ScreenLockListener(this);
@ -673,7 +673,7 @@ void MainWindow::switchToOpenDatabase()
switchToDatabases();
}
void MainWindow::switchToDatabaseFile(QString file)
void MainWindow::switchToDatabaseFile(const QString& file)
{
m_ui->tabWidget->openDatabase(file);
switchToDatabases();

View File

@ -90,7 +90,7 @@ private slots:
void switchToPasswordGen(bool enabled);
void switchToNewDatabase();
void switchToOpenDatabase();
void switchToDatabaseFile(QString file);
void switchToDatabaseFile(const QString& file);
void switchToKeePass1Database();
void switchToCsvImport();
void closePasswordGen();

View File

@ -28,7 +28,7 @@ class MessageWidget : public KMessageWidget
Q_OBJECT
public:
explicit MessageWidget(QWidget* parent = 0);
explicit MessageWidget(QWidget* parent = nullptr);
int autoHideTimeout() const;

View File

@ -98,7 +98,7 @@ void PasswordEdit::updateStylesheet()
setStyleSheet(stylesheet);
}
void PasswordEdit::autocompletePassword(QString password)
void PasswordEdit::autocompletePassword(const QString& password)
{
if (config()->get("security/passwordsrepeat").toBool() && echoMode() == QLineEdit::Normal) {
setText(password);

View File

@ -41,7 +41,7 @@ signals:
private slots:
void updateStylesheet();
void autocompletePassword(QString password);
void autocompletePassword(const QString& password);
private:
bool passwordsEqual() const;

View File

@ -35,7 +35,7 @@ class SearchWidget : public QWidget
Q_OBJECT
public:
explicit SearchWidget(QWidget* parent = 0);
explicit SearchWidget(QWidget* parent = nullptr);
~SearchWidget();
void connectSignals(SignalMultiplexer& mx);
@ -55,7 +55,7 @@ signals:
void enterPressed();
public slots:
void databaseChanged(DatabaseWidget* dbWidget = 0);
void databaseChanged(DatabaseWidget* dbWidget = nullptr);
private slots:
void startSearchTimer();

View File

@ -315,7 +315,7 @@ void CsvImportWidget::setRootGroup()
m_db->rootGroup()->setName("Root");
}
Group* CsvImportWidget::splitGroups(QString label)
Group* CsvImportWidget::splitGroups(const QString& label)
{
// extract group names from nested path provided in "label"
Group* current = m_db->rootGroup();
@ -345,7 +345,7 @@ Group* CsvImportWidget::splitGroups(QString label)
return current;
}
Group* CsvImportWidget::hasChildren(Group* current, QString groupName)
Group* CsvImportWidget::hasChildren(Group* current, const QString& groupName)
{
// returns the group whose name is "groupName" and is child of "current" group
for (Group* group : current->children()) {

View File

@ -68,8 +68,8 @@ private:
QStringList m_fieldSeparatorList;
void configParser();
void updateTableview();
Group* splitGroups(QString label);
Group* hasChildren(Group* current, QString groupName);
Group* splitGroups(const QString& label);
Group* hasChildren(Group* current, const QString& groupName);
QString formatStatusText() const;
};

View File

@ -18,6 +18,8 @@
#include "CsvParserModel.h"
#include <utility>
CsvParserModel::CsvParserModel(QObject* parent)
: QAbstractTableModel(parent)
, m_skipped(0)
@ -36,9 +38,9 @@ void CsvParserModel::setFilename(const QString& filename)
QString CsvParserModel::getFileInfo()
{
QString a(tr("%1, %2, %3", "file info: bytes, rows, columns")
.arg(tr("%n byte(s)", nullptr, getFileSize()))
.arg(tr("%n row(s)", nullptr, getCsvRows()))
.arg(tr("%n column(s)", nullptr, qMax(0, getCsvCols() - 1))));
.arg(tr("%n byte(s)", nullptr, getFileSize()),
tr("%n row(s)", nullptr, getCsvRows()),
tr("%n column(s)", nullptr, qMax(0, getCsvCols() - 1))));
return a;
}
@ -92,7 +94,7 @@ void CsvParserModel::setSkippedRows(int skipped)
void CsvParserModel::setHeaderLabels(QStringList l)
{
m_columnHeader = l;
m_columnHeader = std::move(l);
}
int CsvParserModel::rowCount(const QModelIndex& parent) const

View File

@ -38,7 +38,7 @@ DatabaseSettingsWidgetBrowser::DatabaseSettingsWidgetBrowser(QWidget* parent)
m_ui->customDataTable->setModel(m_customDataModel);
settingsWarning();
connect(m_ui->customDataTable->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
connect(m_ui->customDataTable->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
SLOT(toggleRemoveButton(QItemSelection)));
connect(m_ui->removeCustomDataButton, SIGNAL(clicked()), SLOT(removeSelectedKey()));
connect(m_ui->convertToCustomData, SIGNAL(clicked()), this, SLOT(convertAttributesToCustomData()));

View File

@ -37,7 +37,7 @@ AutoTypeMatch AutoTypeMatchModel::matchFromIndex(const QModelIndex& index) const
return m_matches.at(index.row());
}
QModelIndex AutoTypeMatchModel::indexFromMatch(AutoTypeMatch match) const
QModelIndex AutoTypeMatchModel::indexFromMatch(const AutoTypeMatch& match) const
{
int row = m_matches.indexOf(match);
Q_ASSERT(row != -1);

View File

@ -41,7 +41,7 @@ public:
explicit AutoTypeMatchModel(QObject* parent = nullptr);
AutoTypeMatch matchFromIndex(const QModelIndex& index) const;
QModelIndex indexFromMatch(AutoTypeMatch match) const;
QModelIndex indexFromMatch(const AutoTypeMatch& match) const;
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
int columnCount(const QModelIndex& parent = QModelIndex()) const override;

View File

@ -44,7 +44,7 @@ AutoTypeMatchView::AutoTypeMatchView(QWidget* parent)
connect(this, SIGNAL(doubleClicked(QModelIndex)), SLOT(emitMatchActivated(QModelIndex)));
connect(
selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), SIGNAL(matchSelectionChanged()));
selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SIGNAL(matchSelectionChanged()));
}
void AutoTypeMatchView::keyPressEvent(QKeyEvent* event)
@ -98,7 +98,7 @@ AutoTypeMatch AutoTypeMatchView::currentMatch()
return AutoTypeMatch();
}
void AutoTypeMatchView::setCurrentMatch(AutoTypeMatch match)
void AutoTypeMatchView::setCurrentMatch(const AutoTypeMatch& match)
{
selectionModel()->setCurrentIndex(m_sortModel->mapFromSource(m_model->indexFromMatch(match)),
QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);

View File

@ -34,7 +34,7 @@ class AutoTypeMatchView : public QTreeView
public:
explicit AutoTypeMatchView(QWidget* parent = nullptr);
AutoTypeMatch currentMatch();
void setCurrentMatch(AutoTypeMatch match);
void setCurrentMatch(const AutoTypeMatch& match);
AutoTypeMatch matchFromIndex(const QModelIndex& index);
void setMatchList(const QList<AutoTypeMatch>& matches);
void setFirstMatchActive();

View File

@ -103,8 +103,8 @@ EditEntryWidget::EditEntryWidget(QWidget* parent)
connect(this, SIGNAL(rejected()), SLOT(cancel()));
connect(this, SIGNAL(apply()), SLOT(commitEntry()));
connect(m_iconsWidget,
SIGNAL(messageEditEntry(QString, MessageWidget::MessageType)),
SLOT(showMessage(QString, MessageWidget::MessageType)));
SIGNAL(messageEditEntry(QString,MessageWidget::MessageType)),
SLOT(showMessage(QString,MessageWidget::MessageType)));
connect(m_iconsWidget, SIGNAL(messageEditEntryDismiss()), SLOT(hideMessage()));
m_mainUi->passwordGenerator->layout()->setContentsMargins(0, 0, 0, 0);
@ -161,7 +161,7 @@ void EditEntryWidget::setupAdvanced()
connect(m_advancedUi->protectAttributeButton, SIGNAL(toggled(bool)), SLOT(protectCurrentAttribute(bool)));
connect(m_advancedUi->revealAttributeButton, SIGNAL(clicked(bool)), SLOT(revealCurrentAttribute()));
connect(m_advancedUi->attributesView->selectionModel(),
SIGNAL(currentChanged(QModelIndex, QModelIndex)),
SIGNAL(currentChanged(QModelIndex,QModelIndex)),
SLOT(updateCurrentAttribute()));
connect(m_advancedUi->fgColorButton, SIGNAL(clicked()), SLOT(pickColor()));
connect(m_advancedUi->bgColorButton, SIGNAL(clicked()), SLOT(pickColor()));
@ -192,11 +192,11 @@ void EditEntryWidget::setupAutoType()
connect(m_autoTypeUi->assocAddButton, SIGNAL(clicked()), SLOT(insertAutoTypeAssoc()));
connect(m_autoTypeUi->assocRemoveButton, SIGNAL(clicked()), SLOT(removeAutoTypeAssoc()));
connect(m_autoTypeUi->assocView->selectionModel(),
SIGNAL(currentRowChanged(QModelIndex, QModelIndex)),
SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
SLOT(updateAutoTypeEnabled()));
connect(m_autoTypeAssocModel, SIGNAL(modelReset()), SLOT(updateAutoTypeEnabled()));
connect(m_autoTypeUi->assocView->selectionModel(),
SIGNAL(currentRowChanged(QModelIndex, QModelIndex)),
SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
SLOT(loadCurrentAssoc(QModelIndex)));
connect(m_autoTypeAssocModel, SIGNAL(modelReset()), SLOT(clearCurrentAssoc()));
connect(m_autoTypeUi->windowTitleCombo, SIGNAL(editTextChanged(QString)), SLOT(applyCurrentAssoc()));
@ -225,8 +225,8 @@ void EditEntryWidget::setupHistory()
connect(m_historyUi->historyView, SIGNAL(activated(QModelIndex)), SLOT(histEntryActivated(QModelIndex)));
connect(m_historyUi->historyView->selectionModel(),
SIGNAL(currentChanged(QModelIndex, QModelIndex)),
SLOT(updateHistoryButtons(QModelIndex, QModelIndex)));
SIGNAL(currentChanged(QModelIndex,QModelIndex)),
SLOT(updateHistoryButtons(QModelIndex,QModelIndex)));
connect(m_historyUi->showButton, SIGNAL(clicked()), SLOT(showHistoryEntry()));
connect(m_historyUi->restoreButton, SIGNAL(clicked()), SLOT(restoreHistoryEntry()));
connect(m_historyUi->deleteButton, SIGNAL(clicked()), SLOT(deleteHistoryEntry()));
@ -236,14 +236,14 @@ void EditEntryWidget::setupHistory()
void EditEntryWidget::setupEntryUpdate()
{
// Entry tab
connect(m_mainUi->titleEdit, SIGNAL(textChanged(const QString&)), this, SLOT(setUnsavedChanges()));
connect(m_mainUi->usernameEdit, SIGNAL(textChanged(const QString&)), this, SLOT(setUnsavedChanges()));
connect(m_mainUi->passwordEdit, SIGNAL(textChanged(const QString&)), this, SLOT(setUnsavedChanges()));
connect(m_mainUi->passwordRepeatEdit, SIGNAL(textChanged(const QString&)), this, SLOT(setUnsavedChanges()));
connect(m_mainUi->urlEdit, SIGNAL(textChanged(const QString&)), this, SLOT(setUnsavedChanges()));
connect(m_mainUi->titleEdit, SIGNAL(textChanged(QString)), this, SLOT(setUnsavedChanges()));
connect(m_mainUi->usernameEdit, SIGNAL(textChanged(QString)), this, SLOT(setUnsavedChanges()));
connect(m_mainUi->passwordEdit, SIGNAL(textChanged(QString)), this, SLOT(setUnsavedChanges()));
connect(m_mainUi->passwordRepeatEdit, SIGNAL(textChanged(QString)), this, SLOT(setUnsavedChanges()));
connect(m_mainUi->urlEdit, SIGNAL(textChanged(QString)), this, SLOT(setUnsavedChanges()));
connect(m_mainUi->expireCheck, SIGNAL(stateChanged(int)), this, SLOT(setUnsavedChanges()));
connect(m_mainUi->notesEnabled, SIGNAL(stateChanged(int)), this, SLOT(setUnsavedChanges()));
connect(m_mainUi->expireDatePicker, SIGNAL(dateTimeChanged(const QDateTime&)), this, SLOT(setUnsavedChanges()));
connect(m_mainUi->expireDatePicker, SIGNAL(dateTimeChanged(QDateTime)), this, SLOT(setUnsavedChanges()));
connect(m_mainUi->notesEdit, SIGNAL(textChanged()), this, SLOT(setUnsavedChanges()));
// Advanced tab
@ -261,10 +261,10 @@ void EditEntryWidget::setupEntryUpdate()
connect(m_autoTypeUi->customWindowSequenceButton, SIGNAL(stateChanged(int)), this, SLOT(setUnsavedChanges()));
connect(m_autoTypeUi->inheritSequenceButton, SIGNAL(toggled(bool)), this, SLOT(setUnsavedChanges()));
connect(m_autoTypeUi->customSequenceButton, SIGNAL(toggled(bool)), this, SLOT(setUnsavedChanges()));
connect(m_autoTypeUi->windowSequenceEdit, SIGNAL(textChanged(const QString&)), this, SLOT(setUnsavedChanges()));
connect(m_autoTypeUi->sequenceEdit, SIGNAL(textChanged(const QString&)), this, SLOT(setUnsavedChanges()));
connect(m_autoTypeUi->windowSequenceEdit, SIGNAL(textChanged(QString)), this, SLOT(setUnsavedChanges()));
connect(m_autoTypeUi->sequenceEdit, SIGNAL(textChanged(QString)), this, SLOT(setUnsavedChanges()));
connect(m_autoTypeUi->windowTitleCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setUnsavedChanges()));
connect(m_autoTypeUi->windowTitleCombo, SIGNAL(editTextChanged(const QString&)), this, SLOT(setUnsavedChanges()));
connect(m_autoTypeUi->windowTitleCombo, SIGNAL(editTextChanged(QString)), this, SLOT(setUnsavedChanges()));
// Properties and History tabs don't need extra connections
@ -275,8 +275,8 @@ void EditEntryWidget::setupEntryUpdate()
connect(m_sshAgentUi->externalFileRadioButton, SIGNAL(toggled(bool)), this, SLOT(setUnsavedChanges()));
connect(m_sshAgentUi->attachmentComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setUnsavedChanges()));
connect(
m_sshAgentUi->attachmentComboBox, SIGNAL(editTextChanged(const QString&)), this, SLOT(setUnsavedChanges()));
connect(m_sshAgentUi->externalFileEdit, SIGNAL(textChanged(const QString&)), this, SLOT(setUnsavedChanges()));
m_sshAgentUi->attachmentComboBox, SIGNAL(editTextChanged(QString)), this, SLOT(setUnsavedChanges()));
connect(m_sshAgentUi->externalFileEdit, SIGNAL(textChanged(QString)), this, SLOT(setUnsavedChanges()));
connect(m_sshAgentUi->addKeyToAgentCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setUnsavedChanges()));
connect(m_sshAgentUi->removeKeyFromAgentCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setUnsavedChanges()));
connect(
@ -1269,13 +1269,13 @@ QMenu* EditEntryWidget::createPresetsMenu()
QMenu* expirePresetsMenu = new QMenu(this);
expirePresetsMenu->addAction(tr("Tomorrow"))->setData(QVariant::fromValue(TimeDelta::fromDays(1)));
expirePresetsMenu->addSeparator();
expirePresetsMenu->addAction(tr("%n week(s)", 0, 1))->setData(QVariant::fromValue(TimeDelta::fromDays(7)));
expirePresetsMenu->addAction(tr("%n week(s)", 0, 2))->setData(QVariant::fromValue(TimeDelta::fromDays(14)));
expirePresetsMenu->addAction(tr("%n week(s)", 0, 3))->setData(QVariant::fromValue(TimeDelta::fromDays(21)));
expirePresetsMenu->addAction(tr("%n week(s)", nullptr, 1))->setData(QVariant::fromValue(TimeDelta::fromDays(7)));
expirePresetsMenu->addAction(tr("%n week(s)", nullptr, 2))->setData(QVariant::fromValue(TimeDelta::fromDays(14)));
expirePresetsMenu->addAction(tr("%n week(s)", nullptr, 3))->setData(QVariant::fromValue(TimeDelta::fromDays(21)));
expirePresetsMenu->addSeparator();
expirePresetsMenu->addAction(tr("%n month(s)", 0, 1))->setData(QVariant::fromValue(TimeDelta::fromMonths(1)));
expirePresetsMenu->addAction(tr("%n month(s)", 0, 3))->setData(QVariant::fromValue(TimeDelta::fromMonths(3)));
expirePresetsMenu->addAction(tr("%n month(s)", 0, 6))->setData(QVariant::fromValue(TimeDelta::fromMonths(6)));
expirePresetsMenu->addAction(tr("%n month(s)", nullptr, 1))->setData(QVariant::fromValue(TimeDelta::fromMonths(1)));
expirePresetsMenu->addAction(tr("%n month(s)", nullptr, 3))->setData(QVariant::fromValue(TimeDelta::fromMonths(3)));
expirePresetsMenu->addAction(tr("%n month(s)", nullptr, 6))->setData(QVariant::fromValue(TimeDelta::fromMonths(6)));
expirePresetsMenu->addSeparator();
expirePresetsMenu->addAction(tr("%n year(s)", 0, 1))->setData(QVariant::fromValue(TimeDelta::fromYears(1)));
expirePresetsMenu->addAction(tr("%n year(s)", 0, 2))->setData(QVariant::fromValue(TimeDelta::fromYears(2)));
@ -1311,8 +1311,7 @@ void EditEntryWidget::pickColor()
oldColor = QColor(m_advancedUi->bgColorButton->property("color").toString());
}
QColorDialog colorDialog(this);
QColor newColor = colorDialog.getColor(oldColor);
QColor newColor = QColorDialog::getColor(oldColor);
if (newColor.isValid()) {
setupColorButton(isForeground, newColor);
setUnsavedChanges(true);

View File

@ -24,7 +24,7 @@
class AttributesListView : public QListView
{
public:
explicit AttributesListView(QWidget* parent = 0)
explicit AttributesListView(QWidget* parent = nullptr)
: QListView(parent)
{
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);

View File

@ -44,7 +44,7 @@ EntryAttachmentsWidget::EntryAttachmentsWidget(QWidget* parent)
connect(this, SIGNAL(readOnlyChanged(bool)), SLOT(updateButtonsEnabled()));
connect(m_attachmentsModel, SIGNAL(modelReset()), SLOT(updateButtonsEnabled()));
connect(m_ui->attachmentsView->selectionModel(),
SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
SLOT(updateButtonsEnabled()));
connect(m_ui->attachmentsView, SIGNAL(doubleClicked(QModelIndex)), SLOT(openAttachment(QModelIndex)));

View File

@ -47,8 +47,8 @@ void EntryAttributesModel::setEntryAttributes(EntryAttributes* entryAttributes)
connect(m_entryAttributes, SIGNAL(aboutToBeRemoved(QString)), SLOT(attributeAboutToRemove(QString)));
connect(m_entryAttributes, SIGNAL(removed(QString)), SLOT(attributeRemove()));
connect(
m_entryAttributes, SIGNAL(aboutToRename(QString, QString)), SLOT(attributeAboutToRename(QString, QString)));
connect(m_entryAttributes, SIGNAL(renamed(QString, QString)), SLOT(attributeRename(QString, QString)));
m_entryAttributes, SIGNAL(aboutToRename(QString,QString)), SLOT(attributeAboutToRename(QString,QString)));
connect(m_entryAttributes, SIGNAL(renamed(QString,QString)), SLOT(attributeRename(QString,QString)));
connect(m_entryAttributes, SIGNAL(aboutToBeReset()), SLOT(aboutToReset()));
connect(m_entryAttributes, SIGNAL(reset()), SLOT(reset()));
}

View File

@ -54,7 +54,7 @@ QVariant EntryHistoryModel::data(const QModelIndex& index, int role) const
if (role == Qt::DisplayRole || role == Qt::UserRole) {
Entry* entry = entryFromIndex(index);
TimeInfo timeInfo = entry->timeInfo();
const TimeInfo& timeInfo = entry->timeInfo();
QDateTime lastModificationLocalTime = timeInfo.lastModificationTime().toLocalTime();
switch (index.column()) {
case 0:

View File

@ -208,12 +208,12 @@ QVariant EntryModel::data(const QModelIndex& index, int role) const
case Attachments: {
// Display comma-separated list of attachments
QList<QString> attachments = entry->attachments()->keys();
for (int i = 0; i < attachments.size(); ++i) {
for (const auto& attachment : attachments) {
if (result.isEmpty()) {
result.append(attachments.at(i));
result.append(attachment);
continue;
}
result.append(QString(", ") + attachments.at(i));
result.append(QString(", ") + attachment);
}
return result;
}
@ -331,7 +331,7 @@ QVariant EntryModel::headerData(int section, Qt::Orientation orientation, int ro
Qt::DropActions EntryModel::supportedDropActions() const
{
return 0;
return Qt::IgnoreAction;
}
Qt::DropActions EntryModel::supportedDragActions() const

View File

@ -51,7 +51,7 @@ EntryView::EntryView(QWidget* parent)
connect(this, SIGNAL(doubleClicked(QModelIndex)), SLOT(emitEntryActivated(QModelIndex)));
connect(
selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), SIGNAL(entrySelectionChanged()));
selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SIGNAL(entrySelectionChanged()));
connect(m_model, SIGNAL(switchedToListMode()), SLOT(switchToListMode()));
connect(m_model, SIGNAL(switchedToSearchMode()), SLOT(switchToSearchMode()));
connect(m_model, SIGNAL(usernamesHiddenChanged()), SIGNAL(viewStateChanged()));
@ -97,10 +97,10 @@ EntryView::EntryView(QWidget* parent)
header()->setContextMenuPolicy(Qt::CustomContextMenu);
connect(header(), SIGNAL(customContextMenuRequested(QPoint)), SLOT(showHeaderMenu(QPoint)));
connect(header(), SIGNAL(sectionCountChanged(int, int)), SIGNAL(viewStateChanged()));
connect(header(), SIGNAL(sectionMoved(int, int, int)), SIGNAL(viewStateChanged()));
connect(header(), SIGNAL(sectionResized(int, int, int)), SIGNAL(viewStateChanged()));
connect(header(), SIGNAL(sortIndicatorChanged(int, Qt::SortOrder)), SIGNAL(viewStateChanged()));
connect(header(), SIGNAL(sectionCountChanged(int,int)), SIGNAL(viewStateChanged()));
connect(header(), SIGNAL(sectionMoved(int,int,int)), SIGNAL(viewStateChanged()));
connect(header(), SIGNAL(sectionResized(int,int,int)), SIGNAL(viewStateChanged()));
connect(header(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), SIGNAL(viewStateChanged()));
resetFixedColumns();

View File

@ -49,8 +49,8 @@ EditGroupWidget::EditGroupWidget(QWidget* parent)
connect(this, SIGNAL(rejected()), SLOT(cancel()));
connect(m_editGroupWidgetIcons,
SIGNAL(messageEditEntry(QString, MessageWidget::MessageType)),
SLOT(showMessage(QString, MessageWidget::MessageType)));
SIGNAL(messageEditEntry(QString,MessageWidget::MessageType)),
SLOT(showMessage(QString,MessageWidget::MessageType)));
connect(m_editGroupWidgetIcons, SIGNAL(messageEditEntryDismiss()), SLOT(hideMessage()));
}

View File

@ -44,11 +44,11 @@ void GroupModel::changeDatabase(Database* newDb)
m_db = newDb;
connect(m_db, SIGNAL(groupDataChanged(Group*)), SLOT(groupDataChanged(Group*)));
connect(m_db, SIGNAL(groupAboutToAdd(Group*, int)), SLOT(groupAboutToAdd(Group*, int)));
connect(m_db, SIGNAL(groupAboutToAdd(Group*,int)), SLOT(groupAboutToAdd(Group*,int)));
connect(m_db, SIGNAL(groupAdded()), SLOT(groupAdded()));
connect(m_db, SIGNAL(groupAboutToRemove(Group*)), SLOT(groupAboutToRemove(Group*)));
connect(m_db, SIGNAL(groupRemoved()), SLOT(groupRemoved()));
connect(m_db, SIGNAL(groupAboutToMove(Group*, Group*, int)), SLOT(groupAboutToMove(Group*, Group*, int)));
connect(m_db, SIGNAL(groupAboutToMove(Group*,Group*,int)), SLOT(groupAboutToMove(Group*,Group*,int)));
connect(m_db, SIGNAL(groupMoved()), SLOT(groupMoved()));
endResetModel();

View File

@ -36,10 +36,10 @@ GroupView::GroupView(Database* db, QWidget* parent)
connect(this, SIGNAL(expanded(QModelIndex)), this, SLOT(expandedChanged(QModelIndex)));
connect(this, SIGNAL(collapsed(QModelIndex)), this, SLOT(expandedChanged(QModelIndex)));
connect(m_model, SIGNAL(rowsInserted(QModelIndex, int, int)), SLOT(syncExpandedState(QModelIndex, int, int)));
connect(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), SLOT(syncExpandedState(QModelIndex,int,int)));
connect(m_model, SIGNAL(modelReset()), SLOT(modelReset()));
connect(selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), SLOT(emitGroupChanged()));
connect(selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), SLOT(emitGroupChanged()));
connect(this, SIGNAL(clicked(QModelIndex)), SLOT(emitGroupPressed(QModelIndex)));

View File

@ -38,8 +38,8 @@ KeyComponentWidget::KeyComponentWidget(const QString& name, QWidget* parent)
connect(m_ui->stackedWidget, SIGNAL(currentChanged(int)), SLOT(reset()));
connect(this, SIGNAL(nameChanged(const QString&)), SLOT(updateComponentName(const QString&)));
connect(this, SIGNAL(descriptionChanged(const QString&)), SLOT(updateComponentDescription(const QString&)));
connect(this, SIGNAL(nameChanged(QString)), SLOT(updateComponentName(QString)));
connect(this, SIGNAL(descriptionChanged(QString)), SLOT(updateComponentDescription(QString)));
connect(this, SIGNAL(componentAddRequested()), SLOT(doAdd()));
connect(this, SIGNAL(componentEditRequested()), SLOT(doEdit()));
connect(this, SIGNAL(componentRemovalRequested()), SLOT(doRemove()));

View File

@ -107,7 +107,7 @@ void PasswordEditWidget::showPasswordGenerator()
layout->addWidget(pwGenerator);
pwGenerator->setStandaloneMode(false);
connect(pwGenerator, SIGNAL(appliedPassword(const QString&)), SLOT(setPassword(const QString&)));
connect(pwGenerator, SIGNAL(appliedPassword(QString)), SLOT(setPassword(QString)));
connect(pwGenerator, SIGNAL(dialogTerminated()), &pwDialog, SLOT(close()));
pwGenerator->setPasswordVisible(isPasswordVisible());

View File

@ -75,7 +75,7 @@ QWidget* YubiKeyEditWidget::componentEditWidget()
#ifdef WITH_XC_YUBIKEY
connect(m_compUi->buttonRedetectYubikey, SIGNAL(clicked()), SLOT(pollYubikey()));
connect(YubiKey::instance(), SIGNAL(detected(int, bool)), SLOT(yubikeyDetected(int, bool)), Qt::QueuedConnection);
connect(YubiKey::instance(), SIGNAL(detected(int,bool)), SLOT(yubikeyDetected(int,bool)), Qt::QueuedConnection);
connect(YubiKey::instance(), SIGNAL(notFound()), SLOT(noYubikeyFound()), Qt::QueuedConnection);
pollYubikey();

View File

@ -153,7 +153,7 @@ bool CompositeKey::challenge(const QByteArray& seed, QByteArray& result) const
*
* @param key the key
*/
void CompositeKey::addKey(QSharedPointer<Key> key)
void CompositeKey::addKey(const QSharedPointer<Key>& key)
{
m_keys.append(key);
}
@ -173,7 +173,7 @@ const QList<QSharedPointer<Key>>& CompositeKey::keys() const
*
* @param key the key
*/
void CompositeKey::addChallengeResponseKey(QSharedPointer<ChallengeResponseKey> key)
void CompositeKey::addChallengeResponseKey(const QSharedPointer<ChallengeResponseKey>& key)
{
m_challengeResponseKeys.append(key);
}

View File

@ -42,10 +42,10 @@ public:
Q_REQUIRED_RESULT bool transform(const Kdf& kdf, QByteArray& result) const;
bool challenge(const QByteArray& seed, QByteArray& result) const;
void addKey(QSharedPointer<Key> key);
void addKey(const QSharedPointer<Key>& key);
const QList<QSharedPointer<Key>>& keys() const;
void addChallengeResponseKey(QSharedPointer<ChallengeResponseKey> key);\
void addChallengeResponseKey(const QSharedPointer<ChallengeResponseKey>& key);\
const QList<QSharedPointer<ChallengeResponseKey>>& challengeResponseKeys() const;
private:

Some files were not shown because too many files have changed in this diff Show More