mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-26 15:59:50 -05:00
Fix behavior when saving after canceling entry edit
* Fixes #3141 * Clearing the entry edit widget prior to emitting the editFinished signal caused the widget to be marked modified and prevent new entries from being created. Use an explicit boolean to notify commit success. * Don't clear password generator on canceling a cancel * Don't discard changes if saving from a cancel produces an error
This commit is contained in:
parent
c645e2e303
commit
b90e9ee428
@ -962,6 +962,7 @@ void EditEntryWidget::cancel()
|
||||
m_entry->setIcon(Entry::DefaultIconNumber);
|
||||
}
|
||||
|
||||
bool accepted = false;
|
||||
if (isModified()) {
|
||||
auto result = MessageBox::question(this,
|
||||
QString(),
|
||||
@ -969,18 +970,17 @@ void EditEntryWidget::cancel()
|
||||
MessageBox::Cancel | MessageBox::Save | MessageBox::Discard,
|
||||
MessageBox::Cancel);
|
||||
if (result == MessageBox::Cancel) {
|
||||
m_mainUi->passwordGenerator->reset();
|
||||
return;
|
||||
} else if (result == MessageBox::Save) {
|
||||
accepted = true;
|
||||
if (!commitEntry()) {
|
||||
return;
|
||||
}
|
||||
if (result == MessageBox::Save) {
|
||||
commitEntry();
|
||||
setModified(false);
|
||||
}
|
||||
}
|
||||
|
||||
clear();
|
||||
|
||||
emit editFinished(!isModified());
|
||||
emit editFinished(accepted);
|
||||
}
|
||||
|
||||
void EditEntryWidget::clear()
|
||||
|
Loading…
Reference in New Issue
Block a user