Implement review feedback

This commit is contained in:
Janek Bevendorff 2018-10-19 21:41:42 +02:00
parent bea31f9bcc
commit 0ca7fd369a
14 changed files with 59 additions and 65 deletions

View file

@ -460,7 +460,8 @@ void DatabaseWidget::deleteEntries()
selectedEntries.append(m_entryView->entryFromIndex(index));
}
bool inRecycleBin = Tools::hasChild(m_db->metadata()->recycleBin(), selectedEntries.first());
auto* recycleBin = m_db->metadata()->recycleBin();
bool inRecycleBin = recycleBin && recycleBin->findEntryByUuid(selectedEntries.first()->uuid());
if (inRecycleBin || !m_db->metadata()->recycleBinEnabled()) {
QString prompt;
if (selected.size() == 1) {
@ -688,9 +689,10 @@ void DatabaseWidget::deleteGroup()
return;
}
bool inRecycleBin = Tools::hasChild(m_db->metadata()->recycleBin(), currentGroup);
auto* recycleBin = m_db->metadata()->recycleBin();
bool inRecycleBin = recycleBin && recycleBin->findGroupByUuid(currentGroup->uuid());
bool isRecycleBin = (currentGroup == m_db->metadata()->recycleBin());
bool isRecycleBinSubgroup = Tools::hasChild(currentGroup, m_db->metadata()->recycleBin());
bool isRecycleBinSubgroup = currentGroup->findGroupByUuid(m_db->metadata()->recycleBin()->uuid());
if (inRecycleBin || isRecycleBin || isRecycleBinSubgroup || !m_db->metadata()->recycleBinEnabled()) {
QMessageBox::StandardButton result = MessageBox::question(
this,