Fix pluralization of confirmation prompts

This commit is contained in:
Edward Jones 2018-03-13 20:03:59 +00:00
parent e66adfbf68
commit 963a7802d1
2 changed files with 25 additions and 28 deletions

View File

@ -479,23 +479,21 @@ void DatabaseWidget::deleteEntries()
bool inRecycleBin = Tools::hasChild(m_db->metadata()->recycleBin(), selectedEntries.first());
if (inRecycleBin || !m_db->metadata()->recycleBinEnabled()) {
QMessageBox::StandardButton result;
QString prompt;
if (selected.size() == 1) {
result = MessageBox::question(
this, tr("Delete entry?"),
tr("Do you really want to delete the entry \"%1\" for good?")
.arg(selectedEntries.first()->title().toHtmlEscaped()),
QMessageBox::Yes | QMessageBox::No);
prompt = tr("Do you really want to delete the entry \"%1\" for good?")
.arg(selectedEntries.first()->title().toHtmlEscaped());
}
else {
result = MessageBox::question(
this, tr("Delete entries?"),
tr("Do you really want to delete %1 entries for good?")
.arg(selected.size()),
QMessageBox::Yes | QMessageBox::No);
prompt = tr("Do you really want to delete %n entry(s) for good?", "", selected.size());
}
QMessageBox::StandardButton result = MessageBox::question(
this,
tr("Delete entry(s)?", "", selected.size()),
prompt,
QMessageBox::Yes | QMessageBox::No);
if (result == QMessageBox::Yes) {
for (Entry* entry : asConst(selectedEntries)) {
delete entry;
@ -504,22 +502,20 @@ void DatabaseWidget::deleteEntries()
}
}
else {
QMessageBox::StandardButton result;
QString prompt;
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().toHtmlEscaped()),
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);
prompt = tr("Do you really want to move entry \"%1\" to the recycle bin?")
.arg(selectedEntries.first()->title().toHtmlEscaped());
} else {
prompt = tr("Do you really want to move %n entry(s) to the recycle bin?", "", selected.size());
}
QMessageBox::StandardButton result = MessageBox::question(
this,
tr("Move entry(s) to recycle bin?", "", selected.size()),
prompt,
QMessageBox::Yes | QMessageBox::No);
if (result == QMessageBox::No) {
return;
}

View File

@ -305,9 +305,10 @@ void EditWidgetIcons::removeCustomIcon()
int iconUseCount = entriesWithSameIcon.size() + groupsWithSameIcon.size();
if (iconUseCount > 0) {
QMessageBox::StandardButton ans = MessageBox::question(this, tr("Confirm Delete"),
tr("This icon is used by %1 entries, and will be replaced "
"by the default icon. Are you sure you want to delete it?")
.arg(iconUseCount), QMessageBox::Yes | QMessageBox::No);
tr("This icon is used by %n entry(s), and will be replaced "
"by the default icon. Are you sure you want to delete it?",
"", iconUseCount),
QMessageBox::Yes | QMessageBox::No);
if (ans == QMessageBox::No) {
// Early out, nothing is changed