diff options
author | Jonathan White <support@dmapps.us> | 2021-05-15 16:59:20 +0300 |
---|---|---|
committer | Jonathan White <support@dmapps.us> | 2021-05-30 15:44:09 +0300 |
commit | def08ac1dbfd3403ae0de9401a730175c9306935 (patch) | |
tree | 02933867685e4b8fcebf4c2d156f562e84894a32 | |
parent | b2c636d9c74b048cdcefe846a9e8032af65ab05c (diff) |
Better description text for Key File change dialog
-rw-r--r-- | src/gui/databasekey/KeyFileEditWidget.cpp | 10 | ||||
-rw-r--r-- | src/gui/databasekey/KeyFileEditWidget.ui | 71 | ||||
-rw-r--r-- | tests/gui/TestGui.cpp | 12 |
3 files changed, 47 insertions, 46 deletions
diff --git a/src/gui/databasekey/KeyFileEditWidget.cpp b/src/gui/databasekey/KeyFileEditWidget.cpp index 2fb0b3de2..534bfc8ab 100644 --- a/src/gui/databasekey/KeyFileEditWidget.cpp +++ b/src/gui/databasekey/KeyFileEditWidget.cpp @@ -42,7 +42,7 @@ KeyFileEditWidget::~KeyFileEditWidget() bool KeyFileEditWidget::addToCompositeKey(QSharedPointer<CompositeKey> key) { auto fileKey = QSharedPointer<FileKey>::create(); - QString fileKeyName = m_compUi->keyFileCombo->currentText(); + QString fileKeyName = m_compUi->keyFileLineEdit->text(); if (!fileKey->load(fileKeyName, nullptr)) { return false; } @@ -64,7 +64,7 @@ bool KeyFileEditWidget::validate(QString& errorMessage) const { FileKey fileKey; QString fileKeyError; - QString fileKeyName = m_compUi->keyFileCombo->currentText(); + QString fileKeyName = m_compUi->keyFileLineEdit->text(); if (!fileKey.load(fileKeyName, &fileKeyError)) { errorMessage = tr("Error loading the key file '%1'\nMessage: %2").arg(fileKeyName, fileKeyError); return false; @@ -87,7 +87,7 @@ void KeyFileEditWidget::initComponentEditWidget(QWidget* widget) { Q_UNUSED(widget); Q_ASSERT(m_compEditWidget); - m_compUi->keyFileCombo->setFocus(); + m_compUi->keyFileLineEdit->setFocus(); } void KeyFileEditWidget::createKeyFile() @@ -108,7 +108,7 @@ void KeyFileEditWidget::createKeyFile() tr("Unable to create key file: %1").arg(errorMsg), QMessageBox::Button::Ok); } else { - m_compUi->keyFileCombo->setEditText(fileName); + m_compUi->keyFileLineEdit->setText(fileName); } } } @@ -143,6 +143,6 @@ void KeyFileEditWidget::browseKeyFile() } if (!fileName.isEmpty()) { - m_compUi->keyFileCombo->setEditText(fileName); + m_compUi->keyFileLineEdit->setText(fileName); } } diff --git a/src/gui/databasekey/KeyFileEditWidget.ui b/src/gui/databasekey/KeyFileEditWidget.ui index 088995dc8..3c83a55d3 100644 --- a/src/gui/databasekey/KeyFileEditWidget.ui +++ b/src/gui/databasekey/KeyFileEditWidget.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>370</width> - <height>76</height> + <width>566</width> + <height>94</height> </rect> </property> <layout class="QGridLayout" name="gridLayout"> @@ -23,67 +23,68 @@ <property name="bottomMargin"> <number>0</number> </property> - <item row="0" column="0"> - <widget class="QComboBox" name="keyFileCombo"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> + <item row="0" column="1"> + <widget class="QPushButton" name="createKeyFileButton"> <property name="accessibleName"> - <string>Key file selection</string> + <string>Generate a new key file</string> </property> - <property name="editable"> - <bool>true</bool> + <property name="text"> + <string>Generate</string> </property> </widget> </item> - <item row="0" column="1"> - <widget class="QPushButton" name="browseKeyFileButton"> - <property name="accessibleName"> - <string>Browse for key file</string> - </property> + <item row="0" column="0"> + <widget class="QLabel" name="instructions"> <property name="text"> - <string>Browse...</string> + <string>Generate a new key file or choose an existing one to protect your database.</string> + </property> + <property name="wordWrap"> + <bool>true</bool> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QPushButton" name="createKeyFileButton"> - <property name="accessibleName"> - <string>Generate a new key file</string> + <item row="3" column="0"> + <widget class="QLabel" name="instructions_2"> + <property name="font"> + <font> + <italic>true</italic> + </font> </property> <property name="text"> - <string>Generate</string> + <string>Note: Do NOT use a file that may change as that will prevent you from unlocking your database.</string> + </property> + <property name="wordWrap"> + <bool>true</bool> </property> </widget> </item> - <item row="2" column="0"> + <item row="4" column="0"> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> </property> <property name="sizeHint" stdset="0"> <size> - <width>20</width> + <width>0</width> <height>0</height> </size> </property> </spacer> </item> <item row="1" column="0"> - <widget class="QLabel" name="label"> - <property name="font"> - <font> - <italic>true</italic> - </font> + <widget class="QLineEdit" name="keyFileLineEdit"> + <property name="clearButtonEnabled"> + <bool>true</bool> </property> - <property name="text"> - <string>Note: Do not use a file that may change as that will prevent you from unlocking your database!</string> + </widget> + </item> + <item row="1" column="1"> + <widget class="QPushButton" name="browseKeyFileButton"> + <property name="accessibleName"> + <string>Browse for key file</string> </property> - <property name="wordWrap"> - <bool>true</bool> + <property name="text"> + <string>Browse…</string> </property> </widget> </item> diff --git a/tests/gui/TestGui.cpp b/tests/gui/TestGui.cpp index 2463f13f6..65ca319bc 100644 --- a/tests/gui/TestGui.cpp +++ b/tests/gui/TestGui.cpp @@ -279,15 +279,15 @@ void TestGui::testCreateDatabase() QTRY_VERIFY(!additionalOptionsButton->isVisible()); QCOMPARE(passwordWidget->visiblePage(), KeyFileEditWidget::Page::Edit); QTest::mouseClick(keyFileWidget->findChild<QPushButton*>("addButton"), Qt::MouseButton::LeftButton); - auto* fileCombo = keyFileWidget->findChild<QComboBox*>("keyFileCombo"); - QTRY_VERIFY(fileCombo); - QTRY_VERIFY(fileCombo->isVisible()); + auto* fileEdit = keyFileWidget->findChild<QLineEdit*>("keyFileLineEdit"); + QTRY_VERIFY(fileEdit); + QTRY_VERIFY(fileEdit->isVisible()); fileDialog()->setNextFileName(QString("%1/%2").arg(QString(KEEPASSX_TEST_DATA_DIR), "FileKeyHashed.key")); QTest::keyClick(keyFileWidget->findChild<QPushButton*>("addButton"), Qt::Key::Key_Enter); - QVERIFY(fileCombo->hasFocus()); + QVERIFY(fileEdit->hasFocus()); auto* browseButton = keyFileWidget->findChild<QPushButton*>("browseKeyFileButton"); QTest::keyClick(browseButton, Qt::Key::Key_Enter); - QCOMPARE(fileCombo->currentText(), QString("%1/%2").arg(QString(KEEPASSX_TEST_DATA_DIR), "FileKeyHashed.key")); + QCOMPARE(fileEdit->text(), QString("%1/%2").arg(QString(KEEPASSX_TEST_DATA_DIR), "FileKeyHashed.key")); // save database to temporary file TemporaryFile tmpFile; @@ -295,7 +295,7 @@ void TestGui::testCreateDatabase() tmpFile.close(); fileDialog()->setNextFileName(tmpFile.fileName()); - QTest::keyClick(fileCombo, Qt::Key::Key_Enter); + QTest::keyClick(fileEdit, Qt::Key::Key_Enter); tmpFile.remove();); triggerAction("actionDatabaseNew"); |