mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Fix remove entry for databaseV1
This commit is contained in:
@@ -258,7 +258,7 @@ class NodeAdapter
|
|||||||
if (subNode.type == Type.GROUP) {
|
if (subNode.type == Type.GROUP) {
|
||||||
if (showNumberEntries) {
|
if (showNumberEntries) {
|
||||||
holder.numberChildren?.apply {
|
holder.numberChildren?.apply {
|
||||||
text = (subNode as GroupVersioned).getChildEntries().size.toString()
|
text = (subNode as GroupVersioned).getChildEntries(true).size.toString()
|
||||||
textSize = infoTextSize
|
textSize = infoTextSize
|
||||||
visibility = View.VISIBLE
|
visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -304,14 +304,12 @@ class Database {
|
|||||||
|
|
||||||
val searchResult = search(query, SearchDbHelper.MAX_SEARCH_ENTRY)
|
val searchResult = search(query, SearchDbHelper.MAX_SEARCH_ENTRY)
|
||||||
if (searchResult != null) {
|
if (searchResult != null) {
|
||||||
for (entry in searchResult.getChildEntries()) {
|
for (entry in searchResult.getChildEntries(true)) {
|
||||||
if (!entry.isMetaStream) { // TODO metastream
|
entry.pwEntryV3?.let {
|
||||||
entry.pwEntryV3?.let {
|
cursorV3?.addEntry(it)
|
||||||
cursorV3?.addEntry(it)
|
}
|
||||||
}
|
entry.pwEntryV4?.let {
|
||||||
entry.pwEntryV4?.let {
|
cursorV4?.addEntry(it)
|
||||||
cursorV4?.addEntry(it)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,10 +179,16 @@ class GroupVersioned : NodeVersioned, PwGroupInterface<GroupVersioned, EntryVers
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getChildEntries(): MutableList<EntryVersioned> {
|
override fun getChildEntries(): MutableList<EntryVersioned> {
|
||||||
|
return getChildEntries(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getChildEntries(withoutMetaStream: Boolean): MutableList<EntryVersioned> {
|
||||||
val children = ArrayList<EntryVersioned>()
|
val children = ArrayList<EntryVersioned>()
|
||||||
|
|
||||||
pwGroupV3?.getChildEntries()?.forEach {
|
pwGroupV3?.getChildEntries()?.forEach {
|
||||||
children.add(EntryVersioned(it))
|
val entryToAddAsChild = EntryVersioned(it)
|
||||||
|
if (!withoutMetaStream || (withoutMetaStream && !entryToAddAsChild.isMetaStream))
|
||||||
|
children.add(entryToAddAsChild)
|
||||||
}
|
}
|
||||||
pwGroupV4?.getChildEntries()?.forEach {
|
pwGroupV4?.getChildEntries()?.forEach {
|
||||||
children.add(EntryVersioned(it))
|
children.add(EntryVersioned(it))
|
||||||
@@ -200,14 +206,11 @@ class GroupVersioned : NodeVersioned, PwGroupInterface<GroupVersioned, EntryVers
|
|||||||
children.addAll(getChildGroups())
|
children.addAll(getChildGroups())
|
||||||
|
|
||||||
pwGroupV3?.let {
|
pwGroupV3?.let {
|
||||||
if (withoutMetaStream)
|
children.addAll(getChildEntries(withoutMetaStream))
|
||||||
children.addAll(getChildEntries().filter { !it.isMetaStream })
|
|
||||||
else
|
|
||||||
children.addAll(getChildEntries())
|
|
||||||
}
|
}
|
||||||
pwGroupV4?.let {
|
pwGroupV4?.let {
|
||||||
// No MetasStream in V4
|
// No MetasStream in V4
|
||||||
children.addAll(getChildEntries())
|
children.addAll(getChildEntries(withoutMetaStream))
|
||||||
}
|
}
|
||||||
|
|
||||||
return children
|
return children
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ interface NodeVersioned: PwNodeInterface<GroupVersioned> {
|
|||||||
|
|
||||||
val nodePositionInParent: Int
|
val nodePositionInParent: Int
|
||||||
get() {
|
get() {
|
||||||
parent?.getChildren(false)?.let { children ->
|
parent?.getChildren(true)?.let { children ->
|
||||||
for ((i, child) in children.withIndex()) {
|
for ((i, child) in children.withIndex()) {
|
||||||
if (child == this)
|
if (child == this)
|
||||||
return i
|
return i
|
||||||
|
|||||||
Reference in New Issue
Block a user