Skip to content
This repository has been archived by the owner on Dec 9, 2021. It is now read-only.

Commit

Permalink
Ask the user before moving an entry to the recycle bin.
Browse files Browse the repository at this point in the history
Closes #447
  • Loading branch information
debfx committed Sep 2, 2016
1 parent 1635a52 commit 8789953
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/gui/DatabaseWidget.cpp
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions tests/gui/TestGui.cpp
Expand Up @@ -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);
Expand Down

0 comments on commit 8789953

Please sign in to comment.