Fix template entry edition

This commit is contained in:
J-Jamet
2021-07-20 19:53:52 +02:00
parent 13f8df4e0d
commit 706d117d80
2 changed files with 13 additions and 1 deletions

View File

@@ -165,6 +165,18 @@ class Database {
return templatesGroup == entry.parent
}
// Not the same as decode, here remove in all cases the template link in the entry data
fun removeTemplateConfiguration(entry: Entry): Entry {
entry.entryKDBX?.let {
mDatabaseKDBX?.decodeEntryWithTemplateConfiguration(it, false)?.let { decode ->
return Entry(decode)
}
}
return entry
}
// Remove the template link in the entry data if it's a basic entry
// or compress the template fields (as pseudo language) if it's a template entry
fun decodeEntryWithTemplateConfiguration(entry: Entry, lastEntryVersion: Entry? = null): Entry {
entry.entryKDBX?.let {
val lastEntry = lastEntryVersion ?: entry

View File

@@ -400,7 +400,7 @@ class Entry : Node, EntryVersionedInterface<Group> {
fun getEntryInfo(database: Database?, raw: Boolean = false): EntryInfo {
val entryInfo = EntryInfo()
// Remove unwanted template fields
(database?.decodeEntryWithTemplateConfiguration(this) ?: this).apply {
(database?.removeTemplateConfiguration(this) ?: this).apply {
if (raw)
database?.stopManageEntry(this)
else