Warn user if deleting entries that are referenced. (#1744)

On warning, references can be replaced with original values or ignored.
Removal process can be also skipped for each conflicting entry. Resolves #852.
This commit is contained in:
Wojtek Gumuła 2018-12-25 00:15:46 +01:00 committed by Jonathan White
parent 4d4c839afa
commit c630214915
9 changed files with 205 additions and 61 deletions

View file

@ -23,6 +23,9 @@
#include "core/DatabaseIcons.h"
#include "core/Global.h"
#include "core/Metadata.h"
#include "core/Tools.h"
#include <QtConcurrent>
const int Group::DefaultIconNumber = 48;
const int Group::RecycleBinIconNumber = 43;
@ -119,7 +122,7 @@ const QUuid& Group::uuid() const
const QString Group::uuidToHex() const
{
return QString::fromLatin1(m_uuid.toRfc4122().toHex());
return Tools::uuidToHex(m_uuid);
}
QString Group::name() const
@ -548,6 +551,12 @@ QList<Entry*> Group::entriesRecursive(bool includeHistoryItems) const
return entryList;
}
QList<Entry*> Group::referencesRecursive(const Entry* entry) const
{
auto entries = entriesRecursive();
return QtConcurrent::blockingFiltered(entries, [entry](const Entry* e) { return e->hasReferencesTo(entry->uuid()); });
}
Entry* Group::findEntryByUuid(const QUuid& uuid) const
{
if (uuid.isNull()) {