mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Fix key component widget initialization and password field echo mode on database open
This commit is contained in:
parent
cb2900f5a9
commit
f49a8a7f70
@ -185,9 +185,7 @@ void DatabaseOpenWidget::openDatabase()
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_ui->editPassword->isPasswordVisible()) {
|
||||
m_ui->editPassword->setShowPassword(false);
|
||||
}
|
||||
QCoreApplication::processEvents();
|
||||
|
||||
m_db.reset(new Database());
|
||||
@ -369,7 +367,7 @@ void DatabaseOpenWidget::pollYubikey()
|
||||
m_ui->checkChallengeResponse->setChecked(false);
|
||||
m_ui->comboChallengeResponse->setEnabled(false);
|
||||
m_ui->comboChallengeResponse->clear();
|
||||
m_ui->comboChallengeResponse->addItem(tr("-- SELECT --"), -1);
|
||||
m_ui->comboChallengeResponse->addItem(tr("Select slot..."), -1);
|
||||
m_ui->yubikeyProgress->setVisible(true);
|
||||
|
||||
// YubiKey init is slow, detect asynchronously to not block the UI
|
||||
|
@ -37,7 +37,7 @@ KeyComponentWidget::KeyComponentWidget(const QString& name, QWidget* parent)
|
||||
connect(m_ui->removeButton, SIGNAL(clicked(bool)), SIGNAL(componentRemovalRequested()));
|
||||
connect(m_ui->cancelButton, SIGNAL(clicked(bool)), SLOT(cancelEdit()));
|
||||
|
||||
connect(m_ui->stackedWidget, SIGNAL(currentChanged(int)), SLOT(reset()));
|
||||
connect(m_ui->stackedWidget, SIGNAL(currentChanged(int)), SLOT(resetComponentEditWidget()));
|
||||
|
||||
connect(this, SIGNAL(nameChanged(QString)), SLOT(updateComponentName(QString)));
|
||||
connect(this, SIGNAL(descriptionChanged(QString)), SLOT(updateComponentDescription(QString)));
|
||||
@ -46,11 +46,13 @@ KeyComponentWidget::KeyComponentWidget(const QString& name, QWidget* parent)
|
||||
connect(this, SIGNAL(componentRemovalRequested()), SLOT(doRemove()));
|
||||
connect(this, SIGNAL(componentAddChanged(bool)), SLOT(updateAddStatus(bool)));
|
||||
|
||||
blockSignals(true);
|
||||
bool prev = blockSignals(true);
|
||||
setComponentName(name);
|
||||
blockSignals(prev);
|
||||
|
||||
prev = m_ui->stackedWidget->blockSignals(true);
|
||||
m_ui->stackedWidget->setCurrentIndex(Page::AddNew);
|
||||
updateSize();
|
||||
blockSignals(false);
|
||||
m_ui->stackedWidget->blockSignals(prev);
|
||||
}
|
||||
|
||||
KeyComponentWidget::~KeyComponentWidget()
|
||||
@ -164,9 +166,15 @@ void KeyComponentWidget::cancelEdit()
|
||||
emit editCanceled();
|
||||
}
|
||||
|
||||
void KeyComponentWidget::reset()
|
||||
void KeyComponentWidget::showEvent(QShowEvent* event)
|
||||
{
|
||||
if (static_cast<Page>(m_ui->stackedWidget->currentIndex()) == Page::Edit) {
|
||||
QWidget::showEvent(event);
|
||||
resetComponentEditWidget();
|
||||
}
|
||||
|
||||
void KeyComponentWidget::resetComponentEditWidget()
|
||||
{
|
||||
if (m_ui->componentWidgetLayout->isEmpty() || static_cast<Page>(m_ui->stackedWidget->currentIndex()) == Page::Edit) {
|
||||
if (!m_ui->componentWidgetLayout->isEmpty()) {
|
||||
auto* item = m_ui->componentWidgetLayout->takeAt(0);
|
||||
if (item->widget()) {
|
||||
|
@ -109,6 +109,9 @@ signals:
|
||||
void editCanceled();
|
||||
void componentRemovalRequested();
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent* event) override ;
|
||||
|
||||
private slots:
|
||||
void updateComponentName(const QString& name);
|
||||
void updateComponentDescription(const QString& decription);
|
||||
@ -117,7 +120,7 @@ private slots:
|
||||
void doEdit();
|
||||
void doRemove();
|
||||
void cancelEdit();
|
||||
void reset();
|
||||
void resetComponentEditWidget();
|
||||
void updateSize();
|
||||
|
||||
private:
|
||||
|
@ -94,8 +94,11 @@ void PasswordEditWidget::initComponentEditWidget(QWidget* widget)
|
||||
|
||||
void PasswordEditWidget::hideEvent(QHideEvent* event)
|
||||
{
|
||||
Q_ASSERT(m_compUi->enterPasswordEdit);
|
||||
|
||||
if (!isVisible() && m_compUi->enterPasswordEdit) {
|
||||
m_compUi->enterPasswordEdit->setText("");
|
||||
m_compUi->repeatPasswordEdit->setText("");
|
||||
}
|
||||
|
||||
QWidget::hideEvent(event);
|
||||
|
Loading…
Reference in New Issue
Block a user