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::GlobalAutoTypeKey,{QS("GlobalAutoTypeKey"), 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::UpdateCheckMessageShown,{QS("UpdateCheckMessageShown"), Roaming, true}},
{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_LockDatabaseScreenLock, {QS("Security/LockDatabaseScreenLock"), Roaming, true}},
{Config::Security_RelockAutoType, {QS("Security/RelockAutoType"), Roaming, false}},
{Config::Security_PasswordsRepeat, {QS("Security/PasswordsRepeat"), Roaming, false}},
{Config::Security_PasswordsCleartext, {QS("Security/PasswordsCleartext"), Roaming, false}},
{Config::Security_PasswordEmptyNoDots, {QS("Security/PasswordEmptyNoDots"), Roaming, true}},
{Config::Security_PasswordsRepeatVisible, {QS("Security/PasswordsRepeatVisible"), Roaming, true}},
{Config::Security_PasswordsHidden, {QS("Security/PasswordsHidden"), Roaming, true}},
{Config::Security_PasswordEmptyPlaceholder, {QS("Security/PasswordEmptyPlaceholder"), Roaming, false}},
{Config::Security_HidePasswordPreviewPanel, {QS("Security/HidePasswordPreviewPanel"), Roaming, true}},
{Config::Security_AutoTypeAsk, {QS("Security/AutotypeAsk"), Roaming, true}},
{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},
// 2.6.0
{QS("IgnoreGroupExpansion"), Config::TrackNonDataChanges},
{QS("security/autotypeask"), Config::Security_AutoTypeAsk},
{QS("security/clearclipboard"), Config::Security_ClearClipboard},
{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/relockautotype"), Config::Security_RelockAutoType},
{QS("security/IconDownloadFallback"), Config::Security_IconDownloadFallback},
{QS("security/passwordscleartext"), Config::Security_PasswordsCleartext},
{QS("security/passwordemptynodots"), Config::Security_PasswordEmptyNoDots},
{QS("security/passwordscleartext"), Config::Security_PasswordsHidden},
{QS("security/passwordemptynodots"), Config::Security_PasswordEmptyPlaceholder},
{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/resettouchid"), Config::Security_ResetTouchId},
{QS("security/resettouchidtimeout"), Config::Security_ResetTouchIdTimeout},
@ -353,7 +354,13 @@ void Config::migrate()
for (const auto& setting : deprecationMap.keys()) {
QVariant value;
if (m_settings->contains(setting)) {
value = m_settings->value(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);
}
m_settings->remove(setting);
} else if (m_localSettings && m_localSettings->contains(setting)) {
value = m_localSettings->value(setting);

View File

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

View File

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

View File

@ -196,7 +196,7 @@ void ApplicationSettingsWidget::loadSettings()
config()->get(Config::UseGroupIconOnEntryCreation).toBool());
m_generalUi->autoTypeEntryTitleMatchCheckBox->setChecked(config()->get(Config::AutoTypeEntryTitleMatch).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());
if (!m_generalUi->hideWindowOnCopyCheckBox->isChecked()) {
@ -274,11 +274,12 @@ void ApplicationSettingsWidget::loadSettings()
m_secUi->relockDatabaseAutoTypeCheckBox->setChecked(config()->get(Config::Security_RelockAutoType).toBool());
m_secUi->fallbackToSearch->setChecked(config()->get(Config::Security_IconDownloadFallback).toBool());
m_secUi->passwordCleartextCheckBox->setChecked(config()->get(Config::Security_PasswordsCleartext).toBool());
m_secUi->passwordShowDotsCheckBox->setChecked(config()->get(Config::Security_PasswordEmptyNoDots).toBool());
m_secUi->passwordsHiddenCheckBox->setChecked(config()->get(Config::Security_PasswordsHidden).toBool());
m_secUi->passwordShowDotsCheckBox->setChecked(config()->get(Config::Security_PasswordEmptyPlaceholder).toBool());
m_secUi->passwordPreviewCleartextCheckBox->setChecked(
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->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::DropToBackgroundOnCopy, m_generalUi->dropToBackgroundOnCopyRadioButton->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::AutoTypeEntryURLMatch, m_generalUi->autoTypeEntryURLMatchCheckBox->isChecked());
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_IconDownloadFallback, m_secUi->fallbackToSearch->isChecked());
config()->set(Config::Security_PasswordsCleartext, m_secUi->passwordCleartextCheckBox->isChecked());
config()->set(Config::Security_PasswordEmptyNoDots, m_secUi->passwordShowDotsCheckBox->isChecked());
config()->set(Config::Security_PasswordsHidden, m_secUi->passwordsHiddenCheckBox->isChecked());
config()->set(Config::Security_PasswordEmptyPlaceholder, m_secUi->passwordShowDotsCheckBox->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_ResetTouchId, m_secUi->touchIDResetCheckBox->isChecked());

View File

@ -6,6 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>559</width>
<height>1280</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
@ -228,9 +230,9 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="ignoreGroupExpansionCheckBox">
<widget class="QCheckBox" name="trackNonDataChangesCheckBox">
<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>
</widget>
</item>

View File

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

View File

@ -186,7 +186,7 @@ void EntryPreviewWidget::setPasswordVisible(bool state)
if (state) {
m_ui->entryPasswordLabel->setText(password);
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("");
} else {
m_ui->entryPasswordLabel->setText(QString("\u25cf").repeated(6));

View File

@ -111,7 +111,7 @@ void PasswordEdit::setShowPassword(bool show)
if (m_repeatPasswordEdit) {
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->setText(text());
} else {
@ -166,7 +166,7 @@ void PasswordEdit::updateRepeatStatus()
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);
}
}

View File

@ -844,7 +844,7 @@ void EditEntryWidget::setForms(Entry* entry, bool restore)
m_mainUi->usernameComboBox->lineEdit()->setText(entry->username());
m_mainUi->urlEdit->setText(entry->url());
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) {
m_mainUi->passwordEdit->enablePasswordGenerator();
}

View File

@ -174,7 +174,7 @@ QVariant EntryModel::data(const QModelIndex& index, int role) const
if (attr->isReference(EntryAttributes::PasswordKey)) {
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 = "";
}
return result;

View File

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