Correct issues with apply button

* Don't show apply button when creating new entries or groups (Fix #2191)
* Don't mark entry/group as dirty when first creating a new one (prevents unnecessary discard dialog on cancel)
* Properly enable/disable apply button when changes are made to entries and groups
* Don't show discard change warning when locking database unless their are actual changes made

NOTE: Extra pages in the group edit widget are not watched for changes yet. Requires a major refactor.
This commit is contained in:
Jonathan White
2019-04-07 09:56:25 -04:00
parent 71e375aff0
commit 4b1258f585
8 changed files with 155 additions and 89 deletions

View File

@@ -261,12 +261,11 @@ bool DatabaseWidget::isSearchActive() const
bool DatabaseWidget::isEditWidgetModified() const
{
if (currentWidget() == m_editEntryWidget) {
return m_editEntryWidget->hasBeenModified();
} else {
// other edit widget don't have a hasBeenModified() method yet
// assume that they already have been modified
return true;
return m_editEntryWidget->isModified();
} else if (currentWidget() == m_editGroupWidget) {
return m_editGroupWidget->isModified();
}
return false;
}
QList<int> DatabaseWidget::mainSplitterSizes() const
@@ -1249,7 +1248,7 @@ bool DatabaseWidget::lock()
clipboard()->clearCopiedText();
if (currentMode() == DatabaseWidget::Mode::EditMode) {
if (isEditWidgetModified()) {
auto result = MessageBox::question(this,
tr("Lock Database?"),
tr("You are editing an entry. Discard changes and lock anyway?"),