Request confirmation to discard unsaved changes

Solves #1181
This commit is contained in:
Daniel Wilches 2018-03-17 14:31:15 -07:00
parent 78ef6f0d04
commit 240939ce3b
2 changed files with 14 additions and 0 deletions

View file

@ -927,6 +927,19 @@ void EditEntryWidget::cancel()
m_entry->setIcon(Entry::DefaultIconNumber);
}
if (!m_saved) {
auto result = MessageBox::question(this, QString(), tr("Entry has unsaved changes"),
QMessageBox::Cancel | QMessageBox::Save | QMessageBox::Discard,
QMessageBox::Cancel);
if (result == QMessageBox::Cancel) {
return;
}
if (result == QMessageBox::Save) {
commitEntry();
m_saved = true;
}
}
clear();
emit editFinished(m_saved);