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