mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-03-06 21:26:05 -05:00
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:
commit
82bf00de73
@ -38,7 +38,6 @@ configure_file(version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/version.h @ONLY)
|
|||||||
|
|
||||||
set(keepassx_SOURCES
|
set(keepassx_SOURCES
|
||||||
core/AutoTypeAssociations.cpp
|
core/AutoTypeAssociations.cpp
|
||||||
core/AsyncTask.h
|
|
||||||
core/AutoTypeMatch.cpp
|
core/AutoTypeMatch.cpp
|
||||||
core/Compare.cpp
|
core/Compare.cpp
|
||||||
core/Config.cpp
|
core/Config.cpp
|
||||||
@ -52,18 +51,14 @@ set(keepassx_SOURCES
|
|||||||
core/EntrySearcher.cpp
|
core/EntrySearcher.cpp
|
||||||
core/FilePath.cpp
|
core/FilePath.cpp
|
||||||
core/Bootstrap.cpp
|
core/Bootstrap.cpp
|
||||||
core/Global.h
|
|
||||||
core/Group.cpp
|
core/Group.cpp
|
||||||
core/InactivityTimer.cpp
|
core/InactivityTimer.cpp
|
||||||
core/ListDeleter.h
|
|
||||||
core/Merger.cpp
|
core/Merger.cpp
|
||||||
core/Metadata.cpp
|
core/Metadata.cpp
|
||||||
core/PasswordGenerator.cpp
|
core/PasswordGenerator.cpp
|
||||||
core/PassphraseGenerator.cpp
|
core/PassphraseGenerator.cpp
|
||||||
core/SignalMultiplexer.cpp
|
core/SignalMultiplexer.cpp
|
||||||
core/ScreenLockListener.cpp
|
core/ScreenLockListener.cpp
|
||||||
core/ScreenLockListener.h
|
|
||||||
core/ScreenLockListenerPrivate.h
|
|
||||||
core/ScreenLockListenerPrivate.cpp
|
core/ScreenLockListenerPrivate.cpp
|
||||||
core/TimeDelta.cpp
|
core/TimeDelta.cpp
|
||||||
core/TimeInfo.cpp
|
core/TimeInfo.cpp
|
||||||
@ -77,14 +72,11 @@ set(keepassx_SOURCES
|
|||||||
crypto/CryptoHash.cpp
|
crypto/CryptoHash.cpp
|
||||||
crypto/Random.cpp
|
crypto/Random.cpp
|
||||||
crypto/SymmetricCipher.cpp
|
crypto/SymmetricCipher.cpp
|
||||||
crypto/SymmetricCipherBackend.h
|
|
||||||
crypto/SymmetricCipherGcrypt.cpp
|
crypto/SymmetricCipherGcrypt.cpp
|
||||||
crypto/kdf/Kdf.cpp
|
crypto/kdf/Kdf.cpp
|
||||||
crypto/kdf/Kdf_p.h
|
|
||||||
crypto/kdf/AesKdf.cpp
|
crypto/kdf/AesKdf.cpp
|
||||||
crypto/kdf/Argon2Kdf.cpp
|
crypto/kdf/Argon2Kdf.cpp
|
||||||
format/CsvExporter.cpp
|
format/CsvExporter.cpp
|
||||||
format/KeePass1.h
|
|
||||||
format/KeePass1Reader.cpp
|
format/KeePass1Reader.cpp
|
||||||
format/KeePass2.cpp
|
format/KeePass2.cpp
|
||||||
format/KeePass2RandomStream.cpp
|
format/KeePass2RandomStream.cpp
|
||||||
@ -142,7 +134,6 @@ set(keepassx_SOURCES
|
|||||||
gui/entry/AutoTypeMatchModel.cpp
|
gui/entry/AutoTypeMatchModel.cpp
|
||||||
gui/entry/AutoTypeMatchView.cpp
|
gui/entry/AutoTypeMatchView.cpp
|
||||||
gui/entry/EditEntryWidget.cpp
|
gui/entry/EditEntryWidget.cpp
|
||||||
gui/entry/EditEntryWidget_p.h
|
|
||||||
gui/entry/EntryAttachmentsModel.cpp
|
gui/entry/EntryAttachmentsModel.cpp
|
||||||
gui/entry/EntryAttachmentsWidget.cpp
|
gui/entry/EntryAttachmentsWidget.cpp
|
||||||
gui/entry/EntryAttributesModel.cpp
|
gui/entry/EntryAttributesModel.cpp
|
||||||
@ -168,11 +159,8 @@ set(keepassx_SOURCES
|
|||||||
gui/wizard/NewDatabaseWizardPageMetaData.cpp
|
gui/wizard/NewDatabaseWizardPageMetaData.cpp
|
||||||
gui/wizard/NewDatabaseWizardPageEncryption.cpp
|
gui/wizard/NewDatabaseWizardPageEncryption.cpp
|
||||||
gui/wizard/NewDatabaseWizardPageMasterKey.cpp
|
gui/wizard/NewDatabaseWizardPageMasterKey.cpp
|
||||||
keys/ChallengeResponseKey.h
|
|
||||||
keys/CompositeKey.cpp
|
keys/CompositeKey.cpp
|
||||||
keys/drivers/YubiKey.h
|
|
||||||
keys/FileKey.cpp
|
keys/FileKey.cpp
|
||||||
keys/Key.h
|
|
||||||
keys/PasswordKey.cpp
|
keys/PasswordKey.cpp
|
||||||
keys/YkChallengeResponseKey.cpp
|
keys/YkChallengeResponseKey.cpp
|
||||||
streams/HashedBlockStream.cpp
|
streams/HashedBlockStream.cpp
|
||||||
@ -181,27 +169,22 @@ set(keepassx_SOURCES
|
|||||||
streams/qtiocompressor.cpp
|
streams/qtiocompressor.cpp
|
||||||
streams/StoreDataStream.cpp
|
streams/StoreDataStream.cpp
|
||||||
streams/SymmetricCipherStream.cpp
|
streams/SymmetricCipherStream.cpp
|
||||||
totp/totp.h
|
|
||||||
totp/totp.cpp)
|
totp/totp.cpp)
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
set(keepassx_SOURCES
|
set(keepassx_SOURCES
|
||||||
${keepassx_SOURCES}
|
${keepassx_SOURCES}
|
||||||
core/ScreenLockListenerMac.h
|
|
||||||
core/ScreenLockListenerMac.cpp
|
core/ScreenLockListenerMac.cpp
|
||||||
core/MacPasteboard.h
|
|
||||||
core/MacPasteboard.cpp)
|
core/MacPasteboard.cpp)
|
||||||
endif()
|
endif()
|
||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
set(keepassx_SOURCES
|
set(keepassx_SOURCES
|
||||||
${keepassx_SOURCES}
|
${keepassx_SOURCES}
|
||||||
core/ScreenLockListenerDBus.h
|
|
||||||
core/ScreenLockListenerDBus.cpp
|
core/ScreenLockListenerDBus.cpp
|
||||||
gui/MainWindowAdaptor.cpp)
|
gui/MainWindowAdaptor.cpp)
|
||||||
endif()
|
endif()
|
||||||
if(MINGW)
|
if(MINGW)
|
||||||
set(keepassx_SOURCES
|
set(keepassx_SOURCES
|
||||||
${keepassx_SOURCES}
|
${keepassx_SOURCES}
|
||||||
core/ScreenLockListenerWin.h
|
|
||||||
core/ScreenLockListenerWin.cpp)
|
core/ScreenLockListenerWin.cpp)
|
||||||
endif()
|
endif()
|
||||||
if(MINGW OR (UNIX AND NOT APPLE))
|
if(MINGW OR (UNIX AND NOT APPLE))
|
||||||
@ -243,13 +226,11 @@ set(autotype_SOURCES
|
|||||||
core/Tools.cpp
|
core/Tools.cpp
|
||||||
autotype/AutoType.cpp
|
autotype/AutoType.cpp
|
||||||
autotype/AutoTypeAction.cpp
|
autotype/AutoTypeAction.cpp
|
||||||
autotype/AutoTypePlatformPlugin.h
|
|
||||||
autotype/AutoTypeSelectDialog.cpp
|
autotype/AutoTypeSelectDialog.cpp
|
||||||
autotype/AutoTypeSelectView.cpp
|
autotype/AutoTypeSelectView.cpp
|
||||||
autotype/ShortcutWidget.cpp
|
autotype/ShortcutWidget.cpp
|
||||||
autotype/WildcardMatcher.cpp
|
autotype/WildcardMatcher.cpp
|
||||||
autotype/WindowSelectComboBox.cpp
|
autotype/WindowSelectComboBox.cpp)
|
||||||
autotype/test/AutoTypeTestInterface.h)
|
|
||||||
|
|
||||||
if(MINGW)
|
if(MINGW)
|
||||||
set(keepassx_SOURCES_MAINEXE ${keepassx_SOURCES_MAINEXE} ${CMAKE_SOURCE_DIR}/share/windows/icon.rc)
|
set(keepassx_SOURCES_MAINEXE ${keepassx_SOURCES_MAINEXE} ${CMAKE_SOURCE_DIR}/share/windows/icon.rc)
|
||||||
|
@ -43,7 +43,7 @@ AutoType::AutoType(QObject* parent, bool test)
|
|||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_autoTypeDelay(0)
|
, m_autoTypeDelay(0)
|
||||||
, m_currentGlobalKey(static_cast<Qt::Key>(0))
|
, m_currentGlobalKey(static_cast<Qt::Key>(0))
|
||||||
, m_currentGlobalModifiers(0)
|
, m_currentGlobalModifiers(nullptr)
|
||||||
, m_pluginLoader(new QPluginLoader(this))
|
, m_pluginLoader(new QPluginLoader(this))
|
||||||
, m_plugin(nullptr)
|
, m_plugin(nullptr)
|
||||||
, m_executor(nullptr)
|
, m_executor(nullptr)
|
||||||
@ -731,8 +731,7 @@ bool AutoType::checkHighRepetition(const QString& string)
|
|||||||
bool AutoType::verifyAutoTypeSyntax(const QString& sequence)
|
bool AutoType::verifyAutoTypeSyntax(const QString& sequence)
|
||||||
{
|
{
|
||||||
if (!AutoType::checkSyntax(sequence)) {
|
if (!AutoType::checkSyntax(sequence)) {
|
||||||
QMessageBox messageBox;
|
QMessageBox::critical(nullptr, tr("Auto-Type"), tr("The Syntax of your Auto-Type statement is incorrect!"));
|
||||||
messageBox.critical(nullptr, tr("Auto-Type"), tr("The Syntax of your Auto-Type statement is incorrect!"));
|
|
||||||
return false;
|
return false;
|
||||||
} else if (AutoType::checkHighDelay(sequence)) {
|
} else if (AutoType::checkHighDelay(sequence)) {
|
||||||
QMessageBox::StandardButton reply;
|
QMessageBox::StandardButton reply;
|
||||||
|
@ -87,3 +87,9 @@ void AutoTypeExecutor::execClearField(AutoTypeClearField* action)
|
|||||||
{
|
{
|
||||||
Q_UNUSED(action);
|
Q_UNUSED(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AutoTypeAction::~AutoTypeAction()
|
||||||
|
{
|
||||||
|
// This makes sure that AutoTypeAction's vtable is placed
|
||||||
|
// in this translation unit.
|
||||||
|
}
|
||||||
|
@ -29,19 +29,17 @@ class AutoTypeExecutor;
|
|||||||
class KEEPASSX_EXPORT AutoTypeAction
|
class KEEPASSX_EXPORT AutoTypeAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~AutoTypeAction()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
virtual AutoTypeAction* clone() = 0;
|
virtual AutoTypeAction* clone() = 0;
|
||||||
virtual void accept(AutoTypeExecutor* executor) = 0;
|
virtual void accept(AutoTypeExecutor* executor) = 0;
|
||||||
|
virtual ~AutoTypeAction();
|
||||||
};
|
};
|
||||||
|
|
||||||
class KEEPASSX_EXPORT AutoTypeChar : public AutoTypeAction
|
class KEEPASSX_EXPORT AutoTypeChar : public AutoTypeAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit AutoTypeChar(const QChar& character);
|
explicit AutoTypeChar(const QChar& character);
|
||||||
AutoTypeAction* clone();
|
AutoTypeAction* clone() override;
|
||||||
void accept(AutoTypeExecutor* executor);
|
void accept(AutoTypeExecutor* executor) override;
|
||||||
|
|
||||||
const QChar character;
|
const QChar character;
|
||||||
};
|
};
|
||||||
@ -50,8 +48,8 @@ class KEEPASSX_EXPORT AutoTypeKey : public AutoTypeAction
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit AutoTypeKey(Qt::Key key);
|
explicit AutoTypeKey(Qt::Key key);
|
||||||
AutoTypeAction* clone();
|
AutoTypeAction* clone() override;
|
||||||
void accept(AutoTypeExecutor* executor);
|
void accept(AutoTypeExecutor* executor) override;
|
||||||
|
|
||||||
const Qt::Key key;
|
const Qt::Key key;
|
||||||
};
|
};
|
||||||
@ -60,8 +58,8 @@ class KEEPASSX_EXPORT AutoTypeDelay : public AutoTypeAction
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit AutoTypeDelay(int delayMs);
|
explicit AutoTypeDelay(int delayMs);
|
||||||
AutoTypeAction* clone();
|
AutoTypeAction* clone() override;
|
||||||
void accept(AutoTypeExecutor* executor);
|
void accept(AutoTypeExecutor* executor) override;
|
||||||
|
|
||||||
const int delayMs;
|
const int delayMs;
|
||||||
};
|
};
|
||||||
@ -70,8 +68,8 @@ class KEEPASSX_EXPORT AutoTypeClearField : public AutoTypeAction
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AutoTypeClearField();
|
AutoTypeClearField();
|
||||||
AutoTypeAction* clone();
|
AutoTypeAction* clone() override;
|
||||||
void accept(AutoTypeExecutor* executor);
|
void accept(AutoTypeExecutor* executor) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class KEEPASSX_EXPORT AutoTypeExecutor
|
class KEEPASSX_EXPORT AutoTypeExecutor
|
||||||
|
@ -69,7 +69,7 @@ AutoTypeSelectDialog::AutoTypeSelectDialog(QWidget* parent)
|
|||||||
|
|
||||||
connect(m_view, SIGNAL(activated(QModelIndex)), SLOT(emitMatchActivated(QModelIndex)));
|
connect(m_view, SIGNAL(activated(QModelIndex)), SLOT(emitMatchActivated(QModelIndex)));
|
||||||
connect(m_view, SIGNAL(clicked(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()));
|
connect(m_view, SIGNAL(rejected()), SLOT(reject()));
|
||||||
layout->addWidget(m_view);
|
layout->addWidget(m_view);
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
ShortcutWidget::ShortcutWidget(QWidget* parent)
|
ShortcutWidget::ShortcutWidget(QWidget* parent)
|
||||||
: QLineEdit(parent)
|
: QLineEdit(parent)
|
||||||
, m_key(static_cast<Qt::Key>(0))
|
, m_key(static_cast<Qt::Key>(0))
|
||||||
, m_modifiers(0)
|
, m_modifiers(nullptr)
|
||||||
, m_locked(false)
|
, m_locked(false)
|
||||||
{
|
{
|
||||||
setReadOnly(true);
|
setReadOnly(true);
|
||||||
@ -58,7 +58,7 @@ void ShortcutWidget::setShortcut(Qt::Key key, Qt::KeyboardModifiers modifiers)
|
|||||||
void ShortcutWidget::resetShortcut()
|
void ShortcutWidget::resetShortcut()
|
||||||
{
|
{
|
||||||
m_key = static_cast<Qt::Key>(0);
|
m_key = static_cast<Qt::Key>(0);
|
||||||
m_modifiers = 0;
|
m_modifiers = nullptr;
|
||||||
m_locked = false;
|
m_locked = false;
|
||||||
autoType()->unregisterGlobalShortcut();
|
autoType()->unregisterGlobalShortcut();
|
||||||
}
|
}
|
||||||
|
@ -18,12 +18,13 @@
|
|||||||
#include "WildcardMatcher.h"
|
#include "WildcardMatcher.h"
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
const QChar WildcardMatcher::Wildcard = '*';
|
const QChar WildcardMatcher::Wildcard = '*';
|
||||||
const Qt::CaseSensitivity WildcardMatcher::Sensitivity = Qt::CaseInsensitive;
|
const Qt::CaseSensitivity WildcardMatcher::Sensitivity = Qt::CaseInsensitive;
|
||||||
|
|
||||||
WildcardMatcher::WildcardMatcher(const QString& text)
|
WildcardMatcher::WildcardMatcher(QString text)
|
||||||
: m_text(text)
|
: m_text(std::move(text))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
class WildcardMatcher
|
class WildcardMatcher
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit WildcardMatcher(const QString& text);
|
explicit WildcardMatcher(QString text);
|
||||||
bool match(const QString& pattern);
|
bool match(const QString& pattern);
|
||||||
|
|
||||||
static const QChar Wildcard;
|
static const QChar Wildcard;
|
||||||
|
@ -50,7 +50,7 @@ AutoTypePlatformX11::AutoTypePlatformX11()
|
|||||||
<< "xfce4-panel"; // Xfce 4
|
<< "xfce4-panel"; // Xfce 4
|
||||||
|
|
||||||
m_currentGlobalKey = static_cast<Qt::Key>(0);
|
m_currentGlobalKey = static_cast<Qt::Key>(0);
|
||||||
m_currentGlobalModifiers = 0;
|
m_currentGlobalModifiers = nullptr;
|
||||||
|
|
||||||
m_keysymTable = nullptr;
|
m_keysymTable = nullptr;
|
||||||
m_xkb = 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);
|
XUngrabKey(m_dpy, keycode, nativeModifiers | Mod2Mask | LockMask, m_rootWindow);
|
||||||
|
|
||||||
m_currentGlobalKey = static_cast<Qt::Key>(0);
|
m_currentGlobalKey = static_cast<Qt::Key>(0);
|
||||||
m_currentGlobalModifiers = 0;
|
m_currentGlobalModifiers = nullptr;
|
||||||
m_currentGlobalKeycode = 0;
|
m_currentGlobalKeycode = 0;
|
||||||
m_currentGlobalNativeModifiers = 0;
|
m_currentGlobalNativeModifiers = 0;
|
||||||
}
|
}
|
||||||
@ -496,7 +496,7 @@ void AutoTypePlatformX11::updateKeymap()
|
|||||||
m_xkb = getKeyboard();
|
m_xkb = getKeyboard();
|
||||||
|
|
||||||
XDisplayKeycodes(m_dpy, &m_minKeycode, &m_maxKeycode);
|
XDisplayKeycodes(m_dpy, &m_minKeycode, &m_maxKeycode);
|
||||||
if (m_keysymTable != NULL)
|
if (m_keysymTable != nullptr)
|
||||||
XFree(m_keysymTable);
|
XFree(m_keysymTable);
|
||||||
m_keysymTable = XGetKeyboardMapping(m_dpy, m_minKeycode, m_maxKeycode - m_minKeycode + 1, &m_keysymPerKeycode);
|
m_keysymTable = XGetKeyboardMapping(m_dpy, m_minKeycode, m_maxKeycode - m_minKeycode + 1, &m_keysymPerKeycode);
|
||||||
|
|
||||||
|
@ -468,7 +468,7 @@ QJsonObject BrowserAction::decryptMessage(const QString& message, const QString&
|
|||||||
return getErrorReply(action, ERROR_KEEPASS_CANNOT_DECRYPT_MESSAGE);
|
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);
|
QMutexLocker locker(&m_mutex);
|
||||||
const QByteArray ma = plaintext.toUtf8();
|
const QByteArray ma = plaintext.toUtf8();
|
||||||
@ -496,7 +496,7 @@ QString BrowserAction::encrypt(const QString plaintext, const QString nonce)
|
|||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray BrowserAction::decrypt(const QString encrypted, const QString nonce)
|
QByteArray BrowserAction::decrypt(const QString& encrypted, const QString& nonce)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&m_mutex);
|
QMutexLocker locker(&m_mutex);
|
||||||
const QByteArray ma = base64Decode(encrypted);
|
const QByteArray ma = base64Decode(encrypted);
|
||||||
@ -546,14 +546,14 @@ QJsonObject BrowserAction::getJsonObject(const uchar* pArray, const uint len) co
|
|||||||
return doc.object();
|
return doc.object();
|
||||||
}
|
}
|
||||||
|
|
||||||
QJsonObject BrowserAction::getJsonObject(const QByteArray ba) const
|
QJsonObject BrowserAction::getJsonObject(const QByteArray& ba) const
|
||||||
{
|
{
|
||||||
QJsonParseError err;
|
QJsonParseError err;
|
||||||
QJsonDocument doc(QJsonDocument::fromJson(ba, &err));
|
QJsonDocument doc(QJsonDocument::fromJson(ba, &err));
|
||||||
return doc.object();
|
return doc.object();
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray BrowserAction::base64Decode(const QString str)
|
QByteArray BrowserAction::base64Decode(const QString& str)
|
||||||
{
|
{
|
||||||
return QByteArray::fromBase64(str.toUtf8());
|
return QByteArray::fromBase64(str.toUtf8());
|
||||||
}
|
}
|
||||||
|
@ -73,14 +73,14 @@ private:
|
|||||||
|
|
||||||
QString encryptMessage(const QJsonObject& message, const QString& nonce);
|
QString encryptMessage(const QJsonObject& message, const QString& nonce);
|
||||||
QJsonObject decryptMessage(const QString& message, const QString& nonce, const QString& action = QString());
|
QJsonObject decryptMessage(const QString& message, const QString& nonce, const QString& action = QString());
|
||||||
QString encrypt(const QString plaintext, const QString nonce);
|
QString encrypt(const QString& plaintext, const QString& nonce);
|
||||||
QByteArray decrypt(const QString encrypted, const QString nonce);
|
QByteArray decrypt(const QString& encrypted, const QString& nonce);
|
||||||
|
|
||||||
QString getBase64FromKey(const uchar* array, const uint len);
|
QString getBase64FromKey(const uchar* array, const uint len);
|
||||||
QByteArray getQByteArray(const uchar* array, const uint len) const;
|
QByteArray getQByteArray(const uchar* array, const uint len) const;
|
||||||
QJsonObject getJsonObject(const uchar* pArray, const uint len) const;
|
QJsonObject getJsonObject(const uchar* pArray, const uint len) const;
|
||||||
QJsonObject getJsonObject(const QByteArray ba) const;
|
QJsonObject getJsonObject(const QByteArray& ba) const;
|
||||||
QByteArray base64Decode(const QString str);
|
QByteArray base64Decode(const QString& str);
|
||||||
QString incrementNonce(const QString& nonce);
|
QString incrementNonce(const QString& nonce);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -35,7 +35,7 @@ class BrowserEntryConfig : public QObject
|
|||||||
Q_PROPERTY(QString Realm READ realm WRITE setRealm)
|
Q_PROPERTY(QString Realm READ realm WRITE setRealm)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BrowserEntryConfig(QObject* object = 0);
|
BrowserEntryConfig(QObject* object = nullptr);
|
||||||
|
|
||||||
bool load(const Entry* entry);
|
bool load(const Entry* entry);
|
||||||
void save(Entry* entry);
|
void save(Entry* entry);
|
||||||
|
@ -145,7 +145,7 @@ QString BrowserService::storeKey(const QString& key)
|
|||||||
|
|
||||||
if (thread() != QThread::currentThread()) {
|
if (thread() != QThread::currentThread()) {
|
||||||
QMetaObject::invokeMethod(
|
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;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,11 +213,11 @@ QJsonArray BrowserService::findMatchingEntries(const QString& id,
|
|||||||
"findMatchingEntries",
|
"findMatchingEntries",
|
||||||
Qt::BlockingQueuedConnection,
|
Qt::BlockingQueuedConnection,
|
||||||
Q_RETURN_ARG(QJsonArray, result),
|
Q_RETURN_ARG(QJsonArray, result),
|
||||||
Q_ARG(const QString&, id),
|
Q_ARG(QString, id),
|
||||||
Q_ARG(const QString&, url),
|
Q_ARG(QString, url),
|
||||||
Q_ARG(const QString&, submitUrl),
|
Q_ARG(QString, submitUrl),
|
||||||
Q_ARG(const QString&, realm),
|
Q_ARG(QString, realm),
|
||||||
Q_ARG(const StringPairList&, keyList));
|
Q_ARG(StringPairList, keyList));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,12 +279,12 @@ void BrowserService::addEntry(const QString& id,
|
|||||||
QMetaObject::invokeMethod(this,
|
QMetaObject::invokeMethod(this,
|
||||||
"addEntry",
|
"addEntry",
|
||||||
Qt::BlockingQueuedConnection,
|
Qt::BlockingQueuedConnection,
|
||||||
Q_ARG(const QString&, id),
|
Q_ARG(QString, id),
|
||||||
Q_ARG(const QString&, login),
|
Q_ARG(QString, login),
|
||||||
Q_ARG(const QString&, password),
|
Q_ARG(QString, password),
|
||||||
Q_ARG(const QString&, url),
|
Q_ARG(QString, url),
|
||||||
Q_ARG(const QString&, submitUrl),
|
Q_ARG(QString, submitUrl),
|
||||||
Q_ARG(const QString&, realm),
|
Q_ARG(QString, realm),
|
||||||
Q_ARG(Database*, selectedDb));
|
Q_ARG(Database*, selectedDb));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,12 +332,12 @@ void BrowserService::updateEntry(const QString& id,
|
|||||||
QMetaObject::invokeMethod(this,
|
QMetaObject::invokeMethod(this,
|
||||||
"updateEntry",
|
"updateEntry",
|
||||||
Qt::BlockingQueuedConnection,
|
Qt::BlockingQueuedConnection,
|
||||||
Q_ARG(const QString&, id),
|
Q_ARG(QString, id),
|
||||||
Q_ARG(const QString&, uuid),
|
Q_ARG(QString, uuid),
|
||||||
Q_ARG(const QString&, login),
|
Q_ARG(QString, login),
|
||||||
Q_ARG(const QString&, password),
|
Q_ARG(QString, password),
|
||||||
Q_ARG(const QString&, url),
|
Q_ARG(QString, url),
|
||||||
Q_ARG(const QString&, submitUrl));
|
Q_ARG(QString, submitUrl));
|
||||||
}
|
}
|
||||||
|
|
||||||
Database* db = selectedDatabase();
|
Database* db = selectedDatabase();
|
||||||
@ -362,7 +362,7 @@ void BrowserService::updateEntry(const QString& id,
|
|||||||
if (!browserSettings()->alwaysAllowUpdate()) {
|
if (!browserSettings()->alwaysAllowUpdate()) {
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
msgBox.setWindowTitle(tr("KeePassXC: Update Entry"));
|
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.setStandardButtons(QMessageBox::Yes);
|
||||||
msgBox.addButton(QMessageBox::No);
|
msgBox.addButton(QMessageBox::No);
|
||||||
msgBox.setDefaultButton(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 (DatabaseWidget* dbWidget = qobject_cast<DatabaseWidget*>(m_dbTabWidget->widget(i))) {
|
||||||
if (Database* db = dbWidget->database()) {
|
if (Database* db = dbWidget->database()) {
|
||||||
// Check if database is connected with KeePassXC-Browser
|
// 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);
|
QString key = db->metadata()->customData()->value(QLatin1String(ASSOCIATE_KEY_PREFIX) + keyPair.first);
|
||||||
if (!key.isEmpty() && keyPair.second == key) {
|
if (!key.isEmpty() && keyPair.second == key) {
|
||||||
databases << db;
|
databases << db;
|
||||||
@ -481,16 +481,16 @@ void BrowserService::convertAttributesToCustomData(Database *currentDb)
|
|||||||
progress.reset();
|
progress.reset();
|
||||||
|
|
||||||
if (counter > 0) {
|
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"
|
tr("Successfully converted attributes from %1 entry(s).\n"
|
||||||
"Moved %2 keys to custom data.", "").arg(counter).arg(keyCounter),
|
"Moved %2 keys to custom data.", "").arg(counter).arg(keyCounter),
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
} else if (counter == 0 && keyCounter > 0) {
|
} 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),
|
tr("Successfully moved %n keys to custom data.", "", keyCounter),
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
} else {
|
} 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."),
|
tr("The active database does not contain an entry with KeePassHTTP attributes."),
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ QString BrowserSettings::customProxyLocation()
|
|||||||
return config()->get("Browser/CustomProxyLocation", "").toString();
|
return config()->get("Browser/CustomProxyLocation", "").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserSettings::setCustomProxyLocation(QString location)
|
void BrowserSettings::setCustomProxyLocation(const QString& location)
|
||||||
{
|
{
|
||||||
config()->set("Browser/CustomProxyLocation", location);
|
config()->set("Browser/CustomProxyLocation", location);
|
||||||
}
|
}
|
||||||
@ -364,7 +364,7 @@ QString BrowserSettings::passwordExcludedChars()
|
|||||||
return config()->get("generator/ExcludedChars", PasswordGenerator::DefaultExcludedChars).toString();
|
return config()->get("generator/ExcludedChars", PasswordGenerator::DefaultExcludedChars).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserSettings::setPasswordExcludedChars(QString chars)
|
void BrowserSettings::setPasswordExcludedChars(const QString& chars)
|
||||||
{
|
{
|
||||||
config()->set("generator/ExcludedChars", chars);
|
config()->set("generator/ExcludedChars", chars);
|
||||||
}
|
}
|
||||||
@ -384,7 +384,7 @@ QString BrowserSettings::passPhraseWordSeparator()
|
|||||||
return config()->get("generator/WordSeparator", PassphraseGenerator::DefaultSeparator).toString();
|
return config()->get("generator/WordSeparator", PassphraseGenerator::DefaultSeparator).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserSettings::setPassPhraseWordSeparator(QString separator)
|
void BrowserSettings::setPassPhraseWordSeparator(const QString& separator)
|
||||||
{
|
{
|
||||||
config()->set("generator/WordSeparator", 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();
|
bool isProxy = supportBrowserProxy();
|
||||||
m_hostInstaller.updateBinaryPaths(isProxy, customProxyLocation);
|
m_hostInstaller.updateBinaryPaths(isProxy, customProxyLocation);
|
||||||
|
@ -59,7 +59,7 @@ public:
|
|||||||
bool useCustomProxy();
|
bool useCustomProxy();
|
||||||
void setUseCustomProxy(bool enabled);
|
void setUseCustomProxy(bool enabled);
|
||||||
QString customProxyLocation();
|
QString customProxyLocation();
|
||||||
void setCustomProxyLocation(QString location);
|
void setCustomProxyLocation(const QString& location);
|
||||||
bool updateBinaryPath();
|
bool updateBinaryPath();
|
||||||
void setUpdateBinaryPath(bool enabled);
|
void setUpdateBinaryPath(bool enabled);
|
||||||
bool chromeSupport();
|
bool chromeSupport();
|
||||||
@ -98,11 +98,11 @@ public:
|
|||||||
bool advancedMode();
|
bool advancedMode();
|
||||||
void setAdvancedMode(bool advancedMode);
|
void setAdvancedMode(bool advancedMode);
|
||||||
QString passwordExcludedChars();
|
QString passwordExcludedChars();
|
||||||
void setPasswordExcludedChars(QString chars);
|
void setPasswordExcludedChars(const QString& chars);
|
||||||
int passPhraseWordCount();
|
int passPhraseWordCount();
|
||||||
void setPassPhraseWordCount(int wordCount);
|
void setPassPhraseWordCount(int wordCount);
|
||||||
QString passPhraseWordSeparator();
|
QString passPhraseWordSeparator();
|
||||||
void setPassPhraseWordSeparator(QString separator);
|
void setPassPhraseWordSeparator(const QString& separator);
|
||||||
int generatorType();
|
int generatorType();
|
||||||
void setGeneratorType(int type);
|
void setGeneratorType(int type);
|
||||||
bool passwordEveryGroup();
|
bool passwordEveryGroup();
|
||||||
@ -114,7 +114,7 @@ public:
|
|||||||
PasswordGenerator::CharClasses passwordCharClasses();
|
PasswordGenerator::CharClasses passwordCharClasses();
|
||||||
PasswordGenerator::GeneratorFlags passwordGeneratorFlags();
|
PasswordGenerator::GeneratorFlags passwordGeneratorFlags();
|
||||||
QString generatePassword();
|
QString generatePassword();
|
||||||
void updateBinaryPaths(QString customProxyLocation = QString());
|
void updateBinaryPaths(const QString& customProxyLocation = QString());
|
||||||
bool checkIfProxyExists(QString& path);
|
bool checkIfProxyExists(QString& path);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -111,7 +111,7 @@ void HostInstaller::installBrowser(SupportedBrowsers browser,
|
|||||||
// Always create the script file
|
// Always create the script file
|
||||||
QJsonObject script = constructFile(browser, proxy, location);
|
QJsonObject script = constructFile(browser, proxy, location);
|
||||||
if (!saveFile(browser, script)) {
|
if (!saveFile(browser, script)) {
|
||||||
QMessageBox::critical(0,
|
QMessageBox::critical(nullptr,
|
||||||
tr("KeePassXC: Cannot save file!"),
|
tr("KeePassXC: Cannot save file!"),
|
||||||
tr("Cannot save the native messaging script file."),
|
tr("Cannot save the native messaging script file."),
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
|
@ -31,7 +31,7 @@ class NativeMessagingHost : public NativeMessagingBase
|
|||||||
typedef QList<QLocalSocket*> SocketList;
|
typedef QList<QLocalSocket*> SocketList;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit NativeMessagingHost(DatabaseTabWidget* parent = 0, const bool enabled = false);
|
explicit NativeMessagingHost(DatabaseTabWidget* parent = nullptr, const bool enabled = false);
|
||||||
~NativeMessagingHost();
|
~NativeMessagingHost();
|
||||||
int init();
|
int init();
|
||||||
void run();
|
void run();
|
||||||
@ -41,8 +41,8 @@ signals:
|
|||||||
void quit();
|
void quit();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void readLength();
|
void readLength() override;
|
||||||
bool readStdIn(const quint32 length);
|
bool readStdIn(const quint32 length) override;
|
||||||
void sendReplyToAllClients(const QJsonObject& json);
|
void sendReplyToAllClients(const QJsonObject& json);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -25,7 +25,7 @@ class Add : public Command
|
|||||||
public:
|
public:
|
||||||
Add();
|
Add();
|
||||||
~Add();
|
~Add();
|
||||||
int execute(const QStringList& arguments);
|
int execute(const QStringList& arguments) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KEEPASSXC_ADD_H
|
#endif // KEEPASSXC_ADD_H
|
||||||
|
@ -15,31 +15,18 @@
|
|||||||
|
|
||||||
set(cli_SOURCES
|
set(cli_SOURCES
|
||||||
Add.cpp
|
Add.cpp
|
||||||
Add.h
|
|
||||||
Clip.cpp
|
Clip.cpp
|
||||||
Clip.h
|
|
||||||
Command.cpp
|
Command.cpp
|
||||||
Command.h
|
|
||||||
Diceware.cpp
|
Diceware.cpp
|
||||||
Diceware.h
|
|
||||||
Edit.cpp
|
Edit.cpp
|
||||||
Edit.h
|
|
||||||
Estimate.cpp
|
Estimate.cpp
|
||||||
Estimate.h
|
|
||||||
Extract.cpp
|
Extract.cpp
|
||||||
Extract.h
|
|
||||||
Generate.cpp
|
Generate.cpp
|
||||||
Generate.h
|
|
||||||
List.cpp
|
List.cpp
|
||||||
List.h
|
|
||||||
Locate.cpp
|
Locate.cpp
|
||||||
Locate.h
|
|
||||||
Merge.cpp
|
Merge.cpp
|
||||||
Merge.h
|
|
||||||
Remove.cpp
|
Remove.cpp
|
||||||
Remove.h
|
Show.cpp)
|
||||||
Show.cpp
|
|
||||||
Show.h)
|
|
||||||
|
|
||||||
add_library(cli STATIC ${cli_SOURCES})
|
add_library(cli STATIC ${cli_SOURCES})
|
||||||
target_link_libraries(cli Qt5::Core Qt5::Widgets)
|
target_link_libraries(cli Qt5::Core Qt5::Widgets)
|
||||||
|
@ -71,7 +71,7 @@ int Clip::execute(const QStringList& arguments)
|
|||||||
return clipEntry(db, args.at(1), args.value(2));
|
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);
|
TextStream err(Utils::STDERR);
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@ class Clip : public Command
|
|||||||
public:
|
public:
|
||||||
Clip();
|
Clip();
|
||||||
~Clip();
|
~Clip();
|
||||||
int execute(const QStringList& arguments);
|
int execute(const QStringList& arguments) override;
|
||||||
int clipEntry(Database* database, QString entryPath, QString timeout);
|
int clipEntry(Database* database, const QString& entryPath, const QString& timeout);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KEEPASSXC_CLIP_H
|
#endif // KEEPASSXC_CLIP_H
|
||||||
|
@ -71,7 +71,7 @@ void populateCommands()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Command* Command::getCommand(QString commandName)
|
Command* Command::getCommand(const QString& commandName)
|
||||||
{
|
{
|
||||||
populateCommands();
|
populateCommands();
|
||||||
if (commands.contains(commandName)) {
|
if (commands.contains(commandName)) {
|
||||||
|
@ -35,7 +35,7 @@ public:
|
|||||||
QString getDescriptionLine();
|
QString getDescriptionLine();
|
||||||
|
|
||||||
static QList<Command*> getCommands();
|
static QList<Command*> getCommands();
|
||||||
static Command* getCommand(QString commandName);
|
static Command* getCommand(const QString& commandName);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KEEPASSXC_COMMAND_H
|
#endif // KEEPASSXC_COMMAND_H
|
||||||
|
@ -25,7 +25,7 @@ class Diceware : public Command
|
|||||||
public:
|
public:
|
||||||
Diceware();
|
Diceware();
|
||||||
~Diceware();
|
~Diceware();
|
||||||
int execute(const QStringList& arguments);
|
int execute(const QStringList& arguments) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KEEPASSXC_DICEWARE_H
|
#endif // KEEPASSXC_DICEWARE_H
|
||||||
|
@ -25,7 +25,7 @@ class Edit : public Command
|
|||||||
public:
|
public:
|
||||||
Edit();
|
Edit();
|
||||||
~Edit();
|
~Edit();
|
||||||
int execute(const QStringList& arguments);
|
int execute(const QStringList& arguments) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KEEPASSXC_EDIT_H
|
#endif // KEEPASSXC_EDIT_H
|
||||||
|
@ -25,7 +25,7 @@ class Estimate : public Command
|
|||||||
public:
|
public:
|
||||||
Estimate();
|
Estimate();
|
||||||
~Estimate();
|
~Estimate();
|
||||||
int execute(const QStringList& arguments);
|
int execute(const QStringList& arguments) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KEEPASSXC_ESTIMATE_H
|
#endif // KEEPASSXC_ESTIMATE_H
|
||||||
|
@ -77,7 +77,7 @@ int Extract::execute(const QStringList& arguments)
|
|||||||
auto fileKey = QSharedPointer<FileKey>::create();
|
auto fileKey = QSharedPointer<FileKey>::create();
|
||||||
QString errorMsg;
|
QString errorMsg;
|
||||||
if (!fileKey->load(keyFilePath, &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;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class Extract : public Command
|
|||||||
public:
|
public:
|
||||||
Extract();
|
Extract();
|
||||||
~Extract();
|
~Extract();
|
||||||
int execute(const QStringList& arguments);
|
int execute(const QStringList& arguments) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KEEPASSXC_EXTRACT_H
|
#endif // KEEPASSXC_EXTRACT_H
|
||||||
|
@ -25,7 +25,7 @@ class Generate : public Command
|
|||||||
public:
|
public:
|
||||||
Generate();
|
Generate();
|
||||||
~Generate();
|
~Generate();
|
||||||
int execute(const QStringList& arguments);
|
int execute(const QStringList& arguments) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KEEPASSXC_GENERATE_H
|
#endif // KEEPASSXC_GENERATE_H
|
||||||
|
@ -25,7 +25,7 @@ class List : public Command
|
|||||||
public:
|
public:
|
||||||
List();
|
List();
|
||||||
~List();
|
~List();
|
||||||
int execute(const QStringList& arguments);
|
int execute(const QStringList& arguments) override;
|
||||||
int listGroup(Database* database, bool recursive, const QString& groupPath = {});
|
int listGroup(Database* database, bool recursive, const QString& groupPath = {});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class Locate : public Command
|
|||||||
public:
|
public:
|
||||||
Locate();
|
Locate();
|
||||||
~Locate();
|
~Locate();
|
||||||
int execute(const QStringList& arguments);
|
int execute(const QStringList& arguments) override;
|
||||||
int locateEntry(Database* database, const QString& searchTerm);
|
int locateEntry(Database* database, const QString& searchTerm);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class Merge : public Command
|
|||||||
public:
|
public:
|
||||||
Merge();
|
Merge();
|
||||||
~Merge();
|
~Merge();
|
||||||
int execute(const QStringList& arguments);
|
int execute(const QStringList& arguments) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KEEPASSXC_MERGE_H
|
#endif // KEEPASSXC_MERGE_H
|
||||||
|
@ -27,7 +27,7 @@ class Remove : public Command
|
|||||||
public:
|
public:
|
||||||
Remove();
|
Remove();
|
||||||
~Remove();
|
~Remove();
|
||||||
int execute(const QStringList& arguments);
|
int execute(const QStringList& arguments) override;
|
||||||
int removeEntry(Database* database, const QString& databasePath, const QString& entryPath);
|
int removeEntry(Database* database, const QString& databasePath, const QString& entryPath);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class Show : public Command
|
|||||||
public:
|
public:
|
||||||
Show();
|
Show();
|
||||||
~Show();
|
~Show();
|
||||||
int execute(const QStringList& arguments);
|
int execute(const QStringList& arguments) override;
|
||||||
int showEntry(Database* database, QStringList attributes, const QString& entryPath);
|
int showEntry(Database* database, QStringList attributes, const QString& entryPath);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
#include "AutoTypeMatch.h"
|
#include "AutoTypeMatch.h"
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
AutoTypeMatch::AutoTypeMatch()
|
AutoTypeMatch::AutoTypeMatch()
|
||||||
: entry(nullptr)
|
: entry(nullptr)
|
||||||
, sequence()
|
, sequence()
|
||||||
@ -26,7 +28,7 @@ AutoTypeMatch::AutoTypeMatch()
|
|||||||
|
|
||||||
AutoTypeMatch::AutoTypeMatch(Entry* entry, QString sequence)
|
AutoTypeMatch::AutoTypeMatch(Entry* entry, QString sequence)
|
||||||
: entry(entry)
|
: entry(entry)
|
||||||
, sequence(sequence)
|
, sequence(std::move(sequence))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2016 Enrico Mariotti <enricomariotti@yahoo.it>
|
* Copyright (C) 2016 Enrico Mariotti <enricomariotti@yahoo.it>
|
||||||
* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
|
* Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
|
||||||
*
|
*
|
||||||
@ -327,7 +327,7 @@ bool CsvParser::isText(QChar c) const
|
|||||||
return !((isCRLF(c)) || (isSeparator(c)));
|
return !((isCRLF(c)) || (isSeparator(c)));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CsvParser::isEmptyRow(CsvRow row) const
|
bool CsvParser::isEmptyRow(const CsvRow& row) const
|
||||||
{
|
{
|
||||||
CsvRow::const_iterator it = row.constBegin();
|
CsvRow::const_iterator it = row.constBegin();
|
||||||
for (; it != row.constEnd(); ++it)
|
for (; it != row.constEnd(); ++it)
|
||||||
@ -414,7 +414,7 @@ int CsvParser::getCsvRows() const
|
|||||||
return m_table.size();
|
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_statusMsg += QObject::tr("%1: (row, col) %2,%3").arg(s, m_currRow, m_currCol).append("\n");
|
||||||
m_isGood = !isCritical;
|
m_isGood = !isCritical;
|
||||||
|
@ -83,7 +83,7 @@ private:
|
|||||||
bool isCRLF(const QChar& c) const;
|
bool isCRLF(const QChar& c) const;
|
||||||
bool isSpace(const QChar& c) const;
|
bool isSpace(const QChar& c) const;
|
||||||
bool isTab(const QChar& c) const;
|
bool isTab(const QChar& c) const;
|
||||||
bool isEmptyRow(CsvRow row) const;
|
bool isEmptyRow(const CsvRow& row) const;
|
||||||
bool parseFile();
|
bool parseFile();
|
||||||
void parseRecord();
|
void parseRecord();
|
||||||
void parseField(CsvRow& row);
|
void parseField(CsvRow& row);
|
||||||
@ -96,7 +96,7 @@ private:
|
|||||||
void clear();
|
void clear();
|
||||||
bool skipEndline();
|
bool skipEndline();
|
||||||
void skipLine();
|
void skipLine();
|
||||||
void appendStatusMsg(QString s, bool isCritical = false);
|
void appendStatusMsg(const QString& s, bool isCritical = false);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CSVPARSER_H
|
#endif // CSVPARSER_H
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QXmlStreamReader>
|
#include <QXmlStreamReader>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "cli/Utils.h"
|
#include "cli/Utils.h"
|
||||||
#include "core/Clock.h"
|
#include "core/Clock.h"
|
||||||
@ -315,7 +316,7 @@ void Database::setCompressionAlgo(Database::CompressionAlgorithm algo)
|
|||||||
* @param updateTransformSalt true to update the transform salt
|
* @param updateTransformSalt true to update the transform salt
|
||||||
* @return true on success
|
* @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) {
|
if (!key) {
|
||||||
m_data.key.reset();
|
m_data.key.reset();
|
||||||
@ -354,7 +355,7 @@ bool Database::hasKey() const
|
|||||||
return m_data.hasKey;
|
return m_data.hasKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Database::verifyKey(QSharedPointer<CompositeKey> key) const
|
bool Database::verifyKey(const QSharedPointer<CompositeKey>& key) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(hasKey());
|
Q_ASSERT(hasKey());
|
||||||
|
|
||||||
@ -492,7 +493,7 @@ Database* Database::openDatabaseFile(const QString& fileName, QSharedPointer<con
|
|||||||
}
|
}
|
||||||
|
|
||||||
KeePass2Reader reader;
|
KeePass2Reader reader;
|
||||||
Database* db = reader.readDatabase(&dbFile, key);
|
Database* db = reader.readDatabase(&dbFile, std::move(key));
|
||||||
if (reader.hasError()) {
|
if (reader.hasError()) {
|
||||||
qCritical("Error while parsing the database: %s", qPrintable(reader.errorString()));
|
qCritical("Error while parsing the database: %s", qPrintable(reader.errorString()));
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -501,7 +502,7 @@ Database* Database::openDatabaseFile(const QString& fileName, QSharedPointer<con
|
|||||||
return db;
|
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();
|
auto compositeKey = QSharedPointer<CompositeKey>::create();
|
||||||
QTextStream out(outputDescriptor);
|
QTextStream out(outputDescriptor);
|
||||||
@ -553,7 +554,7 @@ Database* Database::unlockFromStdin(QString databaseFilename, QString keyFilenam
|
|||||||
* @param backup Backup the existing database file, if exists
|
* @param backup Backup the existing database file, if exists
|
||||||
* @return error string, if any
|
* @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;
|
QString error;
|
||||||
if (atomic) {
|
if (atomic) {
|
||||||
@ -633,7 +634,7 @@ QString Database::writeDatabase(QIODevice* device)
|
|||||||
* @param filePath Path to the file to backup
|
* @param filePath Path to the file to backup
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
bool Database::backupDatabase(QString filePath)
|
bool Database::backupDatabase(const QString& filePath)
|
||||||
{
|
{
|
||||||
QString backupFilePath = filePath;
|
QString backupFilePath = filePath;
|
||||||
auto re = QRegularExpression("\\.kdbx$|(?<!\\.kdbx)$", QRegularExpression::CaseInsensitiveOption);
|
auto re = QRegularExpression("\\.kdbx$|(?<!\\.kdbx)$", QRegularExpression::CaseInsensitiveOption);
|
||||||
@ -652,7 +653,7 @@ void Database::setKdf(QSharedPointer<Kdf> kdf)
|
|||||||
m_data.kdf = std::move(kdf);
|
m_data.kdf = std::move(kdf);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Database::changeKdf(QSharedPointer<Kdf> kdf)
|
bool Database::changeKdf(const QSharedPointer<Kdf>& kdf)
|
||||||
{
|
{
|
||||||
kdf->randomizeSeed();
|
kdf->randomizeSeed();
|
||||||
QByteArray transformedMasterKey;
|
QByteArray transformedMasterKey;
|
||||||
|
@ -110,9 +110,9 @@ public:
|
|||||||
void setCipher(const QUuid& cipher);
|
void setCipher(const QUuid& cipher);
|
||||||
void setCompressionAlgo(Database::CompressionAlgorithm algo);
|
void setCompressionAlgo(Database::CompressionAlgorithm algo);
|
||||||
void setKdf(QSharedPointer<Kdf> kdf);
|
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 hasKey() const;
|
||||||
bool verifyKey(QSharedPointer<CompositeKey> key) const;
|
bool verifyKey(const QSharedPointer<CompositeKey>& key) const;
|
||||||
QVariantMap& publicCustomData();
|
QVariantMap& publicCustomData();
|
||||||
const QVariantMap& publicCustomData() const;
|
const QVariantMap& publicCustomData() const;
|
||||||
void setPublicCustomData(const QVariantMap& customData);
|
void setPublicCustomData(const QVariantMap& customData);
|
||||||
@ -121,17 +121,17 @@ public:
|
|||||||
void emptyRecycleBin();
|
void emptyRecycleBin();
|
||||||
void setEmitModified(bool value);
|
void setEmitModified(bool value);
|
||||||
void markAsModified();
|
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.
|
* Returns a unique id that is only valid as long as the Database exists.
|
||||||
*/
|
*/
|
||||||
const QUuid& uuid();
|
const QUuid& uuid();
|
||||||
bool changeKdf(QSharedPointer<Kdf> kdf);
|
bool changeKdf(const QSharedPointer<Kdf>& kdf);
|
||||||
|
|
||||||
static Database* databaseByUuid(const QUuid& uuid);
|
static Database* databaseByUuid(const QUuid& uuid);
|
||||||
static Database* openDatabaseFile(const QString& fileName, QSharedPointer<const CompositeKey> key);
|
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);
|
FILE* outputDescriptor = stdout, FILE* errorDescriptor = stderr);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@ -156,7 +156,7 @@ private:
|
|||||||
|
|
||||||
void createRecycleBin();
|
void createRecycleBin();
|
||||||
QString writeDatabase(QIODevice* device);
|
QString writeDatabase(QIODevice* device);
|
||||||
bool backupDatabase(QString filePath);
|
bool backupDatabase(const QString& filePath);
|
||||||
|
|
||||||
Metadata* const m_metadata;
|
Metadata* const m_metadata;
|
||||||
Group* m_rootGroup;
|
Group* m_rootGroup;
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
const int Entry::DefaultIconNumber = 0;
|
const int Entry::DefaultIconNumber = 0;
|
||||||
const int Entry::ResolveMaximumDepth = 10;
|
const int Entry::ResolveMaximumDepth = 10;
|
||||||
@ -367,7 +368,7 @@ QString Entry::totp() const
|
|||||||
void Entry::setTotp(QSharedPointer<Totp::Settings> settings)
|
void Entry::setTotp(QSharedPointer<Totp::Settings> settings)
|
||||||
{
|
{
|
||||||
beginUpdate();
|
beginUpdate();
|
||||||
m_data.totpSettings = settings;
|
m_data.totpSettings = std::move(settings);
|
||||||
|
|
||||||
auto text = Totp::writeSettings(m_data.totpSettings, title(), username());
|
auto text = Totp::writeSettings(m_data.totpSettings, title(), username());
|
||||||
if (m_attributes->hasKey(Totp::ATTRIBUTE_OTP)) {
|
if (m_attributes->hasKey(Totp::ATTRIBUTE_OTP)) {
|
||||||
|
@ -34,12 +34,12 @@ EntrySearcher::searchEntries(const QString& searchTerm, const Group* group, Qt::
|
|||||||
{
|
{
|
||||||
QList<Entry*> searchResult;
|
QList<Entry*> searchResult;
|
||||||
|
|
||||||
const QList<Entry*> entryList = group->entries();
|
const QList<Entry*>& entryList = group->entries();
|
||||||
for (Entry* entry : entryList) {
|
for (Entry* entry : entryList) {
|
||||||
searchResult.append(matchEntry(searchTerm, entry, caseSensitivity));
|
searchResult.append(matchEntry(searchTerm, entry, caseSensitivity));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QList<Group*> children = group->children();
|
const QList<Group*>& children = group->children();
|
||||||
for (Group* childGroup : children) {
|
for (Group* childGroup : children) {
|
||||||
if (childGroup->searchingEnabled() != Group::Disable) {
|
if (childGroup->searchingEnabled() != Group::Disable) {
|
||||||
if (matchGroup(searchTerm, childGroup, caseSensitivity)) {
|
if (matchGroup(searchTerm, childGroup, caseSensitivity)) {
|
||||||
|
@ -563,7 +563,7 @@ Entry* Group::findEntryByUuid(const QUuid& uuid) const
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Entry* Group::findEntryByPath(QString entryPath)
|
Entry* Group::findEntryByPath(const QString& entryPath)
|
||||||
{
|
{
|
||||||
if (entryPath.isEmpty()) {
|
if (entryPath.isEmpty()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -578,7 +578,7 @@ Entry* Group::findEntryByPath(QString entryPath)
|
|||||||
return findEntryByPathRecursive(normalizedEntryPath, "/");
|
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
|
// Return the first entry that matches the full path OR if there is no leading
|
||||||
// slash, return the first entry title that matches
|
// slash, return the first entry title that matches
|
||||||
@ -599,7 +599,7 @@ Entry* Group::findEntryByPathRecursive(QString entryPath, QString basePath)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Group* Group::findGroupByPath(QString groupPath)
|
Group* Group::findGroupByPath(const QString& groupPath)
|
||||||
{
|
{
|
||||||
// normalize the groupPath by adding missing front and rear slashes. once.
|
// normalize the groupPath by adding missing front and rear slashes. once.
|
||||||
QString normalizedGroupPath;
|
QString normalizedGroupPath;
|
||||||
@ -614,7 +614,7 @@ Group* Group::findGroupByPath(QString groupPath)
|
|||||||
return findGroupByPathRecursive(normalizedGroupPath, "/");
|
return findGroupByPathRecursive(normalizedGroupPath, "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
Group* Group::findGroupByPathRecursive(QString groupPath, QString basePath)
|
Group* Group::findGroupByPathRecursive(const QString& groupPath, const QString& basePath)
|
||||||
{
|
{
|
||||||
// paths must be normalized
|
// paths must be normalized
|
||||||
Q_ASSERT(groupPath.startsWith("/") && groupPath.endsWith("/"));
|
Q_ASSERT(groupPath.startsWith("/") && groupPath.endsWith("/"));
|
||||||
@ -811,7 +811,7 @@ void Group::removeEntry(Entry* entry)
|
|||||||
{
|
{
|
||||||
Q_ASSERT_X(m_entries.contains(entry),
|
Q_ASSERT_X(m_entries.contains(entry),
|
||||||
Q_FUNC_INFO,
|
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);
|
emit entryAboutToRemove(entry);
|
||||||
|
|
||||||
@ -850,9 +850,9 @@ void Group::recSetDatabase(Database* db)
|
|||||||
connect(this, SIGNAL(dataChanged(Group*)), db, SIGNAL(groupDataChanged(Group*)));
|
connect(this, SIGNAL(dataChanged(Group*)), db, SIGNAL(groupDataChanged(Group*)));
|
||||||
connect(this, SIGNAL(aboutToRemove(Group*)), db, SIGNAL(groupAboutToRemove(Group*)));
|
connect(this, SIGNAL(aboutToRemove(Group*)), db, SIGNAL(groupAboutToRemove(Group*)));
|
||||||
connect(this, SIGNAL(removed()), db, SIGNAL(groupRemoved()));
|
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(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(moved()), db, SIGNAL(groupMoved()));
|
||||||
connect(this, SIGNAL(modified()), db, SIGNAL(modifiedImmediate()));
|
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
|
// TODO: Replace with EntrySearcher
|
||||||
QStringList response;
|
QStringList response;
|
||||||
@ -934,15 +934,15 @@ QStringList Group::locate(QString locateTerm, QString currentPath)
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Entry* entry : asConst(m_entries)) {
|
for (const Entry* entry : asConst(m_entries)) {
|
||||||
QString entryPath = currentPath + entry->title();
|
QString entryPath = currentPath + entry->title();
|
||||||
if (entryPath.toLower().contains(locateTerm.toLower())) {
|
if (entryPath.toLower().contains(locateTerm.toLower())) {
|
||||||
response << entryPath;
|
response << entryPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Group* group : asConst(m_children)) {
|
for (const Group* group : asConst(m_children)) {
|
||||||
for (QString path : group->locate(locateTerm, currentPath + group->name() + QString("/"))) {
|
for (const QString& path : group->locate(locateTerm, currentPath + group->name() + QString("/"))) {
|
||||||
response << path;
|
response << path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -950,7 +950,7 @@ QStringList Group::locate(QString locateTerm, QString currentPath)
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
Entry* Group::addEntryWithPath(QString entryPath)
|
Entry* Group::addEntryWithPath(const QString& entryPath)
|
||||||
{
|
{
|
||||||
if (entryPath.isEmpty() || findEntryByPath(entryPath)) {
|
if (entryPath.isEmpty() || findEntryByPath(entryPath)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -115,11 +115,11 @@ public:
|
|||||||
|
|
||||||
Group* findChildByName(const QString& name);
|
Group* findChildByName(const QString& name);
|
||||||
Entry* findEntryByUuid(const QUuid& uuid) const;
|
Entry* findEntryByUuid(const QUuid& uuid) const;
|
||||||
Entry* findEntryByPath(QString entryPath);
|
Entry* findEntryByPath(const QString& entryPath);
|
||||||
Group* findGroupByUuid(const QUuid& uuid);
|
Group* findGroupByUuid(const QUuid& uuid);
|
||||||
Group* findGroupByPath(QString groupPath);
|
Group* findGroupByPath(const QString& groupPath);
|
||||||
QStringList locate(QString locateTerm, QString currentPath = {"/"});
|
QStringList locate(const QString& locateTerm, const QString& currentPath = {"/"}) const;
|
||||||
Entry* addEntryWithPath(QString entryPath);
|
Entry* addEntryWithPath(const QString& entryPath);
|
||||||
void setUuid(const QUuid& uuid);
|
void setUuid(const QUuid& uuid);
|
||||||
void setName(const QString& name);
|
void setName(const QString& name);
|
||||||
void setNotes(const QString& notes);
|
void setNotes(const QString& notes);
|
||||||
@ -190,8 +190,8 @@ private:
|
|||||||
void cleanupParent();
|
void cleanupParent();
|
||||||
void recCreateDelObjects();
|
void recCreateDelObjects();
|
||||||
|
|
||||||
Entry* findEntryByPathRecursive(QString entryPath, QString basePath);
|
Entry* findEntryByPathRecursive(const QString& entryPath, const QString& basePath);
|
||||||
Group* findGroupByPathRecursive(QString groupPath, QString basePath);
|
Group* findGroupByPathRecursive(const QString& groupPath, const QString& basePath);
|
||||||
|
|
||||||
QPointer<Database> m_db;
|
QPointer<Database> m_db;
|
||||||
QUuid m_uuid;
|
QUuid m_uuid;
|
||||||
|
@ -95,7 +95,7 @@ Merger::ChangeList Merger::mergeGroup(const MergeContext& context)
|
|||||||
// Entry is already present in the database. Update it.
|
// Entry is already present in the database. Update it.
|
||||||
const bool locationChanged = targetEntry->timeInfo().locationChanged() < sourceEntry->timeInfo().locationChanged();
|
const bool locationChanged = targetEntry->timeInfo().locationChanged() < sourceEntry->timeInfo().locationChanged();
|
||||||
if (locationChanged && targetEntry->group() != context.m_targetGroup) {
|
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);
|
moveEntry(targetEntry, context.m_targetGroup);
|
||||||
}
|
}
|
||||||
changes << resolveEntryConflict(context, sourceEntry, targetEntry);
|
changes << resolveEntryConflict(context, sourceEntry, targetEntry);
|
||||||
@ -107,7 +107,7 @@ Merger::ChangeList Merger::mergeGroup(const MergeContext& context)
|
|||||||
for (Group* sourceChildGroup : sourceChildGroups) {
|
for (Group* sourceChildGroup : sourceChildGroups) {
|
||||||
Group* targetChildGroup = context.m_targetRootGroup->findGroupByUuid(sourceChildGroup->uuid());
|
Group* targetChildGroup = context.m_targetRootGroup->findGroupByUuid(sourceChildGroup->uuid());
|
||||||
if (!targetChildGroup) {
|
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);
|
targetChildGroup = sourceChildGroup->clone(Entry::CloneNoFlags, Group::CloneNoFlags);
|
||||||
moveGroup(targetChildGroup, context.m_targetGroup);
|
moveGroup(targetChildGroup, context.m_targetGroup);
|
||||||
TimeInfo timeinfo = targetChildGroup->timeInfo();
|
TimeInfo timeinfo = targetChildGroup->timeInfo();
|
||||||
@ -117,7 +117,7 @@ Merger::ChangeList Merger::mergeGroup(const MergeContext& context)
|
|||||||
bool locationChanged =
|
bool locationChanged =
|
||||||
targetChildGroup->timeInfo().locationChanged() < sourceChildGroup->timeInfo().locationChanged();
|
targetChildGroup->timeInfo().locationChanged() < sourceChildGroup->timeInfo().locationChanged();
|
||||||
if (locationChanged && targetChildGroup->parent() != context.m_targetGroup) {
|
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);
|
moveGroup(targetChildGroup, context.m_targetGroup);
|
||||||
TimeInfo timeinfo = targetChildGroup->timeInfo();
|
TimeInfo timeinfo = targetChildGroup->timeInfo();
|
||||||
timeinfo.setLocationChanged(sourceChildGroup->timeInfo().locationChanged());
|
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.
|
// only if the other group is newer, update the existing one.
|
||||||
if (timeExisting < timeOther) {
|
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->setName(sourceChildGroup->name());
|
||||||
targetChildGroup->setNotes(sourceChildGroup->notes());
|
targetChildGroup->setNotes(sourceChildGroup->notes());
|
||||||
if (sourceChildGroup->iconNumber() == 0) {
|
if (sourceChildGroup->iconNumber() == 0) {
|
||||||
@ -270,16 +270,12 @@ Merger::ChangeList Merger::resolveEntryConflict_Duplicate(const MergeContext& co
|
|||||||
Entry* clonedEntry = sourceEntry->clone(Entry::CloneNewUuid | Entry::CloneIncludeHistory);
|
Entry* clonedEntry = sourceEntry->clone(Entry::CloneNewUuid | Entry::CloneIncludeHistory);
|
||||||
moveEntry(clonedEntry, context.m_targetGroup);
|
moveEntry(clonedEntry, context.m_targetGroup);
|
||||||
markOlderEntry(targetEntry);
|
markOlderEntry(targetEntry);
|
||||||
changes << tr("Adding backup for older target %1 [%2]")
|
changes << tr("Adding backup for older target %1 [%2]").arg(targetEntry->title(), targetEntry->uuidToHex());
|
||||||
.arg(targetEntry->title())
|
|
||||||
.arg(targetEntry->uuidToHex());
|
|
||||||
} else if (comparison > 0) {
|
} else if (comparison > 0) {
|
||||||
Entry* clonedEntry = sourceEntry->clone(Entry::CloneNewUuid | Entry::CloneIncludeHistory);
|
Entry* clonedEntry = sourceEntry->clone(Entry::CloneNewUuid | Entry::CloneIncludeHistory);
|
||||||
moveEntry(clonedEntry, context.m_targetGroup);
|
moveEntry(clonedEntry, context.m_targetGroup);
|
||||||
markOlderEntry(clonedEntry);
|
markOlderEntry(clonedEntry);
|
||||||
changes << tr("Adding backup for older source %1 [%2]")
|
changes << tr("Adding backup for older source %1 [%2]").arg(sourceEntry->title(), sourceEntry->uuidToHex());
|
||||||
.arg(sourceEntry->title())
|
|
||||||
.arg(sourceEntry->uuidToHex());
|
|
||||||
}
|
}
|
||||||
return changes;
|
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
|
// this type of merge changes the database timestamp since reapplying the
|
||||||
// old entry is an active change of the database!
|
// old entry is an active change of the database!
|
||||||
changes << tr("Reapplying older target entry on top of newer source %1 [%2]")
|
changes << tr("Reapplying older target entry on top of newer source %1 [%2]")
|
||||||
.arg(targetEntry->title())
|
.arg(targetEntry->title(), targetEntry->uuidToHex());
|
||||||
.arg(targetEntry->uuidToHex());
|
|
||||||
Entry* agedTargetEntry = targetEntry->clone(Entry::CloneNoFlags);
|
Entry* agedTargetEntry = targetEntry->clone(Entry::CloneNoFlags);
|
||||||
targetEntry->addHistoryItem(agedTargetEntry);
|
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
|
// this type of merge changes the database timestamp since reapplying the
|
||||||
// old entry is an active change of the database!
|
// old entry is an active change of the database!
|
||||||
changes << tr("Reapplying older source entry on top of newer target %1 [%2]")
|
changes << tr("Reapplying older source entry on top of newer target %1 [%2]")
|
||||||
.arg(targetEntry->title())
|
.arg(targetEntry->title(), targetEntry->uuidToHex());
|
||||||
.arg(targetEntry->uuidToHex());
|
|
||||||
targetEntry->beginUpdate();
|
targetEntry->beginUpdate();
|
||||||
targetEntry->copyDataFrom(sourceEntry);
|
targetEntry->copyDataFrom(sourceEntry);
|
||||||
targetEntry->endUpdate();
|
targetEntry->endUpdate();
|
||||||
@ -342,9 +336,7 @@ Merger::ChangeList Merger::resolveEntryConflict_MergeHistories(const MergeContex
|
|||||||
qPrintable(targetEntry->title()),
|
qPrintable(targetEntry->title()),
|
||||||
qPrintable(sourceEntry->title()),
|
qPrintable(sourceEntry->title()),
|
||||||
qPrintable(currentGroup->name()));
|
qPrintable(currentGroup->name()));
|
||||||
changes << tr("Synchronizing from newer source %1 [%2]")
|
changes << tr("Synchronizing from newer source %1 [%2]").arg(targetEntry->title(), targetEntry->uuidToHex());
|
||||||
.arg(targetEntry->title())
|
|
||||||
.arg(targetEntry->uuidToHex());
|
|
||||||
moveEntry(clonedEntry, currentGroup);
|
moveEntry(clonedEntry, currentGroup);
|
||||||
mergeHistory(targetEntry, clonedEntry, mergeMethod);
|
mergeHistory(targetEntry, clonedEntry, mergeMethod);
|
||||||
eraseEntry(targetEntry);
|
eraseEntry(targetEntry);
|
||||||
@ -355,9 +347,7 @@ Merger::ChangeList Merger::resolveEntryConflict_MergeHistories(const MergeContex
|
|||||||
qPrintable(targetEntry->group()->name()));
|
qPrintable(targetEntry->group()->name()));
|
||||||
const bool changed = mergeHistory(sourceEntry, targetEntry, mergeMethod);
|
const bool changed = mergeHistory(sourceEntry, targetEntry, mergeMethod);
|
||||||
if (changed) {
|
if (changed) {
|
||||||
changes << tr("Synchronizing from older source %1 [%2]")
|
changes << tr("Synchronizing from older source %1 [%2]").arg(targetEntry->title(), targetEntry->uuidToHex());
|
||||||
.arg(targetEntry->title())
|
|
||||||
.arg(targetEntry->uuidToHex());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return changes;
|
return changes;
|
||||||
@ -550,9 +540,9 @@ Merger::ChangeList Merger::mergeDeletions(const MergeContext& context)
|
|||||||
}
|
}
|
||||||
deletions << object;
|
deletions << object;
|
||||||
if (entry->group()) {
|
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 {
|
} 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
|
// Entry is inserted into deletedObjects after deletions are processed
|
||||||
eraseEntry(entry);
|
eraseEntry(entry);
|
||||||
@ -576,9 +566,9 @@ Merger::ChangeList Merger::mergeDeletions(const MergeContext& context)
|
|||||||
}
|
}
|
||||||
deletions << object;
|
deletions << object;
|
||||||
if (group->parentGroup()) {
|
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 {
|
} 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);
|
eraseGroup(group);
|
||||||
}
|
}
|
||||||
|
@ -25,15 +25,15 @@ const char* PasswordGenerator::DefaultExcludedChars = "";
|
|||||||
|
|
||||||
PasswordGenerator::PasswordGenerator()
|
PasswordGenerator::PasswordGenerator()
|
||||||
: m_length(0)
|
: m_length(0)
|
||||||
, m_classes(0)
|
, m_classes(nullptr)
|
||||||
, m_flags(0)
|
, m_flags(nullptr)
|
||||||
, m_excluded(PasswordGenerator::DefaultExcludedChars)
|
, 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)
|
void PasswordGenerator::setLength(int length)
|
||||||
|
@ -57,7 +57,7 @@ public:
|
|||||||
public:
|
public:
|
||||||
PasswordGenerator();
|
PasswordGenerator();
|
||||||
|
|
||||||
double calculateEntropy(QString password);
|
double calculateEntropy(const QString& password);
|
||||||
void setLength(int length);
|
void setLength(int length);
|
||||||
void setCharClasses(const CharClasses& classes);
|
void setCharClasses(const CharClasses& classes);
|
||||||
void setFlags(const GeneratorFlags& flags);
|
void setFlags(const GeneratorFlags& flags);
|
||||||
|
@ -24,10 +24,10 @@ class ScreenLockListenerPrivate : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
static ScreenLockListenerPrivate* instance(QWidget* parent = 0);
|
static ScreenLockListenerPrivate* instance(QWidget* parent = nullptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ScreenLockListenerPrivate(QWidget* parent = 0);
|
ScreenLockListenerPrivate(QWidget* parent = nullptr);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void screenLocked();
|
void screenLocked();
|
||||||
|
@ -27,7 +27,7 @@ class ScreenLockListenerWin : public ScreenLockListenerPrivate, public QAbstract
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit ScreenLockListenerWin(QWidget* parent = 0);
|
explicit ScreenLockListenerWin(QWidget* parent = nullptr);
|
||||||
~ScreenLockListenerWin();
|
~ScreenLockListenerWin();
|
||||||
virtual bool nativeEventFilter(const QByteArray& eventType, void* message, long*) override;
|
virtual bool nativeEventFilter(const QByteArray& eventType, void* message, long*) override;
|
||||||
|
|
||||||
|
@ -121,8 +121,8 @@ QString imageReaderFilter()
|
|||||||
QStringList formatsStringList;
|
QStringList formatsStringList;
|
||||||
|
|
||||||
for (const QByteArray& format : formats) {
|
for (const QByteArray& format : formats) {
|
||||||
for (int i = 0; i < format.size(); i++) {
|
for (char codePoint : format) {
|
||||||
if (!QChar(format.at(i)).isLetterOrNumber()) {
|
if (!QChar(codePoint).isLetterOrNumber()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -336,4 +336,4 @@ bool Crypto::testChaCha20()
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ bool CsvExporter::writeGroup(QIODevice* device, const Group* group, QString grou
|
|||||||
}
|
}
|
||||||
groupPath.append(group->name());
|
groupPath.append(group->name());
|
||||||
|
|
||||||
const QList<Entry*> entryList = group->entries();
|
const QList<Entry*>& entryList = group->entries();
|
||||||
for (const Entry* entry : entryList) {
|
for (const Entry* entry : entryList) {
|
||||||
QString line;
|
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) {
|
for (const Group* child : children) {
|
||||||
if (!writeGroup(device, child, groupPath)) {
|
if (!writeGroup(device, child, groupPath)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#define UUID_LENGTH 16
|
#define UUID_LENGTH 16
|
||||||
|
|
||||||
@ -43,9 +44,9 @@ KdbxXmlReader::KdbxXmlReader(quint32 version)
|
|||||||
* @param version KDBX version
|
* @param version KDBX version
|
||||||
* @param binaryPool binary pool
|
* @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_kdbxVersion(version)
|
||||||
, m_binaryPool(binaryPool)
|
, m_binaryPool(std::move(binaryPool))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class KdbxXmlReader
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit KdbxXmlReader(quint32 version);
|
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 ~KdbxXmlReader() = default;
|
||||||
|
|
||||||
virtual Database* readDatabase(const QString& filename);
|
virtual Database* readDatabase(const QString& filename);
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
class KeePass1Key : public CompositeKey
|
class KeePass1Key : public CompositeKey
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual QByteArray rawKey() const;
|
QByteArray rawKey() const override;
|
||||||
virtual void clear();
|
virtual void clear();
|
||||||
void setPassword(const QByteArray& password);
|
void setPassword(const QByteArray& password);
|
||||||
void setKeyfileData(const QByteArray& keyfileData);
|
void setKeyfileData(const QByteArray& keyfileData);
|
||||||
|
@ -59,7 +59,7 @@ const QList<QPair<QUuid, QString>> KeePass2::KDFS{
|
|||||||
qMakePair(KeePass2::KDF_AES_KDBX3, QObject::tr("AES-KDF (KDBX 3.1)"))
|
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);
|
CryptoHash hmacKeyHash(CryptoHash::Sha512);
|
||||||
hmacKeyHash.addData(masterSeed);
|
hmacKeyHash.addData(masterSeed);
|
||||||
@ -98,7 +98,7 @@ QSharedPointer<Kdf> KeePass2::kdfFromParameters(const QVariantMap& p)
|
|||||||
return kdf;
|
return kdf;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap KeePass2::kdfToParameters(QSharedPointer<Kdf> kdf)
|
QVariantMap KeePass2::kdfToParameters(const QSharedPointer<Kdf>& kdf)
|
||||||
{
|
{
|
||||||
return kdf->writeParameters();
|
return kdf->writeParameters();
|
||||||
}
|
}
|
||||||
|
@ -126,9 +126,9 @@ extern const QList<QPair<QUuid, QString>> KDFS;
|
|||||||
ByteArray = 0x42
|
ByteArray = 0x42
|
||||||
};
|
};
|
||||||
|
|
||||||
QByteArray hmacKey(QByteArray masterSeed, QByteArray transformedMasterKey);
|
QByteArray hmacKey(const QByteArray& masterSeed, const QByteArray& transformedMasterKey);
|
||||||
QSharedPointer<Kdf> kdfFromParameters(const QVariantMap& p);
|
QSharedPointer<Kdf> kdfFromParameters(const QVariantMap& p);
|
||||||
QVariantMap kdfToParameters(QSharedPointer<Kdf> kdf);
|
QVariantMap kdfToParameters(const QSharedPointer<Kdf>& kdf);
|
||||||
QSharedPointer<Kdf> uuidToKdf(const QUuid& uuid);
|
QSharedPointer<Kdf> uuidToKdf(const QUuid& uuid);
|
||||||
ProtectedStreamAlgo idToProtectedStreamAlgo(quint32 id);
|
ProtectedStreamAlgo idToProtectedStreamAlgo(quint32 id);
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "format/KeePass1.h"
|
#include "format/KeePass1.h"
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read database from file and detect correct file format.
|
* Read database from file and detect correct file format.
|
||||||
@ -37,7 +38,7 @@ Database* KeePass2Reader::readDatabase(const QString& filename, QSharedPointer<c
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QScopedPointer<Database> db(readDatabase(&file, key));
|
QScopedPointer<Database> db(readDatabase(&file, std::move(key)));
|
||||||
|
|
||||||
if (file.error() != QFile::NoError) {
|
if (file.error() != QFile::NoError) {
|
||||||
raiseError(file.errorString());
|
raiseError(file.errorString());
|
||||||
|
@ -65,9 +65,9 @@ AboutDialog::AboutDialog(QWidget* parent)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
debugInfo.append("\n").append(QString("%1\n- Qt %2\n- %3\n\n")
|
debugInfo.append("\n").append(QString("%1\n- Qt %2\n- %3\n\n")
|
||||||
.arg(tr("Libraries:"))
|
.arg(tr("Libraries:"),
|
||||||
.arg(QString::fromLocal8Bit(qVersion()))
|
QString::fromLocal8Bit(qVersion()),
|
||||||
.arg(Crypto::backendVersion()));
|
Crypto::backendVersion()));
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
|
||||||
debugInfo.append(tr("Operating system: %1\nCPU architecture: %2\nKernel: %3 %4")
|
debugInfo.append(tr("Operating system: %1\nCPU architecture: %2\nKernel: %3 %4")
|
||||||
|
@ -146,8 +146,8 @@ void ApplicationSettingsWidget::loadSettings()
|
|||||||
|
|
||||||
m_generalUi->languageComboBox->clear();
|
m_generalUi->languageComboBox->clear();
|
||||||
QList<QPair<QString, QString>> languages = Translator::availableLanguages();
|
QList<QPair<QString, QString>> languages = Translator::availableLanguages();
|
||||||
for (int i = 0; i < languages.size(); i++) {
|
for (const auto& language : languages) {
|
||||||
m_generalUi->languageComboBox->addItem(languages[i].second, languages[i].first);
|
m_generalUi->languageComboBox->addItem(language.second, language.first);
|
||||||
}
|
}
|
||||||
int defaultIndex = m_generalUi->languageComboBox->findData(config()->get("GUI/Language"));
|
int defaultIndex = m_generalUi->languageComboBox->findData(config()->get("GUI/Language"));
|
||||||
if (defaultIndex > 0) {
|
if (defaultIndex > 0) {
|
||||||
|
@ -39,7 +39,7 @@ CategoryListWidget::CategoryListWidget(QWidget* parent)
|
|||||||
connect(m_ui->scrollDown, SIGNAL(clicked()), SLOT(scrollCategoriesDown()));
|
connect(m_ui->scrollDown, SIGNAL(clicked()), SLOT(scrollCategoriesDown()));
|
||||||
connect(m_ui->categoryList->verticalScrollBar(), SIGNAL(valueChanged(int)), SLOT(updateCategoryScrollButtons()));
|
connect(m_ui->categoryList->verticalScrollBar(), SIGNAL(valueChanged(int)), SLOT(updateCategoryScrollButtons()));
|
||||||
connect(
|
connect(
|
||||||
m_ui->categoryList->verticalScrollBar(), SIGNAL(rangeChanged(int, int)), SLOT(updateCategoryScrollButtons()));
|
m_ui->categoryList->verticalScrollBar(), SIGNAL(rangeChanged(int,int)), SLOT(updateCategoryScrollButtons()));
|
||||||
}
|
}
|
||||||
|
|
||||||
CategoryListWidget::~CategoryListWidget()
|
CategoryListWidget::~CategoryListWidget()
|
||||||
|
@ -35,7 +35,7 @@ class CategoryListWidget : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CategoryListWidget(QWidget* parent = 0);
|
CategoryListWidget(QWidget* parent = nullptr);
|
||||||
~CategoryListWidget();
|
~CategoryListWidget();
|
||||||
|
|
||||||
int currentCategory();
|
int currentCategory();
|
||||||
@ -90,4 +90,4 @@ private:
|
|||||||
Q_DISABLE_COPY(CategoryListWidgetDelegate)
|
Q_DISABLE_COPY(CategoryListWidgetDelegate)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -106,7 +106,7 @@ void DatabaseOpenWidget::showEvent(QShowEvent* event)
|
|||||||
// showEvent() may be called twice, so make sure we are only polling once
|
// showEvent() may be called twice, so make sure we are only polling once
|
||||||
if (!m_yubiKeyBeingPolled) {
|
if (!m_yubiKeyBeingPolled) {
|
||||||
connect(
|
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(detectComplete()), SLOT(yubikeyDetectComplete()), Qt::QueuedConnection);
|
||||||
connect(YubiKey::instance(), SIGNAL(notFound()), SLOT(noYubikeyFound()), Qt::QueuedConnection);
|
connect(YubiKey::instance(), SIGNAL(notFound()), SLOT(noYubikeyFound()), Qt::QueuedConnection);
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ void DatabaseOpenWidget::hideEvent(QHideEvent* event)
|
|||||||
|
|
||||||
#ifdef WITH_XC_YUBIKEY
|
#ifdef WITH_XC_YUBIKEY
|
||||||
// Don't listen to any Yubikey events if we are hidden
|
// 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;
|
m_yubiKeyBeingPolled = false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -143,7 +143,7 @@ void DatabaseOpenWidget::load(const QString& filename)
|
|||||||
|
|
||||||
QHash<QString, QVariant> useTouchID = config()->get("UseTouchID").toHash();
|
QHash<QString, QVariant> useTouchID = config()->get("UseTouchID").toHash();
|
||||||
m_ui->checkTouchID->setChecked(useTouchID.value(m_filename, false).toBool());
|
m_ui->checkTouchID->setChecked(useTouchID.value(m_filename, false).toBool());
|
||||||
|
|
||||||
m_ui->editPassword->setFocus();
|
m_ui->editPassword->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,9 +195,9 @@ void DatabaseOpenWidget::openDatabase()
|
|||||||
MessageWidget::Error);
|
MessageWidget::Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_db) {
|
|
||||||
delete m_db;
|
delete m_db;
|
||||||
}
|
|
||||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||||
m_db = reader.readDatabase(&file, masterKey);
|
m_db = reader.readDatabase(&file, masterKey);
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
@ -254,7 +254,7 @@ QSharedPointer<CompositeKey> DatabaseOpenWidget::databaseKey()
|
|||||||
// check if the user cancelled the operation
|
// check if the user cancelled the operation
|
||||||
if (passwordKey.isNull())
|
if (passwordKey.isNull())
|
||||||
return QSharedPointer<CompositeKey>();
|
return QSharedPointer<CompositeKey>();
|
||||||
|
|
||||||
masterKey->addKey(PasswordKey::fromRawKey(*passwordKey));
|
masterKey->addKey(PasswordKey::fromRawKey(*passwordKey));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -419,7 +419,7 @@ bool DatabaseTabWidget::saveDatabaseAs(Database* db)
|
|||||||
oldFilePath,
|
oldFilePath,
|
||||||
tr("KeePass 2 Database").append(" (*.kdbx)"),
|
tr("KeePass 2 Database").append(" (*.kdbx)"),
|
||||||
nullptr,
|
nullptr,
|
||||||
0,
|
nullptr,
|
||||||
"kdbx");
|
"kdbx");
|
||||||
if (!newFilePath.isEmpty()) {
|
if (!newFilePath.isEmpty()) {
|
||||||
// Ensure we don't recurse back into this function
|
// Ensure we don't recurse back into this function
|
||||||
@ -488,7 +488,7 @@ void DatabaseTabWidget::exportToCsv()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString fileName = fileDialog()->getSaveFileName(
|
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()) {
|
if (fileName.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -693,7 +693,7 @@ void DatabaseTabWidget::insertDatabase(Database* db, const DatabaseManagerStruct
|
|||||||
setCurrentIndex(index);
|
setCurrentIndex(index);
|
||||||
connectDatabase(db);
|
connectDatabase(db);
|
||||||
connect(dbStruct.dbWidget, SIGNAL(closeRequest()), SLOT(closeDatabaseFromSender()));
|
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(updateTabNameFromDbWidgetSender()));
|
||||||
connect(dbStruct.dbWidget, SIGNAL(unlockedDatabase()), SLOT(emitDatabaseUnlockedFromDbWidgetSender()));
|
connect(dbStruct.dbWidget, SIGNAL(unlockedDatabase()), SLOT(emitDatabaseUnlockedFromDbWidgetSender()));
|
||||||
}
|
}
|
||||||
|
@ -175,14 +175,14 @@ DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent)
|
|||||||
addWidget(m_keepass1OpenWidget);
|
addWidget(m_keepass1OpenWidget);
|
||||||
addWidget(m_unlockDatabaseWidget);
|
addWidget(m_unlockDatabaseWidget);
|
||||||
|
|
||||||
connect(m_mainSplitter, SIGNAL(splitterMoved(int, int)), SIGNAL(mainSplitterSizesChanged()));
|
connect(m_mainSplitter, SIGNAL(splitterMoved(int,int)), SIGNAL(mainSplitterSizesChanged()));
|
||||||
connect(m_previewSplitter, SIGNAL(splitterMoved(int, int)), SIGNAL(previewSplitterSizesChanged()));
|
connect(m_previewSplitter, SIGNAL(splitterMoved(int,int)), SIGNAL(previewSplitterSizesChanged()));
|
||||||
connect(m_entryView, SIGNAL(viewStateChanged()), SIGNAL(entryViewStateChanged()));
|
connect(m_entryView, SIGNAL(viewStateChanged()), SIGNAL(entryViewStateChanged()));
|
||||||
connect(m_groupView, SIGNAL(groupChanged(Group*)), this, SLOT(onGroupChanged(Group*)));
|
connect(m_groupView, SIGNAL(groupChanged(Group*)), this, SLOT(onGroupChanged(Group*)));
|
||||||
connect(m_groupView, SIGNAL(groupChanged(Group*)), SIGNAL(groupChanged()));
|
connect(m_groupView, SIGNAL(groupChanged(Group*)), SIGNAL(groupChanged()));
|
||||||
connect(m_entryView,
|
connect(m_entryView,
|
||||||
SIGNAL(entryActivated(Entry*, EntryModel::ModelColumn)),
|
SIGNAL(entryActivated(Entry*,EntryModel::ModelColumn)),
|
||||||
SLOT(entryActivationSignalReceived(Entry*, EntryModel::ModelColumn)));
|
SLOT(entryActivationSignalReceived(Entry*,EntryModel::ModelColumn)));
|
||||||
connect(m_entryView, SIGNAL(entrySelectionChanged()), SIGNAL(entrySelectionChanged()));
|
connect(m_entryView, SIGNAL(entrySelectionChanged()), SIGNAL(entrySelectionChanged()));
|
||||||
connect(m_editEntryWidget, SIGNAL(editFinished(bool)), SLOT(switchToView(bool)));
|
connect(m_editEntryWidget, SIGNAL(editFinished(bool)), SLOT(switchToView(bool)));
|
||||||
connect(m_editEntryWidget, SIGNAL(historyEntryActivated(Entry*)), SLOT(switchToHistoryView(Entry*)));
|
connect(m_editEntryWidget, SIGNAL(historyEntryActivated(Entry*)), SLOT(switchToHistoryView(Entry*)));
|
||||||
|
@ -71,8 +71,7 @@ bool DialogyWidget::clickButton(QDialogButtonBox::StandardButton standardButton)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList<QDialogButtonBox*> buttonBoxes = findChildren<QDialogButtonBox*>();
|
QList<QDialogButtonBox*> buttonBoxes = findChildren<QDialogButtonBox*>();
|
||||||
for (int i = 0; i < buttonBoxes.size(); ++i) {
|
for (auto buttonBox : buttonBoxes) {
|
||||||
QDialogButtonBox* buttonBox = buttonBoxes.at(i);
|
|
||||||
pb = buttonBox->button(standardButton);
|
pb = buttonBox->button(standardButton);
|
||||||
if (pb && pb->isVisible() && pb->isEnabled()) {
|
if (pb && pb->isVisible() && pb->isEnabled()) {
|
||||||
pb->click();
|
pb->click();
|
||||||
|
@ -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->defaultIconsRadio, SIGNAL(toggled(bool)), this, SIGNAL(widgetUpdated()));
|
connect(m_ui->defaultIconsRadio, SIGNAL(toggled(bool)), this, SIGNAL(widgetUpdated()));
|
||||||
connect(m_ui->defaultIconsView->selectionModel(),
|
connect(m_ui->defaultIconsView->selectionModel(),
|
||||||
SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
|
SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
||||||
this,
|
this,
|
||||||
SIGNAL(widgetUpdated()));
|
SIGNAL(widgetUpdated()));
|
||||||
connect(m_ui->customIconsView->selectionModel(),
|
connect(m_ui->customIconsView->selectionModel(),
|
||||||
SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
|
SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
||||||
this,
|
this,
|
||||||
SIGNAL(widgetUpdated()));
|
SIGNAL(widgetUpdated()));
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ namespace {
|
|||||||
// Try to get the 2nd level domain of the host part of a QUrl. For example,
|
// 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"
|
// "foo.bar.example.com" would become "example.com", and "foo.bar.example.co.uk"
|
||||||
// would become "example.co.uk".
|
// would become "example.co.uk".
|
||||||
QString getSecondLevelDomain(QUrl url)
|
QString getSecondLevelDomain(const QUrl& url)
|
||||||
{
|
{
|
||||||
QString fqdn = url.host();
|
QString fqdn = url.host();
|
||||||
fqdn.truncate(fqdn.length() - url.topLevelDomain().length());
|
fqdn.truncate(fqdn.length() - url.topLevelDomain().length());
|
||||||
@ -185,7 +185,7 @@ namespace {
|
|||||||
return newdom;
|
return newdom;
|
||||||
}
|
}
|
||||||
|
|
||||||
QUrl convertVariantToUrl(QVariant var)
|
QUrl convertVariantToUrl(const QVariant& var)
|
||||||
{
|
{
|
||||||
QUrl url;
|
QUrl url;
|
||||||
if (var.canConvert<QUrl>())
|
if (var.canConvert<QUrl>())
|
||||||
|
@ -33,7 +33,7 @@ EditWidgetProperties::EditWidgetProperties(QWidget* parent)
|
|||||||
m_ui->customDataTable->setModel(m_customDataModel);
|
m_ui->customDataTable->setModel(m_customDataModel);
|
||||||
|
|
||||||
connect(m_ui->customDataTable->selectionModel(),
|
connect(m_ui->customDataTable->selectionModel(),
|
||||||
SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
|
SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
||||||
SLOT(toggleRemoveButton(QItemSelection)));
|
SLOT(toggleRemoveButton(QItemSelection)));
|
||||||
connect(m_ui->removeCustomDataButton, SIGNAL(clicked()), SLOT(removeSelectedPluginData()));
|
connect(m_ui->removeCustomDataButton, SIGNAL(clicked()), SLOT(removeSelectedPluginData()));
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ FileDialog::FileDialog()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileDialog::saveLastDir(QString dir)
|
void FileDialog::saveLastDir(const QString& dir)
|
||||||
{
|
{
|
||||||
if (!dir.isEmpty() && !m_forgetLastDir) {
|
if (!dir.isEmpty() && !m_forgetLastDir) {
|
||||||
config()->set("LastDir", QFileInfo(dir).absolutePath());
|
config()->set("LastDir", QFileInfo(dir).absolutePath());
|
||||||
|
@ -65,7 +65,7 @@ private:
|
|||||||
QString m_nextDirName;
|
QString m_nextDirName;
|
||||||
bool m_forgetLastDir = false;
|
bool m_forgetLastDir = false;
|
||||||
|
|
||||||
void saveLastDir(QString);
|
void saveLastDir(const QString&);
|
||||||
|
|
||||||
static FileDialog* m_instance;
|
static FileDialog* m_instance;
|
||||||
|
|
||||||
|
@ -309,10 +309,10 @@ void KMessageWidget::setMessageType(KMessageWidget::MessageType type)
|
|||||||
"}"
|
"}"
|
||||||
".QLabel { color: %6; }"
|
".QLabel { color: %6; }"
|
||||||
))
|
))
|
||||||
.arg(bg0.name())
|
.arg(bg0.name(),
|
||||||
.arg(bg1.name())
|
bg1.name(),
|
||||||
.arg(bg2.name())
|
bg2.name(),
|
||||||
.arg(border.name())
|
border.name())
|
||||||
// DefaultFrameWidth returns the size of the external margin + border width. We know our border is 1px,
|
// 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
|
// so we subtract this from the frame normal QStyle FrameWidth to get our margin
|
||||||
.arg(style()->pixelMetric(QStyle::PM_DefaultFrameWidth, nullptr, this) - 1)
|
.arg(style()->pixelMetric(QStyle::PM_DefaultFrameWidth, nullptr, this) - 1)
|
||||||
@ -411,7 +411,7 @@ void KMessageWidget::removeAction(QAction *action)
|
|||||||
|
|
||||||
void KMessageWidget::animatedShow()
|
void KMessageWidget::animatedShow()
|
||||||
{
|
{
|
||||||
if (!style()->styleHint(QStyle::SH_Widget_Animate, 0, this)) {
|
if (!style()->styleHint(QStyle::SH_Widget_Animate, nullptr, this)) {
|
||||||
show();
|
show();
|
||||||
emit showAnimationFinished();
|
emit showAnimationFinished();
|
||||||
return;
|
return;
|
||||||
@ -436,7 +436,7 @@ void KMessageWidget::animatedShow()
|
|||||||
|
|
||||||
void KMessageWidget::animatedHide()
|
void KMessageWidget::animatedHide()
|
||||||
{
|
{
|
||||||
if (!style()->styleHint(QStyle::SH_Widget_Animate, 0, this)) {
|
if (!style()->styleHint(QStyle::SH_Widget_Animate, nullptr, this)) {
|
||||||
hide();
|
hide();
|
||||||
emit hideAnimationFinished();
|
emit hideAnimationFinished();
|
||||||
return;
|
return;
|
||||||
|
@ -53,9 +53,9 @@ void KeePass1OpenWidget::openDatabase()
|
|||||||
MessageWidget::Error);
|
MessageWidget::Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_db) {
|
|
||||||
delete m_db;
|
delete m_db;
|
||||||
}
|
|
||||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||||
m_db = reader.readDatabase(&file, password, keyFileName);
|
m_db = reader.readDatabase(&file, password, keyFileName);
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
|
@ -319,14 +319,14 @@ MainWindow::MainWindow()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
connect(m_ui->tabWidget,
|
connect(m_ui->tabWidget,
|
||||||
SIGNAL(messageGlobal(QString, MessageWidget::MessageType)),
|
SIGNAL(messageGlobal(QString,MessageWidget::MessageType)),
|
||||||
this,
|
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(messageDismissGlobal()), this, SLOT(hideGlobalMessage()));
|
||||||
connect(m_ui->tabWidget,
|
connect(m_ui->tabWidget,
|
||||||
SIGNAL(messageTab(QString, MessageWidget::MessageType)),
|
SIGNAL(messageTab(QString,MessageWidget::MessageType)),
|
||||||
this,
|
this,
|
||||||
SLOT(displayTabMessage(QString, MessageWidget::MessageType)));
|
SLOT(displayTabMessage(QString,MessageWidget::MessageType)));
|
||||||
connect(m_ui->tabWidget, SIGNAL(messageDismissTab()), this, SLOT(hideTabMessage()));
|
connect(m_ui->tabWidget, SIGNAL(messageDismissTab()), this, SLOT(hideTabMessage()));
|
||||||
|
|
||||||
m_screenLockListener = new ScreenLockListener(this);
|
m_screenLockListener = new ScreenLockListener(this);
|
||||||
@ -673,7 +673,7 @@ void MainWindow::switchToOpenDatabase()
|
|||||||
switchToDatabases();
|
switchToDatabases();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::switchToDatabaseFile(QString file)
|
void MainWindow::switchToDatabaseFile(const QString& file)
|
||||||
{
|
{
|
||||||
m_ui->tabWidget->openDatabase(file);
|
m_ui->tabWidget->openDatabase(file);
|
||||||
switchToDatabases();
|
switchToDatabases();
|
||||||
|
@ -90,7 +90,7 @@ private slots:
|
|||||||
void switchToPasswordGen(bool enabled);
|
void switchToPasswordGen(bool enabled);
|
||||||
void switchToNewDatabase();
|
void switchToNewDatabase();
|
||||||
void switchToOpenDatabase();
|
void switchToOpenDatabase();
|
||||||
void switchToDatabaseFile(QString file);
|
void switchToDatabaseFile(const QString& file);
|
||||||
void switchToKeePass1Database();
|
void switchToKeePass1Database();
|
||||||
void switchToCsvImport();
|
void switchToCsvImport();
|
||||||
void closePasswordGen();
|
void closePasswordGen();
|
||||||
|
@ -28,7 +28,7 @@ class MessageWidget : public KMessageWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MessageWidget(QWidget* parent = 0);
|
explicit MessageWidget(QWidget* parent = nullptr);
|
||||||
|
|
||||||
int autoHideTimeout() const;
|
int autoHideTimeout() const;
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ void PasswordEdit::updateStylesheet()
|
|||||||
setStyleSheet(stylesheet);
|
setStyleSheet(stylesheet);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PasswordEdit::autocompletePassword(QString password)
|
void PasswordEdit::autocompletePassword(const QString& password)
|
||||||
{
|
{
|
||||||
if (config()->get("security/passwordsrepeat").toBool() && echoMode() == QLineEdit::Normal) {
|
if (config()->get("security/passwordsrepeat").toBool() && echoMode() == QLineEdit::Normal) {
|
||||||
setText(password);
|
setText(password);
|
||||||
|
@ -41,7 +41,7 @@ signals:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateStylesheet();
|
void updateStylesheet();
|
||||||
void autocompletePassword(QString password);
|
void autocompletePassword(const QString& password);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool passwordsEqual() const;
|
bool passwordsEqual() const;
|
||||||
|
@ -35,7 +35,7 @@ class SearchWidget : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SearchWidget(QWidget* parent = 0);
|
explicit SearchWidget(QWidget* parent = nullptr);
|
||||||
~SearchWidget();
|
~SearchWidget();
|
||||||
|
|
||||||
void connectSignals(SignalMultiplexer& mx);
|
void connectSignals(SignalMultiplexer& mx);
|
||||||
@ -55,7 +55,7 @@ signals:
|
|||||||
void enterPressed();
|
void enterPressed();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void databaseChanged(DatabaseWidget* dbWidget = 0);
|
void databaseChanged(DatabaseWidget* dbWidget = nullptr);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void startSearchTimer();
|
void startSearchTimer();
|
||||||
|
@ -315,7 +315,7 @@ void CsvImportWidget::setRootGroup()
|
|||||||
m_db->rootGroup()->setName("Root");
|
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"
|
// extract group names from nested path provided in "label"
|
||||||
Group* current = m_db->rootGroup();
|
Group* current = m_db->rootGroup();
|
||||||
@ -345,7 +345,7 @@ Group* CsvImportWidget::splitGroups(QString label)
|
|||||||
return current;
|
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
|
// returns the group whose name is "groupName" and is child of "current" group
|
||||||
for (Group* group : current->children()) {
|
for (Group* group : current->children()) {
|
||||||
|
@ -68,8 +68,8 @@ private:
|
|||||||
QStringList m_fieldSeparatorList;
|
QStringList m_fieldSeparatorList;
|
||||||
void configParser();
|
void configParser();
|
||||||
void updateTableview();
|
void updateTableview();
|
||||||
Group* splitGroups(QString label);
|
Group* splitGroups(const QString& label);
|
||||||
Group* hasChildren(Group* current, QString groupName);
|
Group* hasChildren(Group* current, const QString& groupName);
|
||||||
QString formatStatusText() const;
|
QString formatStatusText() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
#include "CsvParserModel.h"
|
#include "CsvParserModel.h"
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
CsvParserModel::CsvParserModel(QObject* parent)
|
CsvParserModel::CsvParserModel(QObject* parent)
|
||||||
: QAbstractTableModel(parent)
|
: QAbstractTableModel(parent)
|
||||||
, m_skipped(0)
|
, m_skipped(0)
|
||||||
@ -36,9 +38,9 @@ void CsvParserModel::setFilename(const QString& filename)
|
|||||||
QString CsvParserModel::getFileInfo()
|
QString CsvParserModel::getFileInfo()
|
||||||
{
|
{
|
||||||
QString a(tr("%1, %2, %3", "file info: bytes, rows, columns")
|
QString a(tr("%1, %2, %3", "file info: bytes, rows, columns")
|
||||||
.arg(tr("%n byte(s)", nullptr, getFileSize()))
|
.arg(tr("%n byte(s)", nullptr, getFileSize()),
|
||||||
.arg(tr("%n row(s)", nullptr, getCsvRows()))
|
tr("%n row(s)", nullptr, getCsvRows()),
|
||||||
.arg(tr("%n column(s)", nullptr, qMax(0, getCsvCols() - 1))));
|
tr("%n column(s)", nullptr, qMax(0, getCsvCols() - 1))));
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +94,7 @@ void CsvParserModel::setSkippedRows(int skipped)
|
|||||||
|
|
||||||
void CsvParserModel::setHeaderLabels(QStringList l)
|
void CsvParserModel::setHeaderLabels(QStringList l)
|
||||||
{
|
{
|
||||||
m_columnHeader = l;
|
m_columnHeader = std::move(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CsvParserModel::rowCount(const QModelIndex& parent) const
|
int CsvParserModel::rowCount(const QModelIndex& parent) const
|
||||||
|
@ -38,7 +38,7 @@ DatabaseSettingsWidgetBrowser::DatabaseSettingsWidgetBrowser(QWidget* parent)
|
|||||||
m_ui->customDataTable->setModel(m_customDataModel);
|
m_ui->customDataTable->setModel(m_customDataModel);
|
||||||
|
|
||||||
settingsWarning();
|
settingsWarning();
|
||||||
connect(m_ui->customDataTable->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
|
connect(m_ui->customDataTable->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
||||||
SLOT(toggleRemoveButton(QItemSelection)));
|
SLOT(toggleRemoveButton(QItemSelection)));
|
||||||
connect(m_ui->removeCustomDataButton, SIGNAL(clicked()), SLOT(removeSelectedKey()));
|
connect(m_ui->removeCustomDataButton, SIGNAL(clicked()), SLOT(removeSelectedKey()));
|
||||||
connect(m_ui->convertToCustomData, SIGNAL(clicked()), this, SLOT(convertAttributesToCustomData()));
|
connect(m_ui->convertToCustomData, SIGNAL(clicked()), this, SLOT(convertAttributesToCustomData()));
|
||||||
|
@ -37,7 +37,7 @@ AutoTypeMatch AutoTypeMatchModel::matchFromIndex(const QModelIndex& index) const
|
|||||||
return m_matches.at(index.row());
|
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);
|
int row = m_matches.indexOf(match);
|
||||||
Q_ASSERT(row != -1);
|
Q_ASSERT(row != -1);
|
||||||
|
@ -41,7 +41,7 @@ public:
|
|||||||
|
|
||||||
explicit AutoTypeMatchModel(QObject* parent = nullptr);
|
explicit AutoTypeMatchModel(QObject* parent = nullptr);
|
||||||
AutoTypeMatch matchFromIndex(const QModelIndex& index) const;
|
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 rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||||
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
|
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||||
|
@ -44,7 +44,7 @@ AutoTypeMatchView::AutoTypeMatchView(QWidget* parent)
|
|||||||
|
|
||||||
connect(this, SIGNAL(doubleClicked(QModelIndex)), SLOT(emitMatchActivated(QModelIndex)));
|
connect(this, SIGNAL(doubleClicked(QModelIndex)), SLOT(emitMatchActivated(QModelIndex)));
|
||||||
connect(
|
connect(
|
||||||
selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), SIGNAL(matchSelectionChanged()));
|
selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SIGNAL(matchSelectionChanged()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoTypeMatchView::keyPressEvent(QKeyEvent* event)
|
void AutoTypeMatchView::keyPressEvent(QKeyEvent* event)
|
||||||
@ -98,7 +98,7 @@ AutoTypeMatch AutoTypeMatchView::currentMatch()
|
|||||||
return AutoTypeMatch();
|
return AutoTypeMatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoTypeMatchView::setCurrentMatch(AutoTypeMatch match)
|
void AutoTypeMatchView::setCurrentMatch(const AutoTypeMatch& match)
|
||||||
{
|
{
|
||||||
selectionModel()->setCurrentIndex(m_sortModel->mapFromSource(m_model->indexFromMatch(match)),
|
selectionModel()->setCurrentIndex(m_sortModel->mapFromSource(m_model->indexFromMatch(match)),
|
||||||
QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
|
QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
|
||||||
|
@ -34,7 +34,7 @@ class AutoTypeMatchView : public QTreeView
|
|||||||
public:
|
public:
|
||||||
explicit AutoTypeMatchView(QWidget* parent = nullptr);
|
explicit AutoTypeMatchView(QWidget* parent = nullptr);
|
||||||
AutoTypeMatch currentMatch();
|
AutoTypeMatch currentMatch();
|
||||||
void setCurrentMatch(AutoTypeMatch match);
|
void setCurrentMatch(const AutoTypeMatch& match);
|
||||||
AutoTypeMatch matchFromIndex(const QModelIndex& index);
|
AutoTypeMatch matchFromIndex(const QModelIndex& index);
|
||||||
void setMatchList(const QList<AutoTypeMatch>& matches);
|
void setMatchList(const QList<AutoTypeMatch>& matches);
|
||||||
void setFirstMatchActive();
|
void setFirstMatchActive();
|
||||||
|
@ -103,8 +103,8 @@ EditEntryWidget::EditEntryWidget(QWidget* parent)
|
|||||||
connect(this, SIGNAL(rejected()), SLOT(cancel()));
|
connect(this, SIGNAL(rejected()), SLOT(cancel()));
|
||||||
connect(this, SIGNAL(apply()), SLOT(commitEntry()));
|
connect(this, SIGNAL(apply()), SLOT(commitEntry()));
|
||||||
connect(m_iconsWidget,
|
connect(m_iconsWidget,
|
||||||
SIGNAL(messageEditEntry(QString, MessageWidget::MessageType)),
|
SIGNAL(messageEditEntry(QString,MessageWidget::MessageType)),
|
||||||
SLOT(showMessage(QString, MessageWidget::MessageType)));
|
SLOT(showMessage(QString,MessageWidget::MessageType)));
|
||||||
connect(m_iconsWidget, SIGNAL(messageEditEntryDismiss()), SLOT(hideMessage()));
|
connect(m_iconsWidget, SIGNAL(messageEditEntryDismiss()), SLOT(hideMessage()));
|
||||||
|
|
||||||
m_mainUi->passwordGenerator->layout()->setContentsMargins(0, 0, 0, 0);
|
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->protectAttributeButton, SIGNAL(toggled(bool)), SLOT(protectCurrentAttribute(bool)));
|
||||||
connect(m_advancedUi->revealAttributeButton, SIGNAL(clicked(bool)), SLOT(revealCurrentAttribute()));
|
connect(m_advancedUi->revealAttributeButton, SIGNAL(clicked(bool)), SLOT(revealCurrentAttribute()));
|
||||||
connect(m_advancedUi->attributesView->selectionModel(),
|
connect(m_advancedUi->attributesView->selectionModel(),
|
||||||
SIGNAL(currentChanged(QModelIndex, QModelIndex)),
|
SIGNAL(currentChanged(QModelIndex,QModelIndex)),
|
||||||
SLOT(updateCurrentAttribute()));
|
SLOT(updateCurrentAttribute()));
|
||||||
connect(m_advancedUi->fgColorButton, SIGNAL(clicked()), SLOT(pickColor()));
|
connect(m_advancedUi->fgColorButton, SIGNAL(clicked()), SLOT(pickColor()));
|
||||||
connect(m_advancedUi->bgColorButton, 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->assocAddButton, SIGNAL(clicked()), SLOT(insertAutoTypeAssoc()));
|
||||||
connect(m_autoTypeUi->assocRemoveButton, SIGNAL(clicked()), SLOT(removeAutoTypeAssoc()));
|
connect(m_autoTypeUi->assocRemoveButton, SIGNAL(clicked()), SLOT(removeAutoTypeAssoc()));
|
||||||
connect(m_autoTypeUi->assocView->selectionModel(),
|
connect(m_autoTypeUi->assocView->selectionModel(),
|
||||||
SIGNAL(currentRowChanged(QModelIndex, QModelIndex)),
|
SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
|
||||||
SLOT(updateAutoTypeEnabled()));
|
SLOT(updateAutoTypeEnabled()));
|
||||||
connect(m_autoTypeAssocModel, SIGNAL(modelReset()), SLOT(updateAutoTypeEnabled()));
|
connect(m_autoTypeAssocModel, SIGNAL(modelReset()), SLOT(updateAutoTypeEnabled()));
|
||||||
connect(m_autoTypeUi->assocView->selectionModel(),
|
connect(m_autoTypeUi->assocView->selectionModel(),
|
||||||
SIGNAL(currentRowChanged(QModelIndex, QModelIndex)),
|
SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
|
||||||
SLOT(loadCurrentAssoc(QModelIndex)));
|
SLOT(loadCurrentAssoc(QModelIndex)));
|
||||||
connect(m_autoTypeAssocModel, SIGNAL(modelReset()), SLOT(clearCurrentAssoc()));
|
connect(m_autoTypeAssocModel, SIGNAL(modelReset()), SLOT(clearCurrentAssoc()));
|
||||||
connect(m_autoTypeUi->windowTitleCombo, SIGNAL(editTextChanged(QString)), SLOT(applyCurrentAssoc()));
|
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, SIGNAL(activated(QModelIndex)), SLOT(histEntryActivated(QModelIndex)));
|
||||||
connect(m_historyUi->historyView->selectionModel(),
|
connect(m_historyUi->historyView->selectionModel(),
|
||||||
SIGNAL(currentChanged(QModelIndex, QModelIndex)),
|
SIGNAL(currentChanged(QModelIndex,QModelIndex)),
|
||||||
SLOT(updateHistoryButtons(QModelIndex, QModelIndex)));
|
SLOT(updateHistoryButtons(QModelIndex,QModelIndex)));
|
||||||
connect(m_historyUi->showButton, SIGNAL(clicked()), SLOT(showHistoryEntry()));
|
connect(m_historyUi->showButton, SIGNAL(clicked()), SLOT(showHistoryEntry()));
|
||||||
connect(m_historyUi->restoreButton, SIGNAL(clicked()), SLOT(restoreHistoryEntry()));
|
connect(m_historyUi->restoreButton, SIGNAL(clicked()), SLOT(restoreHistoryEntry()));
|
||||||
connect(m_historyUi->deleteButton, SIGNAL(clicked()), SLOT(deleteHistoryEntry()));
|
connect(m_historyUi->deleteButton, SIGNAL(clicked()), SLOT(deleteHistoryEntry()));
|
||||||
@ -236,14 +236,14 @@ void EditEntryWidget::setupHistory()
|
|||||||
void EditEntryWidget::setupEntryUpdate()
|
void EditEntryWidget::setupEntryUpdate()
|
||||||
{
|
{
|
||||||
// Entry tab
|
// Entry tab
|
||||||
connect(m_mainUi->titleEdit, SIGNAL(textChanged(const QString&)), this, SLOT(setUnsavedChanges()));
|
connect(m_mainUi->titleEdit, SIGNAL(textChanged(QString)), this, SLOT(setUnsavedChanges()));
|
||||||
connect(m_mainUi->usernameEdit, SIGNAL(textChanged(const QString&)), this, SLOT(setUnsavedChanges()));
|
connect(m_mainUi->usernameEdit, SIGNAL(textChanged(QString)), this, SLOT(setUnsavedChanges()));
|
||||||
connect(m_mainUi->passwordEdit, SIGNAL(textChanged(const QString&)), this, SLOT(setUnsavedChanges()));
|
connect(m_mainUi->passwordEdit, SIGNAL(textChanged(QString)), this, SLOT(setUnsavedChanges()));
|
||||||
connect(m_mainUi->passwordRepeatEdit, SIGNAL(textChanged(const QString&)), this, SLOT(setUnsavedChanges()));
|
connect(m_mainUi->passwordRepeatEdit, SIGNAL(textChanged(QString)), this, SLOT(setUnsavedChanges()));
|
||||||
connect(m_mainUi->urlEdit, SIGNAL(textChanged(const 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->expireCheck, SIGNAL(stateChanged(int)), this, SLOT(setUnsavedChanges()));
|
||||||
connect(m_mainUi->notesEnabled, 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()));
|
connect(m_mainUi->notesEdit, SIGNAL(textChanged()), this, SLOT(setUnsavedChanges()));
|
||||||
|
|
||||||
// Advanced tab
|
// Advanced tab
|
||||||
@ -261,10 +261,10 @@ void EditEntryWidget::setupEntryUpdate()
|
|||||||
connect(m_autoTypeUi->customWindowSequenceButton, SIGNAL(stateChanged(int)), this, SLOT(setUnsavedChanges()));
|
connect(m_autoTypeUi->customWindowSequenceButton, SIGNAL(stateChanged(int)), this, SLOT(setUnsavedChanges()));
|
||||||
connect(m_autoTypeUi->inheritSequenceButton, SIGNAL(toggled(bool)), 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->customSequenceButton, SIGNAL(toggled(bool)), this, SLOT(setUnsavedChanges()));
|
||||||
connect(m_autoTypeUi->windowSequenceEdit, SIGNAL(textChanged(const QString&)), this, SLOT(setUnsavedChanges()));
|
connect(m_autoTypeUi->windowSequenceEdit, SIGNAL(textChanged(QString)), this, SLOT(setUnsavedChanges()));
|
||||||
connect(m_autoTypeUi->sequenceEdit, SIGNAL(textChanged(const 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(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
|
// 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->externalFileRadioButton, SIGNAL(toggled(bool)), this, SLOT(setUnsavedChanges()));
|
||||||
connect(m_sshAgentUi->attachmentComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setUnsavedChanges()));
|
connect(m_sshAgentUi->attachmentComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setUnsavedChanges()));
|
||||||
connect(
|
connect(
|
||||||
m_sshAgentUi->attachmentComboBox, SIGNAL(editTextChanged(const QString&)), this, SLOT(setUnsavedChanges()));
|
m_sshAgentUi->attachmentComboBox, SIGNAL(editTextChanged(QString)), this, SLOT(setUnsavedChanges()));
|
||||||
connect(m_sshAgentUi->externalFileEdit, SIGNAL(textChanged(const 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->addKeyToAgentCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setUnsavedChanges()));
|
||||||
connect(m_sshAgentUi->removeKeyFromAgentCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setUnsavedChanges()));
|
connect(m_sshAgentUi->removeKeyFromAgentCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setUnsavedChanges()));
|
||||||
connect(
|
connect(
|
||||||
@ -1269,13 +1269,13 @@ QMenu* EditEntryWidget::createPresetsMenu()
|
|||||||
QMenu* expirePresetsMenu = new QMenu(this);
|
QMenu* expirePresetsMenu = new QMenu(this);
|
||||||
expirePresetsMenu->addAction(tr("Tomorrow"))->setData(QVariant::fromValue(TimeDelta::fromDays(1)));
|
expirePresetsMenu->addAction(tr("Tomorrow"))->setData(QVariant::fromValue(TimeDelta::fromDays(1)));
|
||||||
expirePresetsMenu->addSeparator();
|
expirePresetsMenu->addSeparator();
|
||||||
expirePresetsMenu->addAction(tr("%n week(s)", 0, 1))->setData(QVariant::fromValue(TimeDelta::fromDays(7)));
|
expirePresetsMenu->addAction(tr("%n week(s)", nullptr, 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)", nullptr, 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, 3))->setData(QVariant::fromValue(TimeDelta::fromDays(21)));
|
||||||
expirePresetsMenu->addSeparator();
|
expirePresetsMenu->addSeparator();
|
||||||
expirePresetsMenu->addAction(tr("%n month(s)", 0, 1))->setData(QVariant::fromValue(TimeDelta::fromMonths(1)));
|
expirePresetsMenu->addAction(tr("%n month(s)", nullptr, 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)", nullptr, 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, 6))->setData(QVariant::fromValue(TimeDelta::fromMonths(6)));
|
||||||
expirePresetsMenu->addSeparator();
|
expirePresetsMenu->addSeparator();
|
||||||
expirePresetsMenu->addAction(tr("%n year(s)", 0, 1))->setData(QVariant::fromValue(TimeDelta::fromYears(1)));
|
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)));
|
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());
|
oldColor = QColor(m_advancedUi->bgColorButton->property("color").toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
QColorDialog colorDialog(this);
|
QColor newColor = QColorDialog::getColor(oldColor);
|
||||||
QColor newColor = colorDialog.getColor(oldColor);
|
|
||||||
if (newColor.isValid()) {
|
if (newColor.isValid()) {
|
||||||
setupColorButton(isForeground, newColor);
|
setupColorButton(isForeground, newColor);
|
||||||
setUnsavedChanges(true);
|
setUnsavedChanges(true);
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
class AttributesListView : public QListView
|
class AttributesListView : public QListView
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit AttributesListView(QWidget* parent = 0)
|
explicit AttributesListView(QWidget* parent = nullptr)
|
||||||
: QListView(parent)
|
: QListView(parent)
|
||||||
{
|
{
|
||||||
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
|
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
|
||||||
|
@ -44,7 +44,7 @@ EntryAttachmentsWidget::EntryAttachmentsWidget(QWidget* parent)
|
|||||||
connect(this, SIGNAL(readOnlyChanged(bool)), SLOT(updateButtonsEnabled()));
|
connect(this, SIGNAL(readOnlyChanged(bool)), SLOT(updateButtonsEnabled()));
|
||||||
connect(m_attachmentsModel, SIGNAL(modelReset()), SLOT(updateButtonsEnabled()));
|
connect(m_attachmentsModel, SIGNAL(modelReset()), SLOT(updateButtonsEnabled()));
|
||||||
connect(m_ui->attachmentsView->selectionModel(),
|
connect(m_ui->attachmentsView->selectionModel(),
|
||||||
SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
|
SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
||||||
SLOT(updateButtonsEnabled()));
|
SLOT(updateButtonsEnabled()));
|
||||||
|
|
||||||
connect(m_ui->attachmentsView, SIGNAL(doubleClicked(QModelIndex)), SLOT(openAttachment(QModelIndex)));
|
connect(m_ui->attachmentsView, SIGNAL(doubleClicked(QModelIndex)), SLOT(openAttachment(QModelIndex)));
|
||||||
|
@ -47,8 +47,8 @@ void EntryAttributesModel::setEntryAttributes(EntryAttributes* entryAttributes)
|
|||||||
connect(m_entryAttributes, SIGNAL(aboutToBeRemoved(QString)), SLOT(attributeAboutToRemove(QString)));
|
connect(m_entryAttributes, SIGNAL(aboutToBeRemoved(QString)), SLOT(attributeAboutToRemove(QString)));
|
||||||
connect(m_entryAttributes, SIGNAL(removed(QString)), SLOT(attributeRemove()));
|
connect(m_entryAttributes, SIGNAL(removed(QString)), SLOT(attributeRemove()));
|
||||||
connect(
|
connect(
|
||||||
m_entryAttributes, SIGNAL(aboutToRename(QString, QString)), SLOT(attributeAboutToRename(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(renamed(QString,QString)), SLOT(attributeRename(QString,QString)));
|
||||||
connect(m_entryAttributes, SIGNAL(aboutToBeReset()), SLOT(aboutToReset()));
|
connect(m_entryAttributes, SIGNAL(aboutToBeReset()), SLOT(aboutToReset()));
|
||||||
connect(m_entryAttributes, SIGNAL(reset()), SLOT(reset()));
|
connect(m_entryAttributes, SIGNAL(reset()), SLOT(reset()));
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ QVariant EntryHistoryModel::data(const QModelIndex& index, int role) const
|
|||||||
|
|
||||||
if (role == Qt::DisplayRole || role == Qt::UserRole) {
|
if (role == Qt::DisplayRole || role == Qt::UserRole) {
|
||||||
Entry* entry = entryFromIndex(index);
|
Entry* entry = entryFromIndex(index);
|
||||||
TimeInfo timeInfo = entry->timeInfo();
|
const TimeInfo& timeInfo = entry->timeInfo();
|
||||||
QDateTime lastModificationLocalTime = timeInfo.lastModificationTime().toLocalTime();
|
QDateTime lastModificationLocalTime = timeInfo.lastModificationTime().toLocalTime();
|
||||||
switch (index.column()) {
|
switch (index.column()) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -208,12 +208,12 @@ QVariant EntryModel::data(const QModelIndex& index, int role) const
|
|||||||
case Attachments: {
|
case Attachments: {
|
||||||
// Display comma-separated list of attachments
|
// Display comma-separated list of attachments
|
||||||
QList<QString> attachments = entry->attachments()->keys();
|
QList<QString> attachments = entry->attachments()->keys();
|
||||||
for (int i = 0; i < attachments.size(); ++i) {
|
for (const auto& attachment : attachments) {
|
||||||
if (result.isEmpty()) {
|
if (result.isEmpty()) {
|
||||||
result.append(attachments.at(i));
|
result.append(attachment);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
result.append(QString(", ") + attachments.at(i));
|
result.append(QString(", ") + attachment);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -331,7 +331,7 @@ QVariant EntryModel::headerData(int section, Qt::Orientation orientation, int ro
|
|||||||
|
|
||||||
Qt::DropActions EntryModel::supportedDropActions() const
|
Qt::DropActions EntryModel::supportedDropActions() const
|
||||||
{
|
{
|
||||||
return 0;
|
return Qt::IgnoreAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::DropActions EntryModel::supportedDragActions() const
|
Qt::DropActions EntryModel::supportedDragActions() const
|
||||||
|
@ -51,7 +51,7 @@ EntryView::EntryView(QWidget* parent)
|
|||||||
|
|
||||||
connect(this, SIGNAL(doubleClicked(QModelIndex)), SLOT(emitEntryActivated(QModelIndex)));
|
connect(this, SIGNAL(doubleClicked(QModelIndex)), SLOT(emitEntryActivated(QModelIndex)));
|
||||||
connect(
|
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(switchedToListMode()), SLOT(switchToListMode()));
|
||||||
connect(m_model, SIGNAL(switchedToSearchMode()), SLOT(switchToSearchMode()));
|
connect(m_model, SIGNAL(switchedToSearchMode()), SLOT(switchToSearchMode()));
|
||||||
connect(m_model, SIGNAL(usernamesHiddenChanged()), SIGNAL(viewStateChanged()));
|
connect(m_model, SIGNAL(usernamesHiddenChanged()), SIGNAL(viewStateChanged()));
|
||||||
@ -97,10 +97,10 @@ EntryView::EntryView(QWidget* parent)
|
|||||||
header()->setContextMenuPolicy(Qt::CustomContextMenu);
|
header()->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
|
||||||
connect(header(), SIGNAL(customContextMenuRequested(QPoint)), SLOT(showHeaderMenu(QPoint)));
|
connect(header(), SIGNAL(customContextMenuRequested(QPoint)), SLOT(showHeaderMenu(QPoint)));
|
||||||
connect(header(), SIGNAL(sectionCountChanged(int, int)), SIGNAL(viewStateChanged()));
|
connect(header(), SIGNAL(sectionCountChanged(int,int)), SIGNAL(viewStateChanged()));
|
||||||
connect(header(), SIGNAL(sectionMoved(int, 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(sectionResized(int,int,int)), SIGNAL(viewStateChanged()));
|
||||||
connect(header(), SIGNAL(sortIndicatorChanged(int, Qt::SortOrder)), SIGNAL(viewStateChanged()));
|
connect(header(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), SIGNAL(viewStateChanged()));
|
||||||
|
|
||||||
resetFixedColumns();
|
resetFixedColumns();
|
||||||
|
|
||||||
|
@ -49,8 +49,8 @@ EditGroupWidget::EditGroupWidget(QWidget* parent)
|
|||||||
connect(this, SIGNAL(rejected()), SLOT(cancel()));
|
connect(this, SIGNAL(rejected()), SLOT(cancel()));
|
||||||
|
|
||||||
connect(m_editGroupWidgetIcons,
|
connect(m_editGroupWidgetIcons,
|
||||||
SIGNAL(messageEditEntry(QString, MessageWidget::MessageType)),
|
SIGNAL(messageEditEntry(QString,MessageWidget::MessageType)),
|
||||||
SLOT(showMessage(QString, MessageWidget::MessageType)));
|
SLOT(showMessage(QString,MessageWidget::MessageType)));
|
||||||
connect(m_editGroupWidgetIcons, SIGNAL(messageEditEntryDismiss()), SLOT(hideMessage()));
|
connect(m_editGroupWidgetIcons, SIGNAL(messageEditEntryDismiss()), SLOT(hideMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,11 +44,11 @@ void GroupModel::changeDatabase(Database* newDb)
|
|||||||
m_db = newDb;
|
m_db = newDb;
|
||||||
|
|
||||||
connect(m_db, SIGNAL(groupDataChanged(Group*)), SLOT(groupDataChanged(Group*)));
|
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(groupAdded()), SLOT(groupAdded()));
|
||||||
connect(m_db, SIGNAL(groupAboutToRemove(Group*)), SLOT(groupAboutToRemove(Group*)));
|
connect(m_db, SIGNAL(groupAboutToRemove(Group*)), SLOT(groupAboutToRemove(Group*)));
|
||||||
connect(m_db, SIGNAL(groupRemoved()), SLOT(groupRemoved()));
|
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()));
|
connect(m_db, SIGNAL(groupMoved()), SLOT(groupMoved()));
|
||||||
|
|
||||||
endResetModel();
|
endResetModel();
|
||||||
|
@ -36,10 +36,10 @@ GroupView::GroupView(Database* db, QWidget* parent)
|
|||||||
|
|
||||||
connect(this, SIGNAL(expanded(QModelIndex)), this, SLOT(expandedChanged(QModelIndex)));
|
connect(this, SIGNAL(expanded(QModelIndex)), this, SLOT(expandedChanged(QModelIndex)));
|
||||||
connect(this, SIGNAL(collapsed(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(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)));
|
connect(this, SIGNAL(clicked(QModelIndex)), SLOT(emitGroupPressed(QModelIndex)));
|
||||||
|
|
||||||
|
@ -38,8 +38,8 @@ KeyComponentWidget::KeyComponentWidget(const QString& name, QWidget* parent)
|
|||||||
|
|
||||||
connect(m_ui->stackedWidget, SIGNAL(currentChanged(int)), SLOT(reset()));
|
connect(m_ui->stackedWidget, SIGNAL(currentChanged(int)), SLOT(reset()));
|
||||||
|
|
||||||
connect(this, SIGNAL(nameChanged(const QString&)), SLOT(updateComponentName(const QString&)));
|
connect(this, SIGNAL(nameChanged(QString)), SLOT(updateComponentName(QString)));
|
||||||
connect(this, SIGNAL(descriptionChanged(const QString&)), SLOT(updateComponentDescription(const QString&)));
|
connect(this, SIGNAL(descriptionChanged(QString)), SLOT(updateComponentDescription(QString)));
|
||||||
connect(this, SIGNAL(componentAddRequested()), SLOT(doAdd()));
|
connect(this, SIGNAL(componentAddRequested()), SLOT(doAdd()));
|
||||||
connect(this, SIGNAL(componentEditRequested()), SLOT(doEdit()));
|
connect(this, SIGNAL(componentEditRequested()), SLOT(doEdit()));
|
||||||
connect(this, SIGNAL(componentRemovalRequested()), SLOT(doRemove()));
|
connect(this, SIGNAL(componentRemovalRequested()), SLOT(doRemove()));
|
||||||
|
@ -107,7 +107,7 @@ void PasswordEditWidget::showPasswordGenerator()
|
|||||||
layout->addWidget(pwGenerator);
|
layout->addWidget(pwGenerator);
|
||||||
|
|
||||||
pwGenerator->setStandaloneMode(false);
|
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()));
|
connect(pwGenerator, SIGNAL(dialogTerminated()), &pwDialog, SLOT(close()));
|
||||||
|
|
||||||
pwGenerator->setPasswordVisible(isPasswordVisible());
|
pwGenerator->setPasswordVisible(isPasswordVisible());
|
||||||
|
@ -75,7 +75,7 @@ QWidget* YubiKeyEditWidget::componentEditWidget()
|
|||||||
#ifdef WITH_XC_YUBIKEY
|
#ifdef WITH_XC_YUBIKEY
|
||||||
connect(m_compUi->buttonRedetectYubikey, SIGNAL(clicked()), SLOT(pollYubikey()));
|
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);
|
connect(YubiKey::instance(), SIGNAL(notFound()), SLOT(noYubikeyFound()), Qt::QueuedConnection);
|
||||||
|
|
||||||
pollYubikey();
|
pollYubikey();
|
||||||
|
@ -153,7 +153,7 @@ bool CompositeKey::challenge(const QByteArray& seed, QByteArray& result) const
|
|||||||
*
|
*
|
||||||
* @param key the key
|
* @param key the key
|
||||||
*/
|
*/
|
||||||
void CompositeKey::addKey(QSharedPointer<Key> key)
|
void CompositeKey::addKey(const QSharedPointer<Key>& key)
|
||||||
{
|
{
|
||||||
m_keys.append(key);
|
m_keys.append(key);
|
||||||
}
|
}
|
||||||
@ -173,7 +173,7 @@ const QList<QSharedPointer<Key>>& CompositeKey::keys() const
|
|||||||
*
|
*
|
||||||
* @param key the key
|
* @param key the key
|
||||||
*/
|
*/
|
||||||
void CompositeKey::addChallengeResponseKey(QSharedPointer<ChallengeResponseKey> key)
|
void CompositeKey::addChallengeResponseKey(const QSharedPointer<ChallengeResponseKey>& key)
|
||||||
{
|
{
|
||||||
m_challengeResponseKeys.append(key);
|
m_challengeResponseKeys.append(key);
|
||||||
}
|
}
|
||||||
|
@ -42,10 +42,10 @@ public:
|
|||||||
Q_REQUIRED_RESULT bool transform(const Kdf& kdf, QByteArray& result) const;
|
Q_REQUIRED_RESULT bool transform(const Kdf& kdf, QByteArray& result) const;
|
||||||
bool challenge(const QByteArray& seed, 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;
|
const QList<QSharedPointer<Key>>& keys() const;
|
||||||
|
|
||||||
void addChallengeResponseKey(QSharedPointer<ChallengeResponseKey> key);\
|
void addChallengeResponseKey(const QSharedPointer<ChallengeResponseKey>& key);\
|
||||||
const QList<QSharedPointer<ChallengeResponseKey>>& challengeResponseKeys() const;
|
const QList<QSharedPointer<ChallengeResponseKey>>& challengeResponseKeys() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user