mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-30 09:46:30 -05:00
Coding style fixes
This commit is contained in:
parent
bb04144fe8
commit
2ff57c2eb7
@ -166,16 +166,18 @@ void ChangeMasterKeyWidget::generateKey()
|
||||
|
||||
#ifdef WITH_XC_YUBIKEY
|
||||
if (m_ui->challengeResponseGroup->isChecked()) {
|
||||
int i = m_ui->comboChallengeResponse->currentIndex();
|
||||
i = m_ui->comboChallengeResponse->itemData(i).toInt();
|
||||
int selectionIndex = m_ui->comboChallengeResponse->currentIndex();
|
||||
int comboPayload = m_ui->comboChallengeResponse->itemData(selectionIndex).toInt();
|
||||
|
||||
if (0 == i) {
|
||||
if (0 == comboPayload) {
|
||||
m_ui->messageWidget->showMessage(tr("Changing master key failed: no YubiKey inserted."),
|
||||
MessageWidget::Error);
|
||||
return;
|
||||
}
|
||||
bool blocking = i & true;
|
||||
int slot = i >> 1;
|
||||
|
||||
// read blocking mode from LSB and slot index number from second LSB
|
||||
bool blocking = comboPayload & 1;
|
||||
int slot = comboPayload >> 1;
|
||||
auto key = QSharedPointer<YkChallengeResponseKey>(new YkChallengeResponseKey(slot, blocking));
|
||||
m_key.addChallengeResponseKey(key);
|
||||
}
|
||||
@ -212,6 +214,7 @@ void ChangeMasterKeyWidget::pollYubikey()
|
||||
void ChangeMasterKeyWidget::yubikeyDetected(int slot, bool blocking)
|
||||
{
|
||||
YkChallengeResponseKey yk(slot, blocking);
|
||||
// add detected YubiKey to combo box and encode blocking mode in LSB, slot number in second LSB
|
||||
m_ui->comboChallengeResponse->addItem(yk.getName(), QVariant((slot << 1) | blocking));
|
||||
m_ui->comboChallengeResponse->setEnabled(m_ui->challengeResponseGroup->isChecked());
|
||||
m_ui->buttonRedetectYubikey->setEnabled(m_ui->challengeResponseGroup->isChecked());
|
||||
|
@ -37,9 +37,9 @@
|
||||
|
||||
|
||||
DatabaseOpenWidget::DatabaseOpenWidget(QWidget* parent)
|
||||
: DialogyWidget(parent),
|
||||
m_ui(new Ui::DatabaseOpenWidget()),
|
||||
m_db(nullptr)
|
||||
: DialogyWidget(parent)
|
||||
, m_ui(new Ui::DatabaseOpenWidget())
|
||||
, m_db(nullptr)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
@ -208,11 +208,12 @@ CompositeKey DatabaseOpenWidget::databaseKey()
|
||||
}
|
||||
|
||||
if (m_ui->checkChallengeResponse->isChecked()) {
|
||||
int i = m_ui->comboChallengeResponse->currentIndex();
|
||||
i = m_ui->comboChallengeResponse->itemData(i).toInt();
|
||||
int selectionIndex = m_ui->comboChallengeResponse->currentIndex();
|
||||
int comboPayload = m_ui->comboChallengeResponse->itemData(selectionIndex).toInt();
|
||||
|
||||
bool blocking = i & true;
|
||||
int slot = i >> 1;
|
||||
// read blocking mode from LSB and slot index number from second LSB
|
||||
bool blocking = comboPayload & 1;
|
||||
int slot = comboPayload >> 1;
|
||||
auto key = QSharedPointer<YkChallengeResponseKey>(new YkChallengeResponseKey(slot, blocking));
|
||||
masterKey.addChallengeResponseKey(key);
|
||||
}
|
||||
@ -267,6 +268,7 @@ void DatabaseOpenWidget::pollYubikey()
|
||||
void DatabaseOpenWidget::yubikeyDetected(int slot, bool blocking)
|
||||
{
|
||||
YkChallengeResponseKey yk(slot, blocking);
|
||||
// add detected YubiKey to combo box and encode blocking mode in LSB, slot number in second LSB
|
||||
m_ui->comboChallengeResponse->addItem(yk.getName(), QVariant((slot << 1) | blocking));
|
||||
m_ui->comboChallengeResponse->setEnabled(true);
|
||||
m_ui->checkChallengeResponse->setEnabled(true);
|
||||
|
Loading…
Reference in New Issue
Block a user