Ask the user before moving an entry to the recycle bin.

Closes #447
This commit is contained in:
Felix Geyer 2016-09-02 12:00:12 +02:00
parent 1635a5211f
commit 878995366a
2 changed files with 16 additions and 5 deletions

View File

@ -341,14 +341,24 @@ void DatabaseWidget::deleteEntries()
}
}
else {
if (selected.size() > 1) {
QMessageBox::StandardButton result = MessageBox::question(
QMessageBox::StandardButton result;
if (selected.size() == 1) {
result = MessageBox::question(
this, tr("Move entry to recycle bin?"),
tr("Do you really want to move entry \"%1\" to the recycle bin?")
.arg(selectedEntries.first()->title()),
QMessageBox::Yes | QMessageBox::No);
}
else {
result = MessageBox::question(
this, tr("Move entries to recycle bin?"),
tr("Do you really want to move %n entry(s) to the recycle bin?", 0, selected.size()),
QMessageBox::Yes | QMessageBox::No);
if (result == QMessageBox::No) {
return;
}
}
if (result == QMessageBox::No) {
return;
}
Q_FOREACH (Entry* entry, selectedEntries) {

View File

@ -239,6 +239,7 @@ void TestGui::testSearch()
QVERIFY(entryDeleteWidget->isEnabled());
QVERIFY(!m_db->metadata()->recycleBin());
MessageBox::setNextAnswer(QMessageBox::Yes);
QTest::mouseClick(entryDeleteWidget, Qt::LeftButton);
QCOMPARE(entryView->model()->rowCount(), 3);