Change settings checkbox texts to positive phrasing (#4715)

This commit is contained in:
ameyer0 2020-05-10 21:35:08 -04:00 committed by GitHub
parent dcff507e02
commit 560209550c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 133 additions and 36 deletions

View File

@ -73,7 +73,7 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
{Config::AutoTypeStartDelay,{QS("AutoTypeStartDelay"), Roaming, 500}}, {Config::AutoTypeStartDelay,{QS("AutoTypeStartDelay"), Roaming, 500}},
{Config::GlobalAutoTypeKey,{QS("GlobalAutoTypeKey"), Roaming, 0}}, {Config::GlobalAutoTypeKey,{QS("GlobalAutoTypeKey"), Roaming, 0}},
{Config::GlobalAutoTypeModifiers,{QS("GlobalAutoTypeModifiers"), Roaming, 0}}, {Config::GlobalAutoTypeModifiers,{QS("GlobalAutoTypeModifiers"), Roaming, 0}},
{Config::IgnoreGroupExpansion,{QS("IgnoreGroupExpansion"), Roaming, true}}, {Config::TrackNonDataChanges,{QS("TrackNonDataChanges"), Roaming, false}},
{Config::FaviconDownloadTimeout,{QS("FaviconDownloadTimeout"), Roaming, 10}}, {Config::FaviconDownloadTimeout,{QS("FaviconDownloadTimeout"), Roaming, 10}},
{Config::UpdateCheckMessageShown,{QS("UpdateCheckMessageShown"), Roaming, true}}, {Config::UpdateCheckMessageShown,{QS("UpdateCheckMessageShown"), Roaming, true}},
{Config::UseTouchID,{QS("UseTouchID"), Roaming, false}}, {Config::UseTouchID,{QS("UseTouchID"), Roaming, false}},
@ -125,9 +125,9 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
{Config::Security_LockDatabaseMinimize, {QS("Security/LockDatabaseMinimize"), Roaming, false}}, {Config::Security_LockDatabaseMinimize, {QS("Security/LockDatabaseMinimize"), Roaming, false}},
{Config::Security_LockDatabaseScreenLock, {QS("Security/LockDatabaseScreenLock"), Roaming, true}}, {Config::Security_LockDatabaseScreenLock, {QS("Security/LockDatabaseScreenLock"), Roaming, true}},
{Config::Security_RelockAutoType, {QS("Security/RelockAutoType"), Roaming, false}}, {Config::Security_RelockAutoType, {QS("Security/RelockAutoType"), Roaming, false}},
{Config::Security_PasswordsRepeat, {QS("Security/PasswordsRepeat"), Roaming, false}}, {Config::Security_PasswordsRepeatVisible, {QS("Security/PasswordsRepeatVisible"), Roaming, true}},
{Config::Security_PasswordsCleartext, {QS("Security/PasswordsCleartext"), Roaming, false}}, {Config::Security_PasswordsHidden, {QS("Security/PasswordsHidden"), Roaming, true}},
{Config::Security_PasswordEmptyNoDots, {QS("Security/PasswordEmptyNoDots"), Roaming, true}}, {Config::Security_PasswordEmptyPlaceholder, {QS("Security/PasswordEmptyPlaceholder"), Roaming, false}},
{Config::Security_HidePasswordPreviewPanel, {QS("Security/HidePasswordPreviewPanel"), Roaming, true}}, {Config::Security_HidePasswordPreviewPanel, {QS("Security/HidePasswordPreviewPanel"), Roaming, true}},
{Config::Security_AutoTypeAsk, {QS("Security/AutotypeAsk"), Roaming, true}}, {Config::Security_AutoTypeAsk, {QS("Security/AutotypeAsk"), Roaming, true}},
{Config::Security_IconDownloadFallback, {QS("Security/IconDownloadFallback"), Roaming, false}}, {Config::Security_IconDownloadFallback, {QS("Security/IconDownloadFallback"), Roaming, false}},
@ -290,6 +290,7 @@ static const QHash<QString, Config::ConfigKey> deprecationMap = {
{QS("security/IconDownloadFallbackToGoogle"), Config::Security_IconDownloadFallback}, {QS("security/IconDownloadFallbackToGoogle"), Config::Security_IconDownloadFallback},
// 2.6.0 // 2.6.0
{QS("IgnoreGroupExpansion"), Config::TrackNonDataChanges},
{QS("security/autotypeask"), Config::Security_AutoTypeAsk}, {QS("security/autotypeask"), Config::Security_AutoTypeAsk},
{QS("security/clearclipboard"), Config::Security_ClearClipboard}, {QS("security/clearclipboard"), Config::Security_ClearClipboard},
{QS("security/clearclipboardtimeout"), Config::Security_ClearClipboardTimeout}, {QS("security/clearclipboardtimeout"), Config::Security_ClearClipboardTimeout},
@ -301,10 +302,10 @@ static const QHash<QString, Config::ConfigKey> deprecationMap = {
{QS("security/lockdatabasescreenlock"), Config::Security_LockDatabaseScreenLock}, {QS("security/lockdatabasescreenlock"), Config::Security_LockDatabaseScreenLock},
{QS("security/relockautotype"), Config::Security_RelockAutoType}, {QS("security/relockautotype"), Config::Security_RelockAutoType},
{QS("security/IconDownloadFallback"), Config::Security_IconDownloadFallback}, {QS("security/IconDownloadFallback"), Config::Security_IconDownloadFallback},
{QS("security/passwordscleartext"), Config::Security_PasswordsCleartext}, {QS("security/passwordscleartext"), Config::Security_PasswordsHidden},
{QS("security/passwordemptynodots"), Config::Security_PasswordEmptyNoDots}, {QS("security/passwordemptynodots"), Config::Security_PasswordEmptyPlaceholder},
{QS("security/HidePasswordPreviewPanel"), Config::Security_HidePasswordPreviewPanel}, {QS("security/HidePasswordPreviewPanel"), Config::Security_HidePasswordPreviewPanel},
{QS("security/passwordsrepeat"), Config::Security_PasswordsRepeat}, {QS("security/passwordsrepeat"), Config::Security_PasswordsRepeatVisible},
{QS("security/hidenotes"), Config::Security_HideNotes}, {QS("security/hidenotes"), Config::Security_HideNotes},
{QS("security/resettouchid"), Config::Security_ResetTouchId}, {QS("security/resettouchid"), Config::Security_ResetTouchId},
{QS("security/resettouchidtimeout"), Config::Security_ResetTouchIdTimeout}, {QS("security/resettouchidtimeout"), Config::Security_ResetTouchIdTimeout},
@ -353,7 +354,13 @@ void Config::migrate()
for (const auto& setting : deprecationMap.keys()) { for (const auto& setting : deprecationMap.keys()) {
QVariant value; QVariant value;
if (m_settings->contains(setting)) { if (m_settings->contains(setting)) {
if (setting == QS("IgnoreGroupExpansion") || setting == QS("security/passwordsrepeat")
|| setting == QS("security/passwordscleartext") || setting == QS("security/passwordemptynodots")) {
// Keep user's original setting for boolean settings whose meanings were reversed
value = !m_settings->value(setting).toBool();
} else {
value = m_settings->value(setting); value = m_settings->value(setting);
}
m_settings->remove(setting); m_settings->remove(setting);
} else if (m_localSettings && m_localSettings->contains(setting)) { } else if (m_localSettings && m_localSettings->contains(setting)) {
value = m_localSettings->value(setting); value = m_localSettings->value(setting);

View File

@ -57,7 +57,7 @@ public:
AutoTypeStartDelay, AutoTypeStartDelay,
GlobalAutoTypeKey, GlobalAutoTypeKey,
GlobalAutoTypeModifiers, GlobalAutoTypeModifiers,
IgnoreGroupExpansion, TrackNonDataChanges,
FaviconDownloadTimeout, FaviconDownloadTimeout,
UpdateCheckMessageShown, UpdateCheckMessageShown,
UseTouchID, UseTouchID,
@ -107,9 +107,9 @@ public:
Security_LockDatabaseMinimize, Security_LockDatabaseMinimize,
Security_LockDatabaseScreenLock, Security_LockDatabaseScreenLock,
Security_RelockAutoType, Security_RelockAutoType,
Security_PasswordsRepeat, Security_PasswordsRepeatVisible,
Security_PasswordsCleartext, Security_PasswordsHidden,
Security_PasswordEmptyNoDots, Security_PasswordEmptyPlaceholder,
Security_HidePasswordPreviewPanel, Security_HidePasswordPreviewPanel,
Security_AutoTypeAsk, Security_AutoTypeAsk,
Security_IconDownloadFallback, Security_IconDownloadFallback,

View File

@ -364,7 +364,7 @@ void Group::setExpanded(bool expanded)
{ {
if (m_data.isExpanded != expanded) { if (m_data.isExpanded != expanded) {
m_data.isExpanded = expanded; m_data.isExpanded = expanded;
if (config()->get(Config::IgnoreGroupExpansion).toBool()) { if (!config()->get(Config::TrackNonDataChanges).toBool()) {
updateTimeinfo(); updateTimeinfo();
return; return;
} }

View File

@ -196,7 +196,7 @@ void ApplicationSettingsWidget::loadSettings()
config()->get(Config::UseGroupIconOnEntryCreation).toBool()); config()->get(Config::UseGroupIconOnEntryCreation).toBool());
m_generalUi->autoTypeEntryTitleMatchCheckBox->setChecked(config()->get(Config::AutoTypeEntryTitleMatch).toBool()); m_generalUi->autoTypeEntryTitleMatchCheckBox->setChecked(config()->get(Config::AutoTypeEntryTitleMatch).toBool());
m_generalUi->autoTypeEntryURLMatchCheckBox->setChecked(config()->get(Config::AutoTypeEntryURLMatch).toBool()); m_generalUi->autoTypeEntryURLMatchCheckBox->setChecked(config()->get(Config::AutoTypeEntryURLMatch).toBool());
m_generalUi->ignoreGroupExpansionCheckBox->setChecked(config()->get(Config::IgnoreGroupExpansion).toBool()); m_generalUi->trackNonDataChangesCheckBox->setChecked(config()->get(Config::TrackNonDataChanges).toBool());
m_generalUi->faviconTimeoutSpinBox->setValue(config()->get(Config::FaviconDownloadTimeout).toInt()); m_generalUi->faviconTimeoutSpinBox->setValue(config()->get(Config::FaviconDownloadTimeout).toInt());
if (!m_generalUi->hideWindowOnCopyCheckBox->isChecked()) { if (!m_generalUi->hideWindowOnCopyCheckBox->isChecked()) {
@ -274,11 +274,12 @@ void ApplicationSettingsWidget::loadSettings()
m_secUi->relockDatabaseAutoTypeCheckBox->setChecked(config()->get(Config::Security_RelockAutoType).toBool()); m_secUi->relockDatabaseAutoTypeCheckBox->setChecked(config()->get(Config::Security_RelockAutoType).toBool());
m_secUi->fallbackToSearch->setChecked(config()->get(Config::Security_IconDownloadFallback).toBool()); m_secUi->fallbackToSearch->setChecked(config()->get(Config::Security_IconDownloadFallback).toBool());
m_secUi->passwordCleartextCheckBox->setChecked(config()->get(Config::Security_PasswordsCleartext).toBool()); m_secUi->passwordsHiddenCheckBox->setChecked(config()->get(Config::Security_PasswordsHidden).toBool());
m_secUi->passwordShowDotsCheckBox->setChecked(config()->get(Config::Security_PasswordEmptyNoDots).toBool()); m_secUi->passwordShowDotsCheckBox->setChecked(config()->get(Config::Security_PasswordEmptyPlaceholder).toBool());
m_secUi->passwordPreviewCleartextCheckBox->setChecked( m_secUi->passwordPreviewCleartextCheckBox->setChecked(
config()->get(Config::Security_HidePasswordPreviewPanel).toBool()); config()->get(Config::Security_HidePasswordPreviewPanel).toBool());
m_secUi->passwordRepeatCheckBox->setChecked(config()->get(Config::Security_PasswordsRepeat).toBool()); m_secUi->passwordsRepeatVisibleCheckBox->setChecked(
config()->get(Config::Security_PasswordsRepeatVisible).toBool());
m_secUi->hideNotesCheckBox->setChecked(config()->get(Config::Security_HideNotes).toBool()); m_secUi->hideNotesCheckBox->setChecked(config()->get(Config::Security_HideNotes).toBool());
m_secUi->touchIDResetCheckBox->setChecked(config()->get(Config::Security_ResetTouchId).toBool()); m_secUi->touchIDResetCheckBox->setChecked(config()->get(Config::Security_ResetTouchId).toBool());
@ -322,7 +323,7 @@ void ApplicationSettingsWidget::saveSettings()
config()->set(Config::MinimizeOnCopy, m_generalUi->minimizeOnCopyRadioButton->isChecked()); config()->set(Config::MinimizeOnCopy, m_generalUi->minimizeOnCopyRadioButton->isChecked());
config()->set(Config::DropToBackgroundOnCopy, m_generalUi->dropToBackgroundOnCopyRadioButton->isChecked()); config()->set(Config::DropToBackgroundOnCopy, m_generalUi->dropToBackgroundOnCopyRadioButton->isChecked());
config()->set(Config::UseGroupIconOnEntryCreation, m_generalUi->useGroupIconOnEntryCreationCheckBox->isChecked()); config()->set(Config::UseGroupIconOnEntryCreation, m_generalUi->useGroupIconOnEntryCreationCheckBox->isChecked());
config()->set(Config::IgnoreGroupExpansion, m_generalUi->ignoreGroupExpansionCheckBox->isChecked()); config()->set(Config::TrackNonDataChanges, m_generalUi->trackNonDataChangesCheckBox->isChecked());
config()->set(Config::AutoTypeEntryTitleMatch, m_generalUi->autoTypeEntryTitleMatchCheckBox->isChecked()); config()->set(Config::AutoTypeEntryTitleMatch, m_generalUi->autoTypeEntryTitleMatchCheckBox->isChecked());
config()->set(Config::AutoTypeEntryURLMatch, m_generalUi->autoTypeEntryURLMatchCheckBox->isChecked()); config()->set(Config::AutoTypeEntryURLMatch, m_generalUi->autoTypeEntryURLMatchCheckBox->isChecked());
config()->set(Config::FaviconDownloadTimeout, m_generalUi->faviconTimeoutSpinBox->value()); config()->set(Config::FaviconDownloadTimeout, m_generalUi->faviconTimeoutSpinBox->value());
@ -369,11 +370,11 @@ void ApplicationSettingsWidget::saveSettings()
config()->set(Config::Security_RelockAutoType, m_secUi->relockDatabaseAutoTypeCheckBox->isChecked()); config()->set(Config::Security_RelockAutoType, m_secUi->relockDatabaseAutoTypeCheckBox->isChecked());
config()->set(Config::Security_IconDownloadFallback, m_secUi->fallbackToSearch->isChecked()); config()->set(Config::Security_IconDownloadFallback, m_secUi->fallbackToSearch->isChecked());
config()->set(Config::Security_PasswordsCleartext, m_secUi->passwordCleartextCheckBox->isChecked()); config()->set(Config::Security_PasswordsHidden, m_secUi->passwordsHiddenCheckBox->isChecked());
config()->set(Config::Security_PasswordEmptyNoDots, m_secUi->passwordShowDotsCheckBox->isChecked()); config()->set(Config::Security_PasswordEmptyPlaceholder, m_secUi->passwordShowDotsCheckBox->isChecked());
config()->set(Config::Security_HidePasswordPreviewPanel, m_secUi->passwordPreviewCleartextCheckBox->isChecked()); config()->set(Config::Security_HidePasswordPreviewPanel, m_secUi->passwordPreviewCleartextCheckBox->isChecked());
config()->set(Config::Security_PasswordsRepeat, m_secUi->passwordRepeatCheckBox->isChecked()); config()->set(Config::Security_PasswordsRepeatVisible, m_secUi->passwordsRepeatVisibleCheckBox->isChecked());
config()->set(Config::Security_HideNotes, m_secUi->hideNotesCheckBox->isChecked()); config()->set(Config::Security_HideNotes, m_secUi->hideNotesCheckBox->isChecked());
config()->set(Config::Security_ResetTouchId, m_secUi->touchIDResetCheckBox->isChecked()); config()->set(Config::Security_ResetTouchId, m_secUi->touchIDResetCheckBox->isChecked());

View File

@ -6,6 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>559</width>
<height>1280</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_3">
@ -228,9 +230,9 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="ignoreGroupExpansionCheckBox"> <widget class="QCheckBox" name="trackNonDataChangesCheckBox">
<property name="text"> <property name="text">
<string>Don't mark database as modified for non-data changes (e.g., expanding groups)</string> <string>Mark database as modified for non-data changes (e.g., expanding groups)</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>595</width> <width>595</width>
<height>541</height> <height>567</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
@ -223,23 +223,23 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="passwordRepeatCheckBox"> <widget class="QCheckBox" name="passwordsRepeatVisibleCheckBox">
<property name="text"> <property name="text">
<string>Don't require password repeat when it is visible</string> <string>Require password repeat when it is visible</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="passwordCleartextCheckBox"> <widget class="QCheckBox" name="passwordsHiddenCheckBox">
<property name="text"> <property name="text">
<string>Don't hide passwords when editing them</string> <string>Hide passwords when editing them</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="passwordShowDotsCheckBox"> <widget class="QCheckBox" name="passwordShowDotsCheckBox">
<property name="text"> <property name="text">
<string>Don't use placeholder for empty password fields</string> <string>Use placeholder for empty password fields</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -302,8 +302,8 @@
<tabstop>touchIDResetOnScreenLockCheckBox</tabstop> <tabstop>touchIDResetOnScreenLockCheckBox</tabstop>
<tabstop>lockDatabaseMinimizeCheckBox</tabstop> <tabstop>lockDatabaseMinimizeCheckBox</tabstop>
<tabstop>relockDatabaseAutoTypeCheckBox</tabstop> <tabstop>relockDatabaseAutoTypeCheckBox</tabstop>
<tabstop>passwordRepeatCheckBox</tabstop> <tabstop>passwordsRepeatVisibleCheckBox</tabstop>
<tabstop>passwordCleartextCheckBox</tabstop> <tabstop>passwordsHiddenCheckBox</tabstop>
<tabstop>passwordShowDotsCheckBox</tabstop> <tabstop>passwordShowDotsCheckBox</tabstop>
<tabstop>passwordPreviewCleartextCheckBox</tabstop> <tabstop>passwordPreviewCleartextCheckBox</tabstop>
<tabstop>hideNotesCheckBox</tabstop> <tabstop>hideNotesCheckBox</tabstop>

View File

@ -186,7 +186,7 @@ void EntryPreviewWidget::setPasswordVisible(bool state)
if (state) { if (state) {
m_ui->entryPasswordLabel->setText(password); m_ui->entryPasswordLabel->setText(password);
m_ui->entryPasswordLabel->setCursorPosition(0); m_ui->entryPasswordLabel->setCursorPosition(0);
} else if (password.isEmpty() && config()->get(Config::Security_PasswordEmptyNoDots).toBool()) { } else if (password.isEmpty() && !config()->get(Config::Security_PasswordEmptyPlaceholder).toBool()) {
m_ui->entryPasswordLabel->setText(""); m_ui->entryPasswordLabel->setText("");
} else { } else {
m_ui->entryPasswordLabel->setText(QString("\u25cf").repeated(6)); m_ui->entryPasswordLabel->setText(QString("\u25cf").repeated(6));

View File

@ -111,7 +111,7 @@ void PasswordEdit::setShowPassword(bool show)
if (m_repeatPasswordEdit) { if (m_repeatPasswordEdit) {
m_repeatPasswordEdit->setEchoMode(show ? QLineEdit::Normal : QLineEdit::Password); m_repeatPasswordEdit->setEchoMode(show ? QLineEdit::Normal : QLineEdit::Password);
if (config()->get(Config::Security_PasswordsRepeat).toBool()) { if (!config()->get(Config::Security_PasswordsRepeatVisible).toBool()) {
m_repeatPasswordEdit->setEnabled(!show); m_repeatPasswordEdit->setEnabled(!show);
m_repeatPasswordEdit->setText(text()); m_repeatPasswordEdit->setText(text());
} else { } else {
@ -166,7 +166,7 @@ void PasswordEdit::updateRepeatStatus()
void PasswordEdit::autocompletePassword(const QString& password) void PasswordEdit::autocompletePassword(const QString& password)
{ {
if (config()->get(Config::Security_PasswordsRepeat).toBool() && echoMode() == QLineEdit::Normal) { if (!config()->get(Config::Security_PasswordsRepeatVisible).toBool() && echoMode() == QLineEdit::Normal) {
setText(password); setText(password);
} }
} }

View File

@ -844,7 +844,7 @@ void EditEntryWidget::setForms(Entry* entry, bool restore)
m_mainUi->usernameComboBox->lineEdit()->setText(entry->username()); m_mainUi->usernameComboBox->lineEdit()->setText(entry->username());
m_mainUi->urlEdit->setText(entry->url()); m_mainUi->urlEdit->setText(entry->url());
m_mainUi->passwordEdit->setText(entry->password()); m_mainUi->passwordEdit->setText(entry->password());
m_mainUi->passwordEdit->setShowPassword(config()->get(Config::Security_PasswordsCleartext).toBool()); m_mainUi->passwordEdit->setShowPassword(!config()->get(Config::Security_PasswordsHidden).toBool());
if (!m_history) { if (!m_history) {
m_mainUi->passwordEdit->enablePasswordGenerator(); m_mainUi->passwordEdit->enablePasswordGenerator();
} }

View File

@ -174,7 +174,7 @@ QVariant EntryModel::data(const QModelIndex& index, int role) const
if (attr->isReference(EntryAttributes::PasswordKey)) { if (attr->isReference(EntryAttributes::PasswordKey)) {
result.prepend(tr("Ref: ", "Reference abbreviation")); result.prepend(tr("Ref: ", "Reference abbreviation"));
} }
if (entry->password().isEmpty() && config()->get(Config::Security_PasswordEmptyNoDots).toBool()) { if (entry->password().isEmpty() && !config()->get(Config::Security_PasswordEmptyPlaceholder).toBool()) {
result = ""; result = "";
} }
return result; return result;

View File

@ -222,6 +222,9 @@ add_unit_test(NAME testdatabase SOURCES TestDatabase.cpp
add_unit_test(NAME testtools SOURCES TestTools.cpp add_unit_test(NAME testtools SOURCES TestTools.cpp
LIBS ${TEST_LIBRARIES}) LIBS ${TEST_LIBRARIES})
add_unit_test(NAME testconfig SOURCES TestConfig.cpp
LIBS testsupport ${TEST_LIBRARIES})
if(WITH_XC_FDOSECRETS) if(WITH_XC_FDOSECRETS)
add_unit_test(NAME testfdosecrets SOURCES TestFdoSecrets.cpp add_unit_test(NAME testfdosecrets SOURCES TestFdoSecrets.cpp
LIBS testsupport ${TEST_LIBRARIES}) LIBS testsupport ${TEST_LIBRARIES})

46
tests/TestConfig.cpp Normal file
View File

@ -0,0 +1,46 @@
/*
* Copyright (C) 2020 KeePassXC Team <team@keepassxc.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 or (at your option)
* version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "TestConfig.h"
#include <QList>
#include <QTest>
#include "config-keepassx-tests.h"
#include "core/Config.h"
#include "util/TemporaryFile.h"
QTEST_GUILESS_MAIN(TestConfig)
const QString oldTrueConfigPath = QString(KEEPASSX_TEST_DATA_DIR).append("/OutdatedConfig.ini");
// upgrade config file with deprecated settings (all of which are set to non-default values)
void TestConfig::testUpgrade()
{
TemporaryFile tempFile;
QVERIFY(tempFile.copyFromFile(oldTrueConfigPath));
Config::createConfigFromFile(tempFile.fileName());
// value of new setting should be opposite the value of deprecated setting
QVERIFY(config()->get(Config::TrackNonDataChanges).toBool());
QVERIFY(!config()->get(Config::Security_PasswordsRepeatVisible).toBool());
QVERIFY(!config()->get(Config::Security_PasswordsHidden).toBool());
QVERIFY(config()->get(Config::Security_PasswordEmptyPlaceholder).toBool());
tempFile.remove();
}

30
tests/TestConfig.h Normal file
View File

@ -0,0 +1,30 @@
/*
* Copyright (C) 2020 KeePassXC Team <team@keepassxc.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 or (at your option)
* version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KEEPASSX_TESTCONFIG_H
#define KEEPASSX_TESTCONFIG_H
#include "core/Config.h"
class TestConfig : public QObject
{
Q_OBJECT
private slots:
void testUpgrade();
};
#endif // KEEPASSX_TESTCONFIG_H

View File

@ -0,0 +1,8 @@
[General]
IgnoreGroupExpansion=false
[security]
hidepassworddetails=false
passwordemptynodots=false
passwordscleartext=true
passwordsrepeat=true