Hint is displayed when notes section is hidden.

The alignment is a bit off, however.  A better option may be simply
disabling the QPlainTextEdit widget and stashing the actual notes
in another buffer somewhere.
This commit is contained in:
Joe Brown 2017-05-28 21:58:15 -05:00 committed by thez3ro
parent fdceeb368e
commit ff01a7da1e
No known key found for this signature in database
GPG Key ID: F628F9E41DD7C073
3 changed files with 22 additions and 2 deletions

View File

@ -99,7 +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)), m_mainUi->notesEdit, SLOT(setVisible(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)));
@ -262,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) {
@ -311,7 +317,7 @@ void EditEntryWidget::setForms(const Entry* entry, bool restore)
m_mainUi->expireDatePicker->setReadOnly(m_history);
m_mainUi->notesEnabled->setChecked(true);
m_mainUi->notesEdit->setReadOnly(m_history);
m_mainUi->notesEdit->setVisible(false);
m_mainUi->notesEdit->setVisible(true);
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

@ -135,6 +135,19 @@
</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">
<widget class="QLabel" name="usernameLabel">
<property name="text">