mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-12-04 15:39:34 +01:00
Enhance Password Editing Fields
* Remove repeat password on entry edit * Move show/hide password and password generator buttons into the field as actions. * Register keyboard shortcut Ctrl+H to toggle password visibility * Register keyboard shortcut Ctrl+G to open the password generator * Cleanup code and improve interactions between elements * Simplify Password Generator button layout; convert advanced mode button to toggle button * Update GUI tests * Fixes #4120
This commit is contained in:
@@ -471,17 +471,6 @@ void TestGui::testEditEntry()
|
||||
QCOMPARE(attrTextEdit->toPlainText(), attrText);
|
||||
editEntryWidget->setCurrentPage(0);
|
||||
|
||||
// Test mismatch passwords
|
||||
auto* passwordEdit = editEntryWidget->findChild<QLineEdit*>("passwordEdit");
|
||||
QString originalPassword = passwordEdit->text();
|
||||
passwordEdit->setText("newpass");
|
||||
QTest::mouseClick(okButton, Qt::LeftButton);
|
||||
auto* messageWiget = editEntryWidget->findChild<MessageWidget*>("messageWidget");
|
||||
QTRY_VERIFY(messageWiget->isVisible());
|
||||
QCOMPARE(m_dbWidget->currentMode(), DatabaseWidget::Mode::EditMode);
|
||||
QCOMPARE(passwordEdit->text(), QString("newpass"));
|
||||
passwordEdit->setText(originalPassword);
|
||||
|
||||
// Save the edit (press OK)
|
||||
QTest::mouseClick(okButton, Qt::LeftButton);
|
||||
QApplication::processEvents();
|
||||
@@ -506,7 +495,6 @@ void TestGui::testEditEntry()
|
||||
titleEdit->setText("multiline\ntitle");
|
||||
editEntryWidget->findChild<QComboBox*>("usernameComboBox")->lineEdit()->setText("multiline\nusername");
|
||||
editEntryWidget->findChild<QLineEdit*>("passwordEdit")->setText("multiline\npassword");
|
||||
editEntryWidget->findChild<QLineEdit*>("passwordRepeatEdit")->setText("multiline\npassword");
|
||||
editEntryWidget->findChild<QLineEdit*>("urlEdit")->setText("multiline\nurl");
|
||||
QTest::mouseClick(okButton, Qt::LeftButton);
|
||||
|
||||
@@ -615,9 +603,7 @@ void TestGui::testAddEntry()
|
||||
QTest::keyClicks(usernameComboBox, "Auto");
|
||||
QTest::keyPress(usernameComboBox, Qt::Key_Right);
|
||||
auto* passwordEdit = editEntryWidget->findChild<QLineEdit*>("passwordEdit");
|
||||
auto* passwordRepeatEdit = editEntryWidget->findChild<QLineEdit*>("passwordRepeatEdit");
|
||||
QTest::keyClicks(passwordEdit, "something 2");
|
||||
QTest::keyClicks(passwordRepeatEdit, "something 2");
|
||||
QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Ok), Qt::LeftButton);
|
||||
|
||||
QCOMPARE(m_dbWidget->currentMode(), DatabaseWidget::Mode::ViewMode);
|
||||
@@ -663,8 +649,10 @@ void TestGui::testPasswordEntryEntropy()
|
||||
QTest::keyClicks(titleEdit, "test");
|
||||
|
||||
// Open the password generator
|
||||
auto* generatorButton = editEntryWidget->findChild<QToolButton*>("togglePasswordGeneratorButton");
|
||||
QTest::mouseClick(generatorButton, Qt::LeftButton);
|
||||
auto* passwordEdit = editEntryWidget->findChild<PasswordEdit*>();
|
||||
QVERIFY(passwordEdit);
|
||||
QTest::mouseClick(passwordEdit, Qt::LeftButton);
|
||||
QTest::keyClick(passwordEdit, Qt::Key_G, Qt::ControlModifier);
|
||||
|
||||
// Type in some password
|
||||
auto* editNewPassword = editEntryWidget->findChild<QLineEdit*>("editNewPassword");
|
||||
@@ -735,8 +723,10 @@ void TestGui::testDicewareEntryEntropy()
|
||||
QTest::keyClicks(titleEdit, "test");
|
||||
|
||||
// Open the password generator
|
||||
auto* generatorButton = editEntryWidget->findChild<QToolButton*>("togglePasswordGeneratorButton");
|
||||
QTest::mouseClick(generatorButton, Qt::LeftButton);
|
||||
auto* passwordEdit = editEntryWidget->findChild<PasswordEdit*>();
|
||||
QVERIFY(passwordEdit);
|
||||
QTest::mouseClick(passwordEdit, Qt::LeftButton);
|
||||
QTest::keyClick(passwordEdit, Qt::Key_G, Qt::ControlModifier);
|
||||
|
||||
// Select Diceware
|
||||
auto* tabWidget = editEntryWidget->findChild<QTabWidget*>("tabWidget");
|
||||
@@ -1440,7 +1430,6 @@ int TestGui::addCannedEntries()
|
||||
auto* editEntryWidget = m_dbWidget->findChild<EditEntryWidget*>("editEntryWidget");
|
||||
auto* titleEdit = editEntryWidget->findChild<QLineEdit*>("titleEdit");
|
||||
auto* passwordEdit = editEntryWidget->findChild<QLineEdit*>("passwordEdit");
|
||||
auto* passwordRepeatEdit = editEntryWidget->findChild<QLineEdit*>("passwordRepeatEdit");
|
||||
|
||||
// Add entry "test" and confirm added
|
||||
QTest::mouseClick(entryNewWidget, Qt::LeftButton);
|
||||
@@ -1453,7 +1442,6 @@ int TestGui::addCannedEntries()
|
||||
QTest::mouseClick(entryNewWidget, Qt::LeftButton);
|
||||
QTest::keyClicks(titleEdit, "something 2");
|
||||
QTest::keyClicks(passwordEdit, "something 2");
|
||||
QTest::keyClicks(passwordRepeatEdit, "something 2");
|
||||
QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Ok), Qt::LeftButton);
|
||||
++entries_added;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user