From b9f373dfe07bcf0e588a03254061465664ceb103 Mon Sep 17 00:00:00 2001 From: Herbert Poul Date: Sun, 9 Feb 2020 21:28:22 +0100 Subject: [PATCH] support deleting entries, always tell file that entry information was changed. --- lib/src/kdbx_dao.dart | 4 ++++ lib/src/kdbx_object.dart | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/src/kdbx_dao.dart b/lib/src/kdbx_dao.dart index dc16362..6c96a2d 100644 --- a/lib/src/kdbx_dao.dart +++ b/lib/src/kdbx_dao.dart @@ -51,6 +51,10 @@ extension KdbxDao on KdbxFile { move(group, recycleBin); } + void deleteEntry(KdbxEntry entry) { + move(entry, recycleBin); + } + void move(KdbxObject kdbxObject, KdbxGroup toGroup) { assert(toGroup != null); kdbxObject.times.locationChanged.setToNow(); diff --git a/lib/src/kdbx_object.dart b/lib/src/kdbx_object.dart index 860aade..bd92ab8 100644 --- a/lib/src/kdbx_object.dart +++ b/lib/src/kdbx_object.dart @@ -97,7 +97,7 @@ abstract class KdbxObject extends KdbxNode { set isDirty(bool dirty) { if (dirty) { times.modifiedNow(); - if (!isDirty && dirty) { + if (/*!isDirty && */ dirty) { file.dirtyObject(this); } } @@ -112,7 +112,10 @@ abstract class KdbxObject extends KdbxNode { return el; } - void internalChangeParent(KdbxGroup parent) => _parent = parent; + void internalChangeParent(KdbxGroup parent) { + _parent = parent; + isDirty = true; + } } class KdbxUuid {