Merge pull request #1124 from keepassxreboot/feature/hide_notes

Make notes hidden by default
This commit is contained in:
TheZ3ro 2017-10-26 13:25:16 +02:00 committed by GitHub
commit cfe4299301
5 changed files with 42 additions and 3 deletions

View File

@ -163,6 +163,7 @@ void SettingsWidget::loadSettings()
m_secUi->passwordCleartextCheckBox->setChecked(config()->get("security/passwordscleartext").toBool());
m_secUi->passwordDetailsCleartextCheckBox->setChecked(config()->get("security/hidepassworddetails").toBool());
m_secUi->passwordRepeatCheckBox->setChecked(config()->get("security/passwordsrepeat").toBool());
m_secUi->hideNotesCheckBox->setChecked(config()->get("security/hidenotes").toBool());
for (const ExtraPage& page: asConst(m_extraPages)) {
@ -231,6 +232,7 @@ void SettingsWidget::saveSettings()
config()->set("security/passwordscleartext", m_secUi->passwordCleartextCheckBox->isChecked());
config()->set("security/hidepassworddetails", m_secUi->passwordDetailsCleartextCheckBox->isChecked());
config()->set("security/passwordsrepeat", m_secUi->passwordRepeatCheckBox->isChecked());
config()->set("security/hidenotes", m_secUi->hideNotesCheckBox->isChecked());
// Security: clear storage if related settings are disabled
if (!config()->get("RememberLastDatabases").toBool()) {

View File

@ -143,6 +143,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="hideNotesCheckBox">
<property name="text">
<string>Hide entry notes by default</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@ -99,6 +99,7 @@ void EditEntryWidget::setupMain()
connect(m_mainUi->togglePasswordButton, SIGNAL(toggled(bool)), m_mainUi->passwordEdit, SLOT(setShowPassword(bool)));
connect(m_mainUi->togglePasswordGeneratorButton, SIGNAL(toggled(bool)), SLOT(togglePasswordGeneratorButton(bool)));
connect(m_mainUi->expireCheck, SIGNAL(toggled(bool)), m_mainUi->expireDatePicker, SLOT(setEnabled(bool)));
connect(m_mainUi->notesEnabled, SIGNAL(toggled(bool)), this, SLOT(toggleHideNotes(bool)));
m_mainUi->passwordRepeatEdit->enableVerifyMode(m_mainUi->passwordEdit);
connect(m_mainUi->passwordGenerator, SIGNAL(appliedPassword(QString)), SLOT(setGeneratedPassword(QString)));
@ -261,6 +262,12 @@ void EditEntryWidget::updateAttachmentButtonsEnabled(const QModelIndex& current)
m_advancedUi->removeAttachmentButton->setEnabled(enable && !m_history);
}
void EditEntryWidget::toggleHideNotes(bool visible)
{
m_mainUi->notesEdit->setVisible(visible);
m_mainUi->notesHint->setVisible(!visible);
}
QString EditEntryWidget::entryTitle() const
{
if (m_entry) {
@ -308,7 +315,10 @@ void EditEntryWidget::setForms(const Entry* entry, bool restore)
m_mainUi->passwordRepeatEdit->setReadOnly(m_history);
m_mainUi->expireCheck->setEnabled(!m_history);
m_mainUi->expireDatePicker->setReadOnly(m_history);
m_mainUi->notesEnabled->setChecked(!config()->get("security/hidenotes").toBool());
m_mainUi->notesEdit->setReadOnly(m_history);
m_mainUi->notesEdit->setVisible(!config()->get("security/hidenotes").toBool());
m_mainUi->notesHint->setVisible(config()->get("security/hidenotes").toBool());
m_mainUi->togglePasswordGeneratorButton->setChecked(false);
m_mainUi->togglePasswordGeneratorButton->setDisabled(m_history);
m_mainUi->passwordGenerator->reset();

View File

@ -100,6 +100,7 @@ private slots:
void updateHistoryButtons(const QModelIndex& current, const QModelIndex& previous);
void useExpiryPreset(QAction* action);
void updateAttachmentButtonsEnabled(const QModelIndex& current);
void toggleHideNotes(bool visible);
private:
void setupMain();

View File

@ -79,10 +79,10 @@
</property>
</widget>
</item>
<item row="9" column="0" alignment="Qt::AlignRight|Qt::AlignTop">
<widget class="QLabel" name="notesLabel">
<item row="9" column="0" alignment="Qt::AlignLeft|Qt::AlignTop">
<widget class="QCheckBox" name="notesEnabled">
<property name="text">
<string>Notes:</string>
<string>Notes</string>
</property>
</widget>
</item>
@ -127,6 +127,25 @@
<height>100</height>
</size>
</property>
<property name="font">
<font>
<family>Monospace</family>
<pointsize>10</pointsize>
</font>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLabel" name="notesHint">
<property name="visible">
<bool>false</bool>
</property>
<property name="text">
<string>Toggle the checkbox to reveal the notes section.</string>
</property>
<property name="alignment">
<set>Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="1" column="0" alignment="Qt::AlignRight">