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 (showNumberEntries) {
|
||||
holder.numberChildren?.apply {
|
||||
text = (subNode as GroupVersioned).getChildEntries().size.toString()
|
||||
text = (subNode as GroupVersioned).getChildEntries(true).size.toString()
|
||||
textSize = infoTextSize
|
||||
visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
@@ -304,14 +304,12 @@ class Database {
|
||||
|
||||
val searchResult = search(query, SearchDbHelper.MAX_SEARCH_ENTRY)
|
||||
if (searchResult != null) {
|
||||
for (entry in searchResult.getChildEntries()) {
|
||||
if (!entry.isMetaStream) { // TODO metastream
|
||||
entry.pwEntryV3?.let {
|
||||
cursorV3?.addEntry(it)
|
||||
}
|
||||
entry.pwEntryV4?.let {
|
||||
cursorV4?.addEntry(it)
|
||||
}
|
||||
for (entry in searchResult.getChildEntries(true)) {
|
||||
entry.pwEntryV3?.let {
|
||||
cursorV3?.addEntry(it)
|
||||
}
|
||||
entry.pwEntryV4?.let {
|
||||
cursorV4?.addEntry(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,10 +179,16 @@ class GroupVersioned : NodeVersioned, PwGroupInterface<GroupVersioned, EntryVers
|
||||
}
|
||||
|
||||
override fun getChildEntries(): MutableList<EntryVersioned> {
|
||||
return getChildEntries(false)
|
||||
}
|
||||
|
||||
fun getChildEntries(withoutMetaStream: Boolean): MutableList<EntryVersioned> {
|
||||
val children = ArrayList<EntryVersioned>()
|
||||
|
||||
pwGroupV3?.getChildEntries()?.forEach {
|
||||
children.add(EntryVersioned(it))
|
||||
val entryToAddAsChild = EntryVersioned(it)
|
||||
if (!withoutMetaStream || (withoutMetaStream && !entryToAddAsChild.isMetaStream))
|
||||
children.add(entryToAddAsChild)
|
||||
}
|
||||
pwGroupV4?.getChildEntries()?.forEach {
|
||||
children.add(EntryVersioned(it))
|
||||
@@ -200,14 +206,11 @@ class GroupVersioned : NodeVersioned, PwGroupInterface<GroupVersioned, EntryVers
|
||||
children.addAll(getChildGroups())
|
||||
|
||||
pwGroupV3?.let {
|
||||
if (withoutMetaStream)
|
||||
children.addAll(getChildEntries().filter { !it.isMetaStream })
|
||||
else
|
||||
children.addAll(getChildEntries())
|
||||
children.addAll(getChildEntries(withoutMetaStream))
|
||||
}
|
||||
pwGroupV4?.let {
|
||||
// No MetasStream in V4
|
||||
children.addAll(getChildEntries())
|
||||
children.addAll(getChildEntries(withoutMetaStream))
|
||||
}
|
||||
|
||||
return children
|
||||
|
||||
@@ -4,7 +4,7 @@ interface NodeVersioned: PwNodeInterface<GroupVersioned> {
|
||||
|
||||
val nodePositionInParent: Int
|
||||
get() {
|
||||
parent?.getChildren(false)?.let { children ->
|
||||
parent?.getChildren(true)?.let { children ->
|
||||
for ((i, child) in children.withIndex()) {
|
||||
if (child == this)
|
||||
return i
|
||||
|
||||
Reference in New Issue
Block a user