mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Fix default values
This commit is contained in:
@@ -76,6 +76,7 @@ class TemplateEngineCompatible(database: DatabaseKDBX): TemplateEngine(database)
|
||||
|
||||
override fun decodeTemplateEntry(templateEntry: EntryKDBX): EntryKDBX {
|
||||
val attributes = HashMap<String, TemplateAttributePosition>()
|
||||
val defaultValues = HashMap<String, String>()
|
||||
val entryCopy = EntryKDBX().apply {
|
||||
updateWith(templateEntry)
|
||||
}
|
||||
@@ -179,11 +180,8 @@ class TemplateEngineCompatible(database: DatabaseKDBX): TemplateEngine(database)
|
||||
}
|
||||
else -> {
|
||||
// To retrieve default values
|
||||
if (attributes.containsKey(label)) {
|
||||
if (value.isNotEmpty()) {
|
||||
val attribute = attributes[label]!!
|
||||
attribute.attribute.default = value
|
||||
}
|
||||
if (value.isNotEmpty()) {
|
||||
defaultValues[label] = value
|
||||
}
|
||||
entryCopy.removeField(label)
|
||||
}
|
||||
@@ -200,6 +198,11 @@ class TemplateEngineCompatible(database: DatabaseKDBX): TemplateEngine(database)
|
||||
attribute.options.associatePasswordGenerator()
|
||||
}
|
||||
|
||||
// Add default value
|
||||
if (defaultValues.containsKey(attribute.label)) {
|
||||
attribute.options.default = defaultValues[attribute.label]!!
|
||||
}
|
||||
|
||||
// Recognize each temp option
|
||||
attribute.options.get(TEMPLATE_ATTRIBUTE_OPTIONS_TEMP)?.let { defaultOption ->
|
||||
when (attribute.type) {
|
||||
|
||||
Reference in New Issue
Block a user