mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-02-03 01:50:10 -05:00
parent
78ef6f0d04
commit
240939ce3b
@ -927,6 +927,19 @@ void EditEntryWidget::cancel()
|
|||||||
m_entry->setIcon(Entry::DefaultIconNumber);
|
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();
|
clear();
|
||||||
|
|
||||||
emit editFinished(m_saved);
|
emit editFinished(m_saved);
|
||||||
|
@ -492,6 +492,7 @@ void TestGui::testAddEntry()
|
|||||||
// Add entry "something 5" but click cancel button (does NOT add entry)
|
// Add entry "something 5" but click cancel button (does NOT add entry)
|
||||||
QTest::mouseClick(entryNewWidget, Qt::LeftButton);
|
QTest::mouseClick(entryNewWidget, Qt::LeftButton);
|
||||||
QTest::keyClicks(titleEdit, "something 5");
|
QTest::keyClicks(titleEdit, "something 5");
|
||||||
|
MessageBox::setNextAnswer(QMessageBox::Discard);
|
||||||
QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Cancel), Qt::LeftButton);
|
QTest::mouseClick(editEntryWidgetButtonBox->button(QDialogButtonBox::Cancel), Qt::LeftButton);
|
||||||
|
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user