Browse Source

when saving to xml, make sure isDirty = false event is triggered.

remove-cryptography-dependency
Herbert Poul 5 years ago
parent
commit
b3d152ac94
  1. 6
      lib/src/kdbx_object.dart

6
lib/src/kdbx_object.dart

@ -37,6 +37,10 @@ mixin Changeable<T> {
set isDirty(bool dirty) { set isDirty(bool dirty) {
// _logger.finest('changing dirty (old:$_isDirty) $dirty'); // _logger.finest('changing dirty (old:$_isDirty) $dirty');
if (!_isDirty && !dirty) {
// no need for change events when already not-dirty.
return;
}
_isDirty = dirty; _isDirty = dirty;
_controller.add(ChangeEvent(object: this as T, isDirty: dirty)); _controller.add(ChangeEvent(object: this as T, isDirty: dirty));
} }
@ -64,7 +68,7 @@ abstract class KdbxNode with Changeable<KdbxNode> {
/// will mark this object as not dirty. /// will mark this object as not dirty.
@mustCallSuper @mustCallSuper
XmlElement toXml() { XmlElement toXml() {
_isDirty = false; isDirty = false;
final el = node.copy() as XmlElement; final el = node.copy() as XmlElement;
return el; return el;
} }

Loading…
Cancel
Save