From 70c80ee5273b52b5c6f6d6c27654f6829014fcf0 Mon Sep 17 00:00:00 2001 From: Herbert Poul Date: Fri, 30 Jul 2021 13:47:05 +0200 Subject: [PATCH] add easy way to check whether a given object is located in the recycle bin. --- lib/src/kdbx_object.dart | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/src/kdbx_object.dart b/lib/src/kdbx_object.dart index 23361fa..60db13d 100644 --- a/lib/src/kdbx_object.dart +++ b/lib/src/kdbx_object.dart @@ -247,6 +247,19 @@ abstract class KdbxObject extends KdbxNode { } void merge(MergeContext mergeContext, covariant KdbxObject other); + + bool isInRecycleBin() { + final targetGroup = file!.recycleBin; + if (targetGroup == null) { + return false; + } + return isInGroup(targetGroup); + } + + bool isInGroup(KdbxGroup group) { + final parent = this.parent; + return parent != null && (parent == group || parent.isInGroup(group)); + } } class KdbxUuid {